User Tools

Site Tools


podoc:configuring_postgresql

Configuring PostgreSQL

Photo Organizer's installer takes care of database creation, but there is still some prep work necessary to get things to the point where the installer can run.

Please note that I'm trying to keep these instructions as generic as possible; if someone has distribution-specific instructions to contribute, I'll happily add them to this page.

In particular, Redhat/Fedora distributions ship with a very locked-down PostgreSQL installation.

Basic Procedure

This procedure assumes the username is po_user and the database will be po_db. You can change these if you like, but remember you'll need to specify these during the installation as well.

Please note that these instructions apply to v2.32 and newer; older releases required more hand-holding.

Create user

First, we need to create the actual user. You'll need to run these commands as the postgres user on your system. To become the postgres user, run the following as root:

 su - postgres

Then, run the following command to create the Photo Organizer user:

 createuser -S -R -P -D po_user     # Use '-A' instead of '-S -R' on PG 7.4

Grant user access rights

This is where things get complicated. It involves editing the pg_hba.conf configuration file. The default for this file is something like this:

local  all      all             ident   sameuser
host    sameuser    127.0.0.1     255.255.255.255    trust

This basically states that if you're only allowed to access a database of the same name as your username, which will not suffice for Photo Organizer. To set up permissions to allow the Photo Organizer installer to run, you'll need to add below lines:

local  po_db  po_user     password
host   po_db  po_user   127.0.0.1  255.255.255.255 password

Note: These lines must come before the “local all all ident sameuser” line. The “all all” and “sameuser” lines are the defaults, and will match everything. Your final configuration will look something like this:

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
local   po_db     po_user                             password
host    po_db     po_user      127.0.0.1/32           password
# "local" is for Unix domain socket connections only
local   all         all                               ident sameuser
# IPv4 local connections:
host    all         all         127.0.0.1/32          ident sameuser
# IPv6 local connections:
host    all         all         ::1/128               ident sameuser

Then run this command as root:

service postgresql restart

And you should be good to go.

podoc/configuring_postgresql.txt · Last modified: 2006/12/22 16:25 by pizza