How to install PostgreSQL 9.6 on Ubuntu/Debian/Linux Mint

Create a file at /etc/apt/sources.list.d/postgresql.list with the following command:

sudo vim /etc/apt/sources.list.d/postgresql.list

Add the following line according to your distribution (xenial, utopic, trusty, jessie, wheezy and etc):

deb xenial-pgdg main

Save it and Close it! Now you just have to do:

wget --quiet -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.6

Enjoy it! 😀