The solution is:
Edit this files :
1 sudo vim /etc/postgresql/9.1/main/postgresql.conf
Line 59:
1 listen_addresses = '*' # what IP address(es) to listen on;
1 sudo vim /etc/postgresql/9.1/main/pg_hba.conf
In this example, I will access remote postgresql from IP 162.36.222.98.
1 2 3 4 5 6 7 8 9 10 11 12 # DO NOT DISABLE! # If you change this first entry you will need to make sure that the # database superuser can access the database using some other method. # Noninteractive access to all databases is required during automatic # maintenance (custom daily cronjobs, replication, and similar tasks). # # Database administrative login by Unix domain socket #local all postgres peer local all postgres trust .... host all all 162.36.222.0/24 md5 ....
Restart postgresql services by :
1 sudo service postgresql restart