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 http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main

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

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.6

Enjoy it! 😀