How to install PostgreSQL 13 on Redhat

In this article, we will see how to install PostgreSQL 13 on Redhat.

PostgreSQL is a powerful, open source object-relational database system with over 30 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance.

1. Install the repository

dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm

How to install PostgreSQL 13 on Redhat

2. Disable the built-in PostgreSQL module:

dnf -qy module disable postgresql

3. Install PostgreSQL 13 version using below command.

dnf install -y postgresql13-server

4. Now initialize database b running below command.

/usr/pgsql-13/bin/postgresql-13-setup initdb

5. Enable the PostgreSQL service.

systemctl enable postgresql-13

6. Start the PostgreSQL Server on Redhat or CentOS

systemctl start postgresql-13

7. Check the status PostgreSQL on Regdhat or CentOS

systemctl status postgresql-13

Connect to PostgreSQL Server on Redhat/CentOS after installation:

1. Switch to postgres user.

sudo su - postgres

2. Then connect to the PostgreSQL server using psql tool.

psql

3. Now change the password for user “postgres”

alter user postgres with password 'admin@123';

So, in this article, we have explained How to install PostgreSQL 13 on Redhat step by step.