Install Postgresql 13 on RHEL 8. Configure scram-sha-256 password authentication.

# dnf module list | grep postgres
# dnf module install postgresql:13

2. Initialize database

# which postgresql-setup
# postgresql-setup --initdb

3. Change password for os user postgres auto created after installing postgresql

# passwd postgres

4. Enable and start postgresql service

# systemctl enable postgresql
# systemctl start postgresql
# systemctl status postgresql

5. Modify postgresql.conf file

#vim /var/lib/pgsql/data/postgresql.conflisten_addresses = '*'
password_encryption = scram-sha-256

6. login to postgres database using peer authentication.

# su - postgres
# psql
postgres=# \conninfo

7. Change postgres database user password and password encryption method

postgres=# \password
postgres=# set password_encryption TO 'scram-sha-256';

8. Change authentication type to scram-sha-256 in pg_hba.conf file

# cd /var/lib/pgsql/data
# vim pg_hba.conf
# TYPE DATABASE USER ADDRESS METHOD# "local" is for Unix domain socket connections only
local all all scram-sha-256
# IPv4 local connections:
host all all 127.0.0.1/32 scram-sha-256
# IPv6 local connections:
host all all ::1/128 scram-sha-256
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all scram-sha-256
host replication all 127.0.0.1/32 scram-sha-256
host replication all ::1/128 scram-sha-256

9. Restart postgresql service and login using password authentication

# systemctl restart postgresql
$ psql -U postgres -d postgres

--

--

--

System Administrator and Full stack web developer.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Mobile App Piracy: Who’s Profiting Off of Your Ideas?

4 Must-Have Free WordPress Plugins for Your Website

Thinking Securely, in AWS.

Chinese Hackers Attack Indian Cyberspace 40,300 Times a Week In The Aftermath Of Galwan

June 9: No, there’s no evidence a hack called RockYou2021 exposed 8.4 billion passwords

{UPDATE} 企鹅对对碰-消除类桌面游戏 Hack Free Resources Generator

{UPDATE} Shape Havoc! Hack Free Resources Generator

{UPDATE} Black Tap Piano Hack Free Resources Generator

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Himanshu Pratap

Himanshu Pratap

System Administrator and Full stack web developer.

More from Medium

Installing and Configuring InnoDB Cluster

MySQL/CSV — Import and Export data faster, using commands

How To Deploy Nuxt Js App On Docker Swarm Cluster

Graylog Dashboard for Nginx Logs