sudo apt-get install postgresql postgresql-contrib postgresql-client
sudo apt-get install postgresql-server-dev-9.4 (for server)
sudo apt-get install libpq-dev (for client)
sudo apt-get install pgadmin3
sudo -u postgres psql
sudo -i -u postgres
psql postgres [or]
psql -U postgres -localhost
CREATE DATABASE testdb ENCODING 'UTF-8';
\password postgres
postgres=# CREATE EXTENSION adminpack;
postgres=# create (alter) user testdba with encrypted password 'PASSWORD';
postgres=# grant all privileges on database testdb to testdba;
\q

sudo nano /etc/postgresql/9.3/main/postgresql.conf

listen_addresses = '*'
port = 5432 


sudo nano /etc/postgresql/9.3/main/pg_hba.conf

host   all   all   130.193.203.0/24   md5    # replace with your IP

Change this:
local   all   postgres   peer

to this:

local   all   postgres   md5

 

sudo service postgresql restart