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

NOTE: Here is an updated version to install PostgreSQL 9.6 on Ubuntu Xenial

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

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

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

deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main 9.5

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 -
apt-get update
apt-get install postgresql-9.5

Enjoy it! 😀

 

Raony Guimaraes