1. Install PostgreSql
$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
$ sudo echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main 9.4" >> pgdg.list
$ sudo cp pgdg.list /etc/apt/sources.list.d/pgdg.list
$ sudo apt-get update
$ sudo apt-get -y install postgresql-9.4 postgresql-client-9.4
2. Set password for Postgresql
$ sudo -u postgres psql postgres
postgres=# \password postgres
Enter new password:
Enter it again:
postgres=# \q
3. Allow aceess remote
$ sudo vi /etc/postgresql/9.4/main/pg_hba.conf
...
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all 192.168.1.0/24 md5 # Add
...
$ sudo vi /etc/postgresql/9.4/main/postgresql.conf
listen_addresses = '*' # replace "*" with "localhost"
port = 5432
$ sudo service postgresql restart
4. Open Port on firewall
$ sudo ufw allow 5432
5. Test
Reference
http://www.unixmen.com/install-postgresql-9-4-phppgadmin-ubuntu-14-10/
http://askubuntu.com/questions/233064/why-am-i-getting-command-deb-not-found