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) and unstable (sid) 64/32 bit (amd64/i386)
- Ubuntu 12.04 (precise), 14.04 (trusty), 15.10 (wily), 16.04 (xenial) 64/32 bit (amd64/i386)
- PostgreSQL 9.1, 9.2, 9.3, 9.4, 9.5
- 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.
- 2016-03-31: Ubuntu xenial (16.04) added.
- 2016-03-05: Debian squeeze (6) deprecated.
- 2015-05-30: May_2015_Fsync_Permissions_Bug fixed in 9.0/9.1: http://www.postgresql.org/message-id/20150530092702.GA16443@msg.df7cb.de
- 2015-05-08: Ubuntu lucid (10.04) deprecated. The packages will continue to be available, but no longer receive updates.
- 2014-12-18: PostgreSQL 9.4 released
- 2014-12-02: Debian jessie (8) added
- 2014-08-28: Ubuntu utopic (14.10) added, saucy (13.10) deprecated
- 2014-05-16: 9.4 beta packages available: http://www.df7cb.de/blog/2014/PostgreSQL_9.4_on_Debian.html
- 2014-02-18: Ubuntu saucy (13.10) added (seeded with a copy of the packages from precise)
- 2014-01-09: Ubuntu trusty (14.04) packages available: http://www.postgresql.org/message-id/20140109124716.GA5659@msgid.credativ.de
- 2013-11-22: Users concerned about the Nov2013ReplicationIssue can find 9.2.4/9.1.9/9.0.13 packages at
- 2013-10-10: New pgdg-keyring version extending the key expiration date. The old expiration date is 2013-10-13. Announcement: http://www.postgresql.org/message-id/20131010083115.GC24812@msgid.df7cb.de Additional blog post: http://blog.endpoint.com/2013/10/postgresql-debian-apt-repository-gnupg.html
- 2013-09-09: postgresql-9.3 released! (This also includes new postgresql-9.2 and postgresql-common packages.)
- 2013-05-12: postgresql-9.3 beta1 is now available, see FAQ entry for instructions
- 2013-05-11: Temporary problems with libpq5 packages: http://www.postgresql.org/message-id/20130511050816.GB8469@msgid.df7cb.de
- 2013-04-10: New postgresql-common version 141 introducing a dependency on the pgdg-keyring package. (If you were following the (old) installation instructions, you already have that package installed.)
- 2013-02-23: pgapt.debian.net is gone now. If you were using that, change to apt.postgresql.org using the instructions above.
- 2013-02-22: Default repository pin priority changed; see Apt pinning for details.
- 2012-12-18: Ubuntu Lucid (10.04) is now part of the repository; PostgreSQL and pgadmin3 packages are built.
- 2012-12-06: Official announcement: http://archives.postgresql.org/pgsql-announce/2012-12/msg00008.php, http://www.postgresql.org/about/news/1432/
- 2012-12-06: Minor releases 9.2.2, 9.1.7, 9.0.11, 8.4.15, 8.3.22 built.
- 2012-11-30: pgadmin3 added to the repository
- 2012-11-22: Ubuntu Precise (12.04) added to the repository, and built 9.2.1, 9.1.6, 9.0.10, 8.4.14, 8.3.21 for it.
- 2012-10-13: Repository key renewed with new expiry date.
- 2012-10-02: Minor releases 9.2.1, 9.1.6, 9.0.10, 8.4.14, 8.3.21 built
- 2012-09-15: 9.2.0 is in the repository
- 2012-08-22: PostgreSQL in Debian Hackathon: Blog posting and notes. The distribution names changed from *-pgapt to *-pgdg, please update your sources.list.
- 2012-06-07: 9.2 added, Lenny marked unsupported now
- 2012-06-07: separate components "9.0", "9.2" etc added for libpq5/libpg-dev/lib... packages that would otherwise overwrite packages from other versions in the same suite. (Usually, using the latest stable libpq5 version will be ok for users. The packages built from other PostgreSQL versions are provided only for completeness.)
- Dists directory
- Packages pool directory
- ExtensionPackaging (PostgreSQL Wiki)
- pkg-postgresql (Debian Wiki)
- Mailing list: firstname.lastname@example.org (Archives)
- IRC channel: #postgresql-apt @ irc.freenode.net
- People: Christoph Berg <email@example.com>, Dimitri Fontaine <firstname.lastname@example.org>, Magnus Hagander <email@example.com>
Please report bugs on the firstname.lastname@example.org mailing list, 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 build server is kindly hosted by DG-i. The archive is hosted on postgresql.org hardware.