[root@testdbsvr01~]# dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
[root@testdbsvr01~]# dnf -qy module disable postgresql

 

[root@testdbsvr01~]# dnf install -y postgresql12-server

[root@testdbsvr01~]# dnf install -y postgresql12-contrib

[root@testdbsvr01~]# /usr/pgsql-12/bin/postgresql-12-setup initdb
Initializing database ... OK

[root@testdbsvr01~]# systemctl enable postgresql-12
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql-12.service → /usr/lib/systemd/system/postgresql-12.service.
[root@testdbsvr01~]#

[root@testdbsvr01 12]# systemctl start postgresql-12

Reset Postgres Password 
[root@testdbsvr01 12]# su postgres

bash-4.4$ psql
psql (12.13)
Type "help" for help.

postgres=# \password
Enter new password for user "postgres": <New Password>
Enter it again: <New Password>
postgres=# \q
bash-4.4$ exit

Firewall Configuration

[root@testdbsvr01 12]# systemctl enable firewalld
Created symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service → /usr/lib/systemd/system/firewalld.service.
Created symlink /etc/systemd/system/multi-user.target.wants/firewalld.service → /usr/lib/systemd/system/firewalld.service.
[root@ehappdb04 12]# systemctl start firewalld
[root@testdbsvr01 12]# firewall-cmd --add-port=5432/tcp
success
[root@testdbsvr01 12]# firewall-cmd --add-port=5432/tcp --permanent
success

Technology