Initial Postgres Configuration

From Glom
Jump to: navigation, search

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 PostgreSQL directly for self-hosting, without needing any Postgres configuration.

These instructions that you have PostgreSQL 8.1 or later, though Glom can use older versions of PostgreSQL if necessary.

Contents

Create a user who can create databases

[murrayc@localhost]$ su
Password:
[root@localhost]# su postgres

(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:

$ 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

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

/etc/postgresql/9.1/main/postgresql.conf

(In Ubuntu, using sudo. Use 8.1, 8.4, or similar, instead of 9.1, depending on your Ubuntu version.) or

/var/lib/pgsql/data/postgresql.conf

(In Fedora)

Add this line, replacing (or commenting-out) any previous settings for listen_addresses

listen_addresses = '*'

The default, which is also often on a commented-out line, when you don't set listen_addresses, is

listen_addresses = 'localhost'

but this does not allow connections from other computers.

pg_hba.conf

As root, edit

/etc/postgresql/9.1/main/pg_hba.conf

(In Ubuntu, using sudo. Use 8.1, 8.4, or similar, instead of 9.1, depending on your Ubuntu version.) or

/var/lib/pgsql/data/pg_hba.conf

(on Fedora)

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

#Allow any IP to connect, with a password:
host    all         all         0.0.0.0          0.0.0.0      md5
host    all         all         ::1/128                       md5
local   all         all                                       md5

(I think the gaps can be either tabs or spaces.)

(Apparently all three lines are necessary, at least with PostgreSQL 9.1, but please tell me (Murray) if you know better.)

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

Useful test tools

pgadmin3 phppgadmin

Personal tools
Namespaces

Variants
Actions
Navigation
Tools