Installing PostgreSQL 9.4.X on CentOS/RHEL 7/6/5 and Fedora

Installing PostgreSQL 9.4.X on CentOS/RHEL 7/6/5 and Fedora

PostgreSQL is an 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.

Adding PostgreSQL Yum Repository

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

# rpm -Uvh

# rpm -Uvh

# rpm -Uvh

Fedora 21:
# rpm -Uvh

Fedora 20
# rpm -Uvh

Fedora 19
# rpm -Uvh

For more details visit PostgreSQL repositories link page where you can get repository package rpm for various operating systems.

Installing PostgreSQL Server

After enabling PostgreSQL yum repository in your system use following command to install PostgreSQL 9.4.X on your system with yum package manager.

# yum install postgresql94-server postgresql94
Initializing PGDATA

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

# /usr/pgsql-9.4/bin/postgresql94-setup initdb

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

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

Start PostgreSQL Server

To start PostgreSQL service using following command as per your operating systems. Also enable PostgreSQL service to auto start on system boot.

For CentOS/RHEL 7 and Fedora 21

# systemctl start postgresql-9.4
# systemctl enable postgresql-9.4

For CentOS/RHEL 6/5 and Fedora 20/19

# service  postgresql-9.4 start
# chkconfig postgresql-9.3 on
Verify PostgreSQL Installation

After completing above steps, you have installed PostgreSQL 9.4 on your server, Let’s login to postfix to verify that installation completed successfully.

# su - postgres

Use psql command to access PostgreSQL prompt with admin privileges.

$ psql

psql (9.4.1)
Type "help" for help.


You may create password for user postgres for security purpose.

postgres=# password postgres

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

How to Install phpPgAdmin on CentOS using Yum

Thanks for using this tutorial for installing PostgreSQL 9.4 on CentOS/RHEL 7/6/5 and Fedora 21/20/19

Enjoyed this video?
Installing PostgreSQL 9.4.X on CentOS/RHEL 7/6/5 and Fedora
"No Thanks. Please Close This Box!"