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

  1. Install postgresql 13
# 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.conf

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

9. Restart postgresql service and login using password authentication

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

--

--

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