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 192.168.1.79
Nmap scan report for 192.168.1.79
Host is up (0.0012s latency).
Not shown: 997 closed ports
PORT STATE SERVICE
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 192.168.1.67/24 trust
and you're done. now you can connect using whatever available pg client.
$ psql -U postgres -h 192.168.1.79 -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.
postgres=#
PS:
if you got this error
psql: FATAL: Peer authentication failed for user "postgres"
edit pg_hba.conf change this line :
local all all Peer
to
local all all trust
Written by Deden Fathurahman
Related protips
1 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