PostgreSQL Installation Steps in RHEL and CentOS 8 Linux.

PostgreSQL is developed by PostgreSQL Global Development Group. PostgreSQL is a general purpose free and open-source object-relational database management system, the most advanced open source database system. You are allow to add custom functions developed using different programming languages such as C/C++, Java, etc. 

PostgreSQL is designed to run other various platforms like Mac OS X, Solaris, Windows and Unix-like platform. In PostgreSQL you can define your own data types, index types, functional languages etc. PostgreSQL implemented multi-version concurrency  control (MVCC) feature even before Oracle. In Oracle MVCC feature is known as snapshot isolation. In this article, we will go through the steps involved to install PostgreSQL in RedHat & CentOS 8 Linux.

Some of the features which are highlighted below due to which PostgreSQL stands out. 
  • Use-defined data types
  • Table inheritance
  • Multi-version concurrency control (MVCC)
  • Asynchronous replication
  • Native Microsoft Windows Server version
  • Tablespace
  • Point-in-time recover
  • Veiws, rules, subquery
  1. Visit for step by step RedHat 8 Installation
  2. Visit For step by step CentOS 8 Installation
Step 1: Postgresql provide DNF Repository.
Execute below command from console to download and install PostgreSQL 
For RedHat, CentOS, Scientific or  Oracle Linux Version 8
# dnf install
# dnf -qy module disable postgresql
Step 2: Install PostgreSQL server and client.
# dnf install postgresql12-server postgresql12
Step 3: Initialize  the PostgreSQL database once the installation is done.
# /usr/pgsql-12/bin/postgresql-12-setup initdb
Step 4: Start the PostgreSQL service and enable it to start on reboot the system and check the status of the service is running
# systemctl enable postgresql-12
# systemctl start postgresql-12
# systemctl status postgresql-12

Step 5: PostgreSQL by default runs on port 5432, check the listening port with below command.
# netstat -antp  | grep 5432
Step 6: postgres user is created during the installation of PostgreSQL with blank password. You need to switch user (su) postgres to login into PostgreSQL database. Use psql utility to login into database as shown in below pic. 
Step 7: Set password for user postgres to Secure login.
# passwd postgres 
All the config files are found at /var/lib/pgsql/12/data directory. 
That’s it. In this post we have seen the installation of PostgreSQL in RedHat & CentOS 8 Linux. Please share your experience with us through comment box below. 

Leave a Comment