How to Install PostgreSQL 14 on Redhat Linux step by step

In this article, we will show you how to Install PostgreSQL 14 on Redhat Linux(8) step by step.

1. Go to the PostgreSQL official website download link.

Or directly run go to step 6.

2. Then, click on Linux as highlighted below.

How to Install PostgreSQL 14 on Redhat Linux step by step

3. Then, select Linux distribution.Here, select Red Hat/Rocky/CentOS.

Next steps are common for following Linux distributions:

Red Hat Enterprise Linux
Rocky Linux
CentOS
Scientific Linux
Oracle Linux
Fedora

4. Scroll down and and select PostgreSQL version and platform.

5. Now, click on copy script and paste it in a text editor and run one by one or follow the following steps directly.

6. Install PostgreSQL RPM:

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

7. Disable the built-in PostgreSQL module:

sudo dnf -qy module disable postgresql

8. Install PostgreSQL 14 by running below command.

sudo dnf install -y postgresql14-server

Post Installation steps of PostgreSQL 14 server

1. Initialize the database
2. Enable automatic start
3. Start the PostgreSQL Server.
4. Check PostgreSQL server status.
5. Connect to PostgreSQL server.
6. Lets verify the PostgreSQL server version.
7. Change the password for PostgreSQL postgres password.

1. Initialize the database.

sudo /usr/pgsql-14/bin/postgresql-14-setup initdb

2. Enable automatic start.

sudo systemctl enable postgresql-14

3. Start the PostgreSQL Server.

sudo systemctl start postgresql-14

4. Check PostgreSQL server status.

sudo systemctl status postgresql-14

5. Connect to PostgreSQL server.

sudo su - postgres

psql

6. Lets verify the PostgreSQL server version.

select version();

7. Change the password for PostgreSQL postgres password.

alter user postgres with password 'admin@123';

Thats it. We have successfully installed PostgreSQL 14 on Redhat Linux.