======Install Postgresql====== This page shows how to install Postgresql on on CentOS 6 64bit. =====Prerequisites===== You must have a CentOS machine already set up in accordance with the the [[linux:install_centos6|Install CentOS 6]] guide. =====Install Postgresql===== Run the following as rootyum install postgresql postgresql-server chkconfig postgresql on service postgresql initidb service postgresql start Set the password for the user 'postgres' echo "postgres:pa55w0rd" | chpasswd =====Configure Firewall===== 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 to Postgreql===== Connect using psql command line toolsu - postgres psql -d template1 -U postgres =====Create Database===== Connect using psql and run the following. DATABSE_NAME as appropriate.create database DATABASE_NAME; \q =====Create Postgresql User===== Connect using psql and run the following. Replace USERNAME, PASSWORD and DATABSE_NAME as appropriatecreate 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