Linux downloads (Debian)

PostgreSQL is available in all Debian versions by default. However, Debian "snapshots" a specific version of PostgreSQL that is then supported throughout the lifetime of that Debian version. The PostgreSQL project maintains an Apt repository with all supported of PostgreSQL available.

Included in Distribution

Debian includes PostgreSQL by default. To install PostgreSQL on Debian, use the apt (or other apt-driving) command:

apt install postgresql

PostgreSQL Apt Repository

If the version included in your version of Debian is not the one you want, you can use the PostgreSQL Apt Repository. This repository will integrate with your normal systems and patch management, and provide automatic updates for all supported versions of PostgreSQL throughout the support lifetime of PostgreSQL.

The PostgreSQL Apt repository supports the current versions of Debian:

  • trixie (13.x)
  • bookworm (12.x)
  • bullseye (11.x)
  • forky (testing)
  • sid (unstable)

on the following architectures:

  • amd64
  • arm64
  • ppc64el

Automated Repository Configuration

sudo apt install -y postgresql-common
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh

Manual Repository Configuration

Import the repository key:

sudo apt install curl ca-certificates
sudo install -d /usr/share/postgresql-common/pgdg
sudo curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc

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

Types: deb deb-src
URIs: https://apt.postgresql.org/pub/repos/apt
Suites: trixie-pgdg
Architectures: amd64
Components: main
Signed-By: /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc
Install PostgreSQL: (replace "18" by the version you want)
sudo apt update
sudo apt install postgresql-18

For more information about the apt repository, including answers to frequent questions, please see the PostgreSQL Apt Repository wiki page.

Packages

The repository contains many different packages including third party addons. The most common and important packages are (substitute the version number as required):

postgresql-client-18 client libraries and client binaries
postgresql-18 core database server
postgresql-doc-18 documentation
libpq-dev libraries and headers for C language frontend development
postgresql-server-dev-18 libraries and headers for C language backend development