Enable PostgreSQL connection from remote machine

Let’s continue in previous article and enable PostgreSQL connection from different machine in network. This allows Zabbix web interface to connect from another machine.

To allow connection from another machine in network to PostgreSQL modify configuration file

sudo vi /etc/postgresql/9.1/main/pg_hba.conf

add line to give access to database (zabbix) for user (zabbix) from network (192.168.1.0/24)

host    zabbix          zabbix          192.168.1.0/24         trust

open PostgreSQL configuration file

sudo vi /etc/postgresql/9.1/main/postgresql.conf

To set IP address(es) to listen on, find line

listen_addresses='localhost'

and replace with comma separated list of addresses, or * for all IPs

listen_addresses = ‘*’

Restart PostgreSQL server

/etc/init.d/postgresql restart

Test your setup from machine where zabbix fronted will be run

psql -h 192.168.1.1 -U zabbix -d zabbix

To setup Zabbix web interface just return to previous article and follow the steps there…