How to Install PostgreSQL 10 on CentOS/RHEL 7/6 and Fedora 27/28


PostgreSQL is an open source object-relational, highly scalable, SQL compliant database management system. PostgreSQL, often simply Postgres, is an object-relational database management system (ORDBMS) with an emphasis on extensibility and standards compliance. As a database server, its primary functions are to store data securely and return that data in response to requests from other software applications. It can handle workloads ranging from small single-machine applications to large Internet-facing applications (or for data warehousing) with many concurrent users; on macOS Server, PostgreSQL is the default database; and it is also available for Microsoft Windows and Linux (supplied in most distributions).

. This article will help you to  install PostgreSQL on CentOS, RHEL and Fedora Systems.

Add PostgreSQL Yum Repository

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

CentOS/ 7 ###

CentOS/ 6 ###

Fedora 27 ###

Fedora 28 ###

Installing PostgreSQL Server

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

Initializing PGDATA

After installing PostgreSQL server, It’s required to initialize it before using the first time. To initialize database use below command.  /usr/pgsql-10/bin/postgresql-10-setup initdb


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

PostgreSQL data directory Path is : /var/lib/pgsql/10/data/

Start / Enable  PostgreSQL Server

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

For CentOS/RHEL 7 and Fedora

For CentOS/RHEL 6


Check and Verify PostgreSQL Installation

After  the  above steps, your setup of  Postgresql 10 server is ready , Let’s log in to verify that installation completed successfully.

Use psql command to access PostgreSQL prompt with admin privileges.

You may create password for user postgres

Congratulation  you  PostgreSQL installation  Server is completed

Please share  .

Spread the love
  • 1

PS. If you like this post please share it with your friends on the social networks using the buttons above.Thanks.


Please enter your comment!
Please enter your name here