sudo aptitude install postgresql postgresql-server-dev-9.5 postgresql-contrib

Community Maintained Repository

This is the recommended way of installing Postgres

sudo sh -c 'echo "deb $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt-get install wget ca-certificates
wget --quiet -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install postgresql-9.4

Make Postgres listen available to other servers: sudo vi /etc/postgresql/9.5/main/postgresql.conf

listen_addresses = '*'

sudo service postgresql restart

Enable access through specific IPs network:

sudo vi /etc/postgresql/9.5/main/pg_hba.conf

host all all md5
  • trust: without password
  • md5: with password
  • peer: same user logged in on the server


  • postgresql-client: recommended sudo apt-get install postgresql-client
  • pgcli provides autocompletion and highlight.
  • pgAdmin is a good GUI client, but I prefer postgresql-client to be used.