This page shows how to install Postgresql on on CentOS 6 64bit.
You must have a CentOS machine already set up in accordance with the the Install CentOS 6 guide.
Run the following as root
yum install postgresql postgresql-server chkconfig postgresql on service postgresql initidb service postgresql start
Set the password for the user 'postgres'
echo "postgres:pa55w0rd" | chpasswd
Postgresql listens on port 5432.
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT service iptables save service iptables restart
Connect using psql command line tool
su - postgres psql -d template1 -U postgres
Connect using psql and run the following. DATABSE_NAME as appropriate.
create database DATABASE_NAME; \q
Connect using psql and run the following. Replace USERNAME, PASSWORD and DATABSE_NAME as appropriate
create user USERNAME with password 'PASSWORD'; grant all privileges on database DATABASE_NAME to USERNAME; \q
To allow other machines to connect to postgresql, you will need to do the following:
vi /var/lib/pgsql/data/pg_hba.con (OR /etc/postgresql/8.2/main/pg_hba.conf for latest 8.2 version)
host all all 172.16.0.0/16 trust
(I had to rename all 'ident' to 'trust' to get it to work)
vi /var/lib/pgsql/data/postgresql.conf change
listen_addresses='localhost'
to
listen_addresses='*'
or
listen_addresses='202.54.1.2 202.54.1.3'
service postgresql reload