If a man speaks in a forest, and his wife's not there, is he still wrong?

Getting started with Postgresql 8.0.3

Every time I come back to postgresql I always struggle with getting the authentication set up so I've decided to document it!

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 (mine's in /home/postgres/data):
 
# "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

Story Options

Getting started with Postgresql 8.0.3 | 0 comments
The following comments are owned by whomever posted them. This site is not responsible for what they say.

Topics

  • Home
  • Misc (6/0)
  • Audio (5/0)
  • Linux (21/0)
  • Family (1/0)
  • Fishing Diary (1/0)
  • OpenSolaris (7/0)
  • Computing (11/0)
  • General News (7/0)
  • Chloe (1/0)
  • Emily (2/0)
  • Twins (5/0)
  • Classifieds (2/0)
  • GeekLog (2/0)
  • Project Management (1/0)
  • User Functions






    Lost your password?