September 26, 2024: PostgreSQL 17 Released!

Linux downloads (Ubuntu)

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

Included in Distribution

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

apt install postgresql

PostgreSQL Apt Repository

If the version included in your version of Ubuntu 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 Ubuntu:

  • noble (24.04, LTS)
  • mantic (23.10, non-LTS)
  • jammy (22.04, LTS)
  • focal (20.04, LTS)

on the following architectures:

  • amd64
  • arm64 (LTS releases only)
  • ppc64el (LTS releases only)
  • s390x (LTS releases only)

Automated repository configuration:

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

To manually configure the Apt repository, follow these steps:

# Import the repository signing 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 the repository configuration file:
sudo sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

# Update the package lists:
sudo apt update

# Install the latest version of PostgreSQL:
# If you want a specific version, use 'postgresql-16' or similar instead of 'postgresql'
sudo apt -y install postgresql

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-16 client libraries and client binaries
postgresql-16 core database server
postgresql-doc-16 documentation
libpq-dev libraries and headers for C language frontend development
postgresql-server-dev-16 libraries and headers for C language backend development