Enable Remote Access To PostgreSql 9.5Database Server On Redhat/CentOs 7

0
34
views

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 192.168.1.10 –u postgres

You will see postgres shell

You’re done

LEAVE A REPLY

Please enter your comment!
Please enter your name here