Server Administration & Management

How to Install PostgreSQL

It is easy to install it via yum or up2date. However, if you need a specific version, it is better to go for rpm installation.

Method-1 :- Using YUM

# yum groupinstall postgresql

Method-2 :- Using UP2DATE

# up2date @ postgresql

Method-3 :- Using RPM

1. You need three rpm.

2. Download the RPM from rpm.pbone.net for your coresponding OS and the required version.

3. Download it to “/usr/local/src” Directory

4. Install them using

# rpm -ivh postgresql-libs–1PGDG.rhel

# rpm -ivh postgresql-server–1PGDG.rhel

# rpm -ivh postgresql–1PGDG.rhel

5. Once you have completed this you need can start the service.

# /etc/init.d/postgresql start

6. Edit the file ‘/var/lib/pgsql/data/pg_hba.conf’, replace all entries of “ident sameuser” with “trust”.

# vi /var/lib/pgsql/data/pg_hba.conf

ident sameuser” with “trust

7. Edit the file ‘/var/lib/pgsql/data/postgresql.conf’, change the line “max_connections=100? to atleast “max_connections=500?.

# vi /var/lib/pgsql/data/postgresql.conf


8. Restart PostgreSQL.

# /etc/init.d/postgresql restart

9. If the initialisation fails the files pg_hba.conf and postgresql.conf will not be created. In such a case, perform the following operation. Check the startup log which is found in /var/lib/pgsql/

# chown postgres /var/lib/pgsql/data

# su postgres

# initdb –D /var/lib/pgsql/data

10. To make sure it starts automatically on boot – do the following command

# chkconfig –list

# chkconfig postgresql on

November 15, 2011 Posted by | PgSQL | , | Leave a comment