How to Install PostgreSQL 9.3 on CentOS/RHEL and Fedora


SSD VPS Server $7/mo

Pre-installed PostgreSQL 9x + free control panel

PostgreSQL is a open source object-relational, highly scalable, SQL compliant database management system. PostgreSQL is developed at the University of California at Berkeley Computer Science Department. This article will help you for installing PostgreSQL on CentOS, RHEL and Fedora Systems.

Step 1: Add PostgreSQL Yum Repository

First step is to install postgres repository in your system, Use one of below commands as per your system architecture and operating system.

CentOS/RHEL 5, 32-Bit:
# rpm -Uvh

CentOS/RHEL 5, 64-Bit:
# rpm -Uvh

CentOS/RHEL 6, 32-Bit:
# rpm -Uvh

CentOS/RHEL 6, 64-Bit:
# rpm -Uvh

Fedora 19, 64-Bit:
# rpm -Uvh

Fedora 18, 64-Bit:
# rpm -Uvh

Fedora 18, 32-Bit:
# rpm -Uvh

Step 2: Install PostgreSQL Server

Use following command to install PostgreSQL on your system with yum package manager.

# yum install postgresql93-server postgresql93

Step 3: Initialize PGDATA

After installing PostgreSQL server, It’s required to initialize it before using first time. To initialize database use below command.

# /etc/init.d/postgresql-9.3 initdb

In some cases above commands doesn't work, Then use following command.

# /usr/pgsql-9.3/bin/postgresql93-setup initdb

Above command will take some time to initialize PostgreSQL first time. PGDATA environment variable contains path of data directory.

PostgreSQL data directory Path: /var/lib/pgsql/9.3/data/

Step 4: Start PostgreSQL Server

Start PostgreSQL service using following command.

# service postgresql-9.3 start

Setup PostgreSQL service to auto start on system boot.

# chkconfig postgresql-9.3 on

Step 5: Verify PostgreSQL Installation

After completing step 4, we have installed postgres 9.3 on server, Let do a basic test to verify that installation completed successfully. To verify switch to postgres user.

# su - postgres

Use psql command to access PostgreSQL prompt with admin privileges.

$ psql

psql (9.3.1)
Type "help" for help.

Congratulation’s! You have successfully installed PostgreSQL Server. Read below article to install phpPgAdmin.



Check out our VPS packages today. Our VPS server management will cover this for you.



January 4, 2015   9046    Linux  
Total 14 Votes:

Tell us how can we improve this post?

+ = Verify Human or Spambot ?

Leave a Comment