Wednesday, August 24, 2005

Getting started with Postgresql 8.0.3

from http://robinbowes.com/article.php/20050628195431479

Install postgresql using yum:

# yum install postgresql postgresql-server postgresql-devel php-pgsql

Modify /etc/init.d/postgresql to use /home/postgres for the databases and to log to /var/log/postgres

# vi /etc/init.d/postgresql

#PGDATA=/var/lib/pgsql
#if [ -f "$PGDATA/PG_VERSION" ] && [ -d "$PGDATA/base/template1" ]
#then
# echo "Using old-style directory structure"
#else
# PGDATA=/var/lib/pgsql/data
#fi
#PGLOG=${PGDATA}/pgstartup.log
PGDATA=/home/postgres/data
PGLOG=/var/log/postgres/pgstartup.log

Create the data and log dir and set ownership:

# mkdir /home/postgres /var/log/postgres
# chown postgres:postgres /home/postgres /var/log/postgres

Start up postgresql

# service postgresql start

Change the superuser password:

# su - postgres

# psql -d template1 -U postgres -c "alter user postgres with password 'newpassword'"

Now modify pg_hba.conf (/var/lib/pgsql/data/pg_hba.conf):

# "local" is for Unix domain socket connections only
local all all md5
# IPv4 TCP/IP connections
host all all 127.0.0.1/32 md5

This allows access using the local unix socket or local tcp/ip connection but only for postgresql users.

Restart postgresql: service postgresql restart

0 Comments:

Post a Comment

<< Home