{%extends "base/page.html"%}
{%block title%}Linux downloads (Ubuntu){%endblock%}
{%block extrahead%}
<script type="text/javascript" src="/media/js/download.js?{{gitrev}}"></script>
{%endblock%}
{%block contents%}

<h1>Linux downloads (Ubuntu) <img class="logo" src="/media/img/ubuntu.svg" alt="Ubuntu Logo" /></h1>
<p>
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 <a href="#apt">Apt repository</a> with all supported
of PostgreSQL available.
</p>

<h2>Included in Distribution</h2>
<p>
Ubuntu includes PostgreSQL by default. To install PostgreSQL on Ubuntu,
use the <code>apt</code> (or other apt-driving) command:
</p>
<pre class="code">
apt install postgresql
</pre>

<a name="apt"></a>
<h2>PostgreSQL Apt Repository</h2>
<p>
If the version included in your version of Ubuntu is not the one you want,
you can use the <a href="https://apt.postgresql.org" target="_blank" rel="noopener">PostgreSQL Apt Repository</a>. This repository will integrate
with your normal systems and patch management, and provide automatic
updates for all supported versions of PostgreSQL throughout the support
<a href="/support/versioning/">lifetime</a> of PostgreSQL.
</p>
<p>
The PostgreSQL Apt repository supports the current versions of Ubuntu:
</p>
<ul>
  <li>plucky (25.04, non-LTS)</li>
  <li>oracular (24.10, non-LTS)</li>
  <li>noble (24.04, LTS)</li>
  <li>jammy (22.04, LTS)</li>
  <li>focal (20.04, LTS)</li>
</ul>
<p>
on the following architectures:
</p>
<ul>
  <li>amd64</li>
  <li>arm64 (LTS releases only)</li>
  <li>ppc64el (LTS releases only)</li>
</ul>

<p>
Automated repository configuration:
</p>

<div class="pg-script-container">
    <pre id="script-box" class="code">sudo apt install -y postgresql-common
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh</pre>
    <button id="copy-btn" class="pg-script-copy-btn">Copy Script</button>
</div>

<p>
To manually configure the Apt repository, follow these steps:
</p>

<div class="pg-script-container">
    <pre id="script-box2" class="code"># 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:
. /etc/os-release
sudo sh -c "echo 'deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $VERSION_CODENAME-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-17' or similar instead of 'postgresql'
sudo apt -y install postgresql</pre>
    <button id="copy-btn2" class="pg-script-copy-btn">Copy Script</button>
</div>

<p>
For more information about the apt repository, including answers to frequent
questions, please see the
<a href="https://wiki.postgresql.org/wiki/Apt" target="_blank" rel="noopener">PostgreSQL Apt Repository wiki page</a>.
</p>

<h2>Packages</h2>
<p>
The repository contains many different packages including third party
addons. The most common and important packages are (substitute the
version number as required):
</p>
<table class="table table-striped">
  <tbody>
    <tr>
     <th scope="row">postgresql-client-17</th>
     <td>client libraries and client binaries</td>
    </tr>
    <tr>
     <th scope="row">postgresql-17</th>
     <td>core database server</td>
    </tr>
    <tr>
     <th scope="row">postgresql-doc-17</th>
     <td>documentation</td>
    </tr>
    <tr>
     <th scope="row">libpq-dev</th>
     <td>libraries and headers for C language frontend development</td>
    </tr>
    <tr>
     <th scope="row">postgresql-server-dev-17</th>
     <td>libraries and headers for C language backend development</td>
    </tr>
  </tbody>
</table>
{%endblock%}
