PostgreSQL is a powerful, highly scalable, open source and cross-platform object-relational database system that runs on Unix-like operating systems including Linux and Windows OS. It is an enterprise level database system which is highly reliable and offers data integrity and correctness to users.

In this article, we will explain how to install latest version of PostgreSQL 10 on CentOS, RHEL, Oracle Enterprise Linux, Scientific Linux and Fedora using official PostgreSQL Yum repository.

Add PostgreSQL Yum Repository

This official PostgreSQL Yum repository will combine with your Linux system and offers automatic updates for all supported versions of PostgreSQL on RedHat based distributions such as CentOS, Scientific Linux and Scientific Linux, as well as current versions of Fedora.

Note that due to the shorter Fedora support cycle, not all versions are available and we suggest that do not use Fedora for server deployments.


To use the yum repository, follow these steps:

--------------- On RHEL/CentOS 7 and Scientific Linux/Oracle Linux 7 --------------- # yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-redhat10-10-1.noarch.rpm
--------------- On 64-Bit RHEL/CentOS 6 and Scientific Linux/Oracle Linux 6 --------------- # yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-6-x86_64/pgdg-redhat10-10-1.noarch.rpm
--------------- On 32-Bit RHEL/CentOS 6 and Scientific Linux/Oracle Linux 6 --------------- # yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-6-i386/pgdg-redhat10-10-1.noarch.rpm
--------------- On Fedora 26 --------------- # dnf install https://download.postgresql.org/pub/repos/yum/10/fedora/fedora-26-x86_64/pgdg-fedora10-10-2.noarch.rpm
--------------- On Fedora 25 --------------- # dnf install https://download.postgresql.org/pub/repos/yum/10/fedora/fedora-25-x86_64/pgdg-fedora10-10-3.noarch.rpm
--------------- On Fedora 24 --------------- # dnf install https://download.postgresql.org/pub/repos/yum/10/fedora/fedora-24-x86_64/pgdg-fedora10-10-3.noarch.rpm
Enable PostgreSQL Yum Repository

Enable PostgreSQL Yum Repository

Install PostgreSQL Server

After adding PostgreSQL yum repository in your respective Linux distribution, use the following command to install PostgreSQL server and client packages.

# yum install postgresql10-server postgresql10 [On RedHat based Distributions]
# dnf install postgresql10-server postgresql10 [On Fedora Linux]
Install PostgreSQL Server

Install PostgreSQL Server

Important: PostgreSQL data directory /var/lib/pgsql/10/data/ contains all of the data files for the database.

Initialize PostgreSQL Database

Due to some policies for Red Hat based distributions, the PostgreSQL installation will not be active for automatic start or have the database initialized automatically. To complete your database installation, you need to initialize your database before using it for first time.

# /usr/pgsql-10/bin/postgresql-10-setup initdb
Initialize PostgreSQL Database

Initialize PostgreSQL Database

Start and Enable PostgreSQL Server

After database initialize completes, start PostgreSQL service and enable PostgreSQL service to auto start on system boot.

--------------- On SystemD --------------- # systemctl start postgresql-10
# systemctl enable postgresql-10
# systemctl status postgresql-10 --------------- On SysVinit --------------- # service postgresql-10 start
# chkconfig postgresql-10 on
# service postgresql-10 status
Start PostgreSQL Server

Start PostgreSQL Server

Verify PostgreSQL Installation

After installing PostgreSQL 10 on your server, verify its installation by connecting to postgres database server.

# su - postgres
$ psql
psql (10.0)
Type "help" for help.

If you want you can create a password for user postgres for security purpose.

postgres=# \password postgres
Set PostgreSQL User Password

Set PostgreSQL User Password

You can find more information at the PostgreSQL Homepage: https://www.postgresql.org/

Also check out these articles about popular database management systems:

  1. How to Install and Secure MariaDB 10 in CentOS 7
  2. How to Install and Secure MariaDB 10 in CentOS 6
  3. Install MongoDB Community Edition 3.2 on Linux Systems

That’s all! Hope you find this article useful. If you have any questions or thoughts to share, use the comment section below.

Facebook Comments

More Stuff

Emblematic Group and Mozilla Team Up to Showcase Next Generation o... Everything you share on the internet is a story. You read blog posts and watch videos that make you feel connected to people across the world. Virtual...
Latest Firefox Release is Faster than Ever With the introduction of the new Firefox Quantum browser in 2017 we changed the look, feel, and performance of our core product. Since then we have la...
Competing without a Marketing Budget: When All You Have is a Produ... This is a story about the power of a good landing page, PR efforts, and marketing strategy. The refreshing twist here is that instead of explaining ho...
The Ongoing Fiasco and Mysterious Afterlife of QuadrigaCX I’d say you were a little late to the cryptocurrency party if you haven’t heard about the ongoing catastrophe that’s been QuadrigaCX these past six ...
Spread the love

Posted by News Monkey