I can’t connect, get an error that the port 5432 has been rejected, I execute the following command on the server
And apparently port 5432 is Listening… but it’s only listening to the Localhost (127.0.0.1), now we have to configure postgresql to accept foreign connections and to do this we need to modify to files:
postgresql.conf --- listen_addresses = ‘*’
pg_hba.conf --- put the IP your client is accessing... I put 0.0.0.0/0 (which allow all connections and is very unsafe, but I'm using it for testing purposes).
Host: Server IP (remember to do Port Forwarding on the Router if your accessing over the internet)
Maintenance DB: postgres
Password: ****** (this is defined in the /etc/openerp-server.conf on the field db_password )
Configure PostgreSQL to be accessible from remote hosts
The PostgreSQL database server configuration file is
postgresql.conf. This file is located in the data directory of the server, typically
/var/lib/postgres/data. This folder also houses the other main config files, including the
locateis not finding the conf files, this is the reason.
As root user edit the file
/var/lib/postgres/data/postgresql.conf. In the connections and authentications section uncomment or edit the
listen_addresses line to your needs:
listen_addresses = '*'
Take a careful look at the other lines. Hereafter insert the following line in the host-based authentication file
/var/lib/postgres/data/pg_hba.conf. This file controls which hosts are allowed to connect, so be careful.
# IPv4 local connections: host all all your_desired_ip_address/32 trust
your_desired_ip_address is the IP address of the client. After this you should restart the daemon process for the changes to take effect with: