Create /etc/apt/sources.list.d/pgdg.list. The distributions are called codename-pgdg. In the example, replace stretch with the actual distribution you are using:

deb stretch-pgdg main

i.e.deb bionic-pgdg main

(You may determine the codename of your distribution by running lsb_release -c). For a shorthand version of the above, presuming you are using a supported release:

sudo sh -c 'echo "deb codename-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

i.e.sudo sh -c 'echo "deb bionic-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

Import the repository key from, update the package lists, and start installing packages:

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-10 pgadmin4   # on wheezy/jessie/trusty: pgadmin3

Alternately, this shell script will automate the repository setup. Note that the shell script leaves the source package repo (deb-src) commented out; if you need source packages, you will need to modify /etc/apt/sources.list.d/pgdg.list to enable it.