How to Configure PostgreSQL to Listen from Any IP Address on CentOS 6.2

PostgreSQL is a Sophisticated open-source Object-Relational DBMS supporting almost all SQL constructs, including subselects, transactions, and user-defined types. PostgreSQL is a powerful, open source object-relational database system that available for many platforms including Linux, FreeBSD, Solaris, Microsoft Windows and Mac OS X. In this post, i will show the quick steps on how to enable PostgreSQL to listen to all ip address on linux CentOS 6.2 server.

1. Open the PostgreSQL configuration file :

[root@centos62 ~]# vi /var/lib/pgsql/data/postgresql.conf

2. Go to line 59 and uncomment the line. Enable listen from any ip address as below. “*” is for all ip addresses :

#------------------------------------------------------------------------------ # CONNECTIONS AND AUTHENTICATION #------------------------------------------------------------------------------ # - Connection Settings - listen_addresses = '*' # what IP address(es) to listen on; # comma-separated list of addresses; # defaults to 'localhost', '*' = all

3. Restart the PostgreSQL database server :

[root@centos62 ~]# /etc/rc.d/init.d/postgresql restart
Stopping postgresql service:                               [  OK  ]
Starting postgresql service:                               [  OK  ]