Last Updated: February 25, 2016
· dedenf

Postgresql via virtual machine

it's been a while since the last time i played with Postgresql, i've recently installed Postgresql on my vmware ubuntu instance.

if you want to connect to your postgresql server via Host, you have to change network configuration from NAT to Bridged, that way your instance could handle connection as its were a standalone machine on the local network.
after that, you have to set postgresql.conf, change "listen_addresses" option (mine was '*').

$ nmap

Nmap scan report for
Host is up (0.0012s latency).
Not shown: 997 closed ports
21/tcp   open  ftp
22/tcp   open  ssh
5432/tcp open  postgresql

and then you have to change <b>pg_hba.conf</b>, add the IP address that you want add as a 'client' that will connect to this server, for example:

host    all     all     trust

and you're done. now you can connect using whatever available pg client.

$ psql -U postgres -h -d postgres
psql (9.0.5, server 9.1.3)
WARNING: psql version 9.0, server version 9.1.
     Some psql features might not work.
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.


if you got this error

psql: FATAL:  Peer authentication failed for user "postgres"

edit pg_hba.conf change this line :

local   all             all             Peer


local   all             all             trust

1 Response
Add your response

Hi, please guide me to do how to install postgres on VM environment. i am using Virtual box with version 4.3.20. and i have one image file i have imported it. now i want to install the postgres and export the new images. please guide me

over 1 year ago ·