Login in to your Centos/RHEL Linux Server as root user

In termilnal, use

#yum install postgresql postgresql-server

Start Postgresql

#chkconfig postgresql on

#service postgresql start

Connect to the database using psql command line tool

#psql –d template –U postgres

Open the post for postgressql service which is 5432and allow it in firewall

# vi /etc/sysconfig/iptables

Append following line before COMMIT line to open port 5432

A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 5432 -j ACCEPT

Save the configuration and restart the firewall to apply changes

# service iptables restart

To allow remote client to allow connection to the postgresql sever, find the configuration file and edit the following setting

listen_addresses=’localhost’
to
listen_addresses=’*’

Also Edit the file:
$ vi /etc/postgresql/8.2/main/pg_hba.conf  or  $ vi /var/lib/pgsql/data/pg_hba.conf
host all all 10.10.29.0/24 trust  
to
host all all 0.0.0.0/0 trust

Advertisements