Wednesday, May 4, 2011

Prepare Postgresql on CentOS in 5 steps

There are a lot of resource on setting up Postgres server, instead of refer the steps from different resource, I drop a notes for quick reference, this guide is written for Centos 5.x.

1. Install the Postgresql server using either YUM or Package Manager.


2. Before starting the server, run the command "service postgresql initdb" to initialize the database.

The database will create in the default location:

/var/lib/pgsql/data


3. Start the database server

chkconfig postgresql on  (set the server startup at boot time)
service postgresql start (start the server)


4. In order to allow connection for remote host, change the line in /var/lib/pgsql/data/pg_hba.conf as:

local all all trust
host all all 0.0.0.0/0 trust

And change the line in /var/lib/pgsql/data/postgresql.conf

listen_address = '*'


5. Now using pgadmin client to make a new connection:

Maintenance DB: Postgres
Username: Postgres

No comments:

Post a Comment