From PostgreSQL wiki
PostgreSQL packages for Debian and Ubuntu
The PostgreSQL Global Development Group (PGDG) maintains an APT repository of PostgreSQL packages for Debian and Ubuntu located at http://apt.postgresql.org/pub/repos/apt/. We aim at building PostgreSQL server packages as well as extensions and modules packages on several Debian/Ubuntu releases for all PostgreSQL versions supported.
Currently, we support
- Debian 7 (wheezy), 8 (jessie), 9 (stretch), and unstable (sid)
- Ubuntu 14.04 (trusty), 16.04 (xenial), 17.04 (zesty)
- Architectures: amd64 (64-bit x86), i386 (32-bit x86), ppc64el (little-endian 64-bit POWER; not on wheezy/precise)
- PostgreSQL 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 10devel
- Server extensions such as Slony-I, various PL languages, and datatypes
- Applications like pgadmin3, pgbouncer, and pgpool-II
Packages for older PostgreSQL versions and older Debian/Ubuntu distributions will continue to stay in the repository; updates for those will be provided on an ad-hoc basis.
Create /etc/apt/sources.list.d/pgdg.list. The distributions are called codename-pgdg. In the example, replace wheezy with the actual distribution you are using:
deb http://apt.postgresql.org/pub/repos/apt/ wheezy-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 http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
Import the repository key from https://www.postgresql.org/media/keys/ACCC4CF8.asc, update the package lists, and start installing packages:
sudo apt-get install wget ca-certificates wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - sudo apt-get update sudo apt-get upgrade sudo apt-get install postgresql-9.5 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.
Have a look at the FAQ.
Note: This repository provides "postgresql", "postgresql-contrib", and "postgresql-client" meta-packages that depend on the latest postgresql-x.y, ... packages, similar to the ones present in Debian and Ubuntu. Once a new PostgreSQL version is released, these meta-packages will be updated to depend on the new version. If you rather want to stay with a particular PostgreSQL version, you should install specific packages like "postgresql-9.5" instead of "postgresql".
For packages of development/alpha/beta versions of PostgreSQL, see the FAQ entry about beta versions.
- 2017-04-25: Ubuntu zesty (17.04) and Debian stretch (9) added, Ubuntu precise (12.04) deprecated: https://www.postgresql.org/message-id/20170425113312.d7odg7juvnunhtex%40msg.credativ.de
- 2017-02-23: postgresql-10 development snapshots available for sid, jessie, xenial, and trusty (via -pgdg-testing): Apt/FAQ#Development_snapshots
- 2016-09-29: ppc64el added as new architecture, along with full 9.6 support for all packages: https://www.postgresql.org/message-id/c86548a4-eea0-ff5d-9a14-1c136ef39ab6%402ndquadrant.it
- 2016-09-17: Ubuntu wily (15.10) deprecated.
- 2016-09-05: Redmine project for issue tracking: https://redmine.postgresql.org/projects/pgapt/issues
- 2016-07-31: Older versions of packages available: https://www.postgresql.org/message-id/20160731194944.amiwidhsoqh4osac%40msg.df7cb.de
- 2016-03-31: Ubuntu xenial (16.04) added.
- 2016-03-05: Debian squeeze (6) deprecated.
Older news items: Apt/OldNews
- Mailing list: firstname.lastname@example.org (Archives)
- IRC channel: #postgresql-apt @ irc.freenode.net
- Christoph Berg (credativ)
- Marco Nenciarini (2ndQuadrant)
- Dimitri Fontaine
- Magnus Hagander
Please report bugs:
- on the email@example.com mailing list, or
- open an issue in Redmine, or
- open a bug in the Debian BTS.
Work on setting up the archive was kindly supported by credativ, 2ndQuadrant, Redpill Linpro, and funding from the European Union's Seventh Framework Programme (FP7/2007-2013) under grant agreement 258862.