How to install PostgreSQL on CentOS Linux?

First lets do an update before we start installing PostgreSQL

$ yum update

You can install PostgreSQL from CentOS Base repo or can do a search for the latest version and install it based on your needs. Method 1 describes manual setup and Method 2 indicates an install from CentOS base repo

METHOD 1: Manual setup of PostgreSQL

$ vi /etc/yum.repos.d/CentOS-Base.repo

[base] name=CentOS-$releasever – Base

#released updates
[updates] name=CentOS-$releasever – Updates

Go to and check out for the version of PostgreSQL depending on your OS.

Repo URI for CentOS at the time of writing this tutorial:

Now, change to your home directory and install PostgreSQL

$ cd ~

$ curl -O

$ rpm -ivh pgdg*

METHOD 2: Install from CentOS base repo

$ yum install postgresql84 postgresql84-server postgresql84-contrib

Initialise the service

$ service postgresql initdb
## OR ##
/etc/init.d/postgresql initdb
Set the runlevel

$ chkconfig postgresql-8.4 on

Start the database service

$ service postgresql-8.4 start

To make modifications of PostgreSQL configuration, go to

$vi /var/lib/pgsql/8.4/data/postgresql.conf

Some of the most common changes that can be made related to PostgreSQL are listening IP address and port

listen_address = ”
port 5432


Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Written by kurinchilamp

Website: http://

Leave a Reply

Your email address will not be published. Required fields are marked *

Read previous post:
Firefox: Responsive design testing for Mobile devices

Follow the below steps to set the preset value for responsive design testing on mobile devices i) Go to the...