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 9 (stretch), 10 (buster), 11 (bullseye), and unstable (sid)
- Ubuntu 18.04 (bionic), 20.04 (focal), 20.10 (groovy, amd64 only), 21.04 (hirsute, amd64 only)
- Architectures: amd64 (64-bit x86), i386 (32-bit x86, being phased out), arm64 (64-bit ARM), ppc64el (little-endian 64-bit POWER)
- PostgreSQL 9.6, 10, 11, 12, 13, 14 beta
- Server extensions such as Slony-I, various PL languages, and datatypes
- Applications like pgadmin4, omnidb, pgbouncer, and pgpool-II
Packages for older PostgreSQL versions and older Debian/Ubuntu distributions will continue to stay in the repository (or be moved to apt-archive.postgresql.org), but will usually not be updated anymore.
Import the repository key from https://www.postgresql.org/media/keys/ACCC4CF8.asc:
sudo apt-get install curl ca-certificates gnupg curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
Create /etc/apt/sources.list.d/pgdg.list. The distributions are called codename-pgdg. In the example, replace buster with the actual distribution you are using. File contents:
deb http://apt.postgresql.org/pub/repos/apt buster-pgdg main
(You may determine the codename of your distribution by running lsb_release -c). For a script version of the above file creation, 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'
Finally, update the package lists, and start installing packages:
sudo apt-get update sudo apt-get install postgresql-11 pgadmin4
Alternately, this shell script will automate the repository setup. The script is included in the postgresql-common package in Debian and Ubuntu, so you can also run it straight from there:
sudo apt install postgresql-common sudo sh /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
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-11" instead of "postgresql".
For packages of development/alpha/beta versions of PostgreSQL, see the FAQ entry about beta versions.
- 2021-05-20: PostgreSQL 14beta1 added, Ubuntu xenial (16.04) deprecated, Ubuntu hirsute (21.04) added
- 2021-01-28: Distributions moving to apt-archive.postgresql.org: jessie wheezy eoan disco trusty precise: https://www.postgresql.org/message-id/YBMtd6nRuXyU2zS4%40msg.df7cb.de
- 2020-11-12: Ubuntu groovy (20.10) support added
- 2020-09-24: PostgreSQL 13 released
- 2020-07-13: Debian jessie and Ubuntu eoan are unsupported now
- 2020-05-04: arm64 added as new architecture: https://www.df7cb.de/blog/2020/arm64-on-apt.postgresql.org.html
- 2020-03-24: apt-archive.postgresql.org announced: https://www.df7cb.de/blog/2020/apt-archive.postgresql.org.html
- 2020-02-15: Ubuntu focal (20.04) support added
- 2020-01-27: Ubuntu disco (19.04) is no longer supported.
- 2019-08-05: Ubuntu cosmic (18.10) removed, Debian bullseye (11) and Ubuntu eoan (19.10) added.
- 2019-07-03: PostgreSQL 13devel packages added, see Apt/FAQ#Development_snapshots
- 2019-05-22: PostgreSQL 12beta1 packages added, see Apt/FAQ#I_want_to_try_the_beta_version_of_the_next_PostgreSQL_release
- 2019-05-14: Ubuntu trusty (14.04) is no longer supported.
- 2019-03-25: Debian jessie/ppc64el disabled because ftp.debian.org removed it. Debian removed jessie-backports (all architectures), so we had to remove postgresql-pllua from jessie-pgdg because it depends on backports.
- 2019-01-26: PostgreSQL 9.3 deprecated, no new modules will be built; Ubuntu disco (19.04) is being prepared
- 2018-11-01: Ubuntu cosmic (18.10) added.
- 2018-05-31: Debian wheezy (7) is unsupported now.
- 2018-05-24: PostgreSQL 11 beta1 packages available, see Apt/FAQ#I_want_to_try_the_beta_version_of_the_next_PostgreSQL_release
- 2018-01-17: Ubuntu zesty (17.04) is unsupported now, Ubuntu removed it from their mirrors
- 2017-10-05: PostgreSQL 10.0 has been released, postgresql-10 is the default version pulled in by "postgresql.deb" now
- 2017-05-18: PostgreSQL 10beta1 packages added, see Apt/FAQ#I_want_to_try_the_beta_version_of_the_next_PostgreSQL_release
- 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)
- Michael Banck (credativ)
- 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.
The ARM build server is kindly hosted by HUAWEI Cloud Services.
The ppc64el build server is kindly hosted by IBM Power Systems Linux Center, Montpellier.
The repository is hosted on postgresql.org hardware.