Initial Postgres Configuration

From Glom
Revision as of 15:33, 23 November 2010 by Isijujemiru (Talk | contribs)

Jump to: navigation, search


Page Is Unavailable Due To Site Maintenance, Please Visit Reserve Copy Page


CLICK HERE


Note that since Glom 1.4, no manual configuration of your local PostgreSQL server is necessary. However, these notes might be useful when configuring a central database server for use with Glom.

Each distro has a different default configuration for Postgres. These notes should help you make Postgres work with Glom.

If you can improve this advice, then please go ahead and edit this page. In the future, we hope to provide a user interface to make this easier. Since Glom 1.3.5, Glom can use Postgres directly for self-hosting, without needing any Postgres configuration.

Create a user who can create databases

<pre> [murrayc@localhost]$ su Password: [root@localhost]# su postgres </pre> (Or "sudo -s -u postgres" on Ubuntu, entering your password when asked)

Now use createuser to create a user that may access the postgres server.

With Postgres 8.1, it looks like this: <pre> $ createuser -P

 (-P means "assign password")

Enter name of role to add: murrayc Enter password for new role: Enter it again: Shall the new role be a superuser? (y/n) y CREATE ROLE </pre>

With Postgres 7.4, it looks like this: <pre> $ createuser -P

 (-P means "assign password")

Enter name of user to add: murrayc Enter password for new user: Enter it again: Shall the new user be allowed to create databases? (y/n) y Shall the new user be allowed to create more new users? (y/n) y CREATE USER </pre>

Allowing access

By default, Postgres usually only allows connections from the same computer, and not via the TCP/IP connection method that Glom uses. You need to change this like so:

postgresql.conf

As root, edit <pre>/etc/postgresql/8.1/main/postgresql.conf</pre> (In Ubuntu Dapper, using sudo) or <pre>/etc/postgresql/7.4/main/postgresql.conf</pre> (In Ubuntu Breezy, using sudo) or <pre>/var/lib/pgsql/data/postgresql.conf</pre> (In Fedora Core.) Note that FC3 and FC4 have Postgres 7.4. FC5 has Postgres 8.1.

If you have postgres >=8.1

Add this line, replacing (or commenting-out) any previous settings for listen_addresses <pre> listen_addresses = '*' </pre>

The default, which is also often on a commented-out line, when you don't set listen_addresses, is <pre> listen_addresses = 'localhost' </pre> but this does not allow connections from other computers.

(The tcpip_socket variable from postgres 7.4 is not recognized with postgres 8.1.)

If you have postgres 7.4

Change <pre>

  1. tcpip_socket = false

</pre> to <pre> tcpip_socket = true </pre>

pg_hba.conf

As root, edit <pre>/etc/postgresql/8.1/main/pg_hba.conf</pre> (In Ubuntu Dapper, using sudo) or <pre>/etc/postgresql/7.4/main/pg_hba.conf</pre> (In Ubuntu Breezy, using sudo) or <pre>/var/lib/pgsql/data/pg_hba.conf</pre> (on Fedora Core)

Add this host line, before any other uncommented host lines:

<pre>

  1. Allow any IP to connect, with a password:

host all all 0.0.0.0 0.0.0.0 md5 </pre> (I think the gaps can be either tabs or spaces.)


Now, restart the Postgres server. The easiest way to do this is to restart your computer.

Useful test tools

pgadmin3 phppgadmin