From Debian Packages (9.4)
sudo apt-get install postgresql-9.4 -y
psql -V will show you version 9.4.9.
PostgreSQL Apt Repository (9.6)
Use this method if you need the latest release (9.6) which brings with it features like support for parallel queries.
echo 'deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main' | sudo tee /etc/apt/sources.list.d/pgdg.list 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 -y
You now have a working PostgreSQL database. You may now wish to configure PostgreSQL to set a password and allow remote connections, or you can dive right in and refer to the cheatsheet for help.