Setting up PostgreSQL 9.3 on CentOS 7

So I had some problems with setting up PostgreSQL on CentOS and getting a remote user working properly. Once you have it installed (install instructions on the site – also note that the service postgresql-9.3 initdb command doesn’t work on CentOS 7 just call it manually, see the PostgreSQL wiki page).

I’ll assume you have a clean PostgreSQL database and you’ve just installed it using YUM.

– Create a new user, and give it a password.

createuser -P openfire

– Edit the pg_hba.conf file and change the listen address to:

listen_addresses = '*'

– And edit the postgresql.conf file and add the following line:

host openfire openfire 0.0.0.0/0 password

For me it will be over local VMware network so password in plaintext (as the password option above implies) will be fine.

– Reboot PostgreSQL:

systemctl restart postgresql-9.3

– Finally try logging in (remember that if you don’t specify the hostname by default the Peer connection method will be used – and you may get an error)

psql -h 172.16.145.135 -U openfire -W

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.