We have installed postgresql 9.5 Server on our machine. The procedure is same for all version of postgresql server.

Check Out Installation Of Postgresql Database Server On Redhat Centos 7

By default, Postgresl server allows access to client locally using socket.

Step 1: if you successfully configured postgresql server then you will see all the files inside data directory as shown in figure

Ls /var/lib/pgsql/data/

Step 2: Now you have to configure postgresql.conf file

By default settings shown in below figure

Changed Listen address to ‘*’

It will allow server to listen request to all address.

Step 3:  Now visit to this file location to allow host to access database

vim /var/lib/pgsql/data/pg_hba.conf

This will allow any host to access the postgresql database with encrypted password.

Step 4: Configure firewall which will allow postgresql to listen on Port number 5432

firewall-cmd –permanent –add-port=5432/tcp

firewall-cmd –reload

Step 5: Restart the postgresql service

Systemctl  restart   postgresql

Step 6 : Test the remote connection to Postgresql

Psql –h –u postgres

You will see postgres shell

You’re done




Please enter your comment!
Please enter your name here