To enable remote access to a postgresql database from a computer or server, in Ubuntu server, first we need to know the ip of the computer in question, for example 188.8.131.52.
Then, from the terminal, enter the directory where postgresql is installed:
open edit pg_hba.conf:
sudo nano pg_hba.conf
and add the following line:
host all all 184.108.40.206 trust
Finally, edit the postgresql.conf file in the same directory as follows:
listen_addresses = '*'
Once saved, you must restart postgresql:
sudo service postgresql restart