How to Install the PostgreSQL Client on Ubuntu 22.04 and 24.04

Whether you’re managing cloud-hosted databases or working in a containerized environment, the PostgreSQL client is an essential tool for developers, sysadmins, and database engineers alike. This article walks you through installing the PostgreSQL client on Ubuntu 22.04 (Jammy Jellyfish) and Ubuntu 24.04 (Noble Numbat)—two of the most widely used LTS releases.


What Is the PostgreSQL Client?

The PostgreSQL client includes tools like psql, which allow you to connect to PostgreSQL servers, run SQL queries, perform backups, and administer remote databases.

It’s commonly installed on application servers, staging environments, and development machines to interact with databases hosted elsewhere.


Which Version Should I Install?

Both Ubuntu 22.04 and 24.04 come with a default version of PostgreSQL in their package repositories:

Ubuntu Version Default PostgreSQL Client Version
22.04 (Jammy) 14
24.04 (Noble) 16

If you’re fine using the default version, installation is straightforward. If you need a newer or specific version, you can enable the official PostgreSQL APT repository, as shown below.


Installing the PostgreSQL Client on Ubuntu 22.04

Ubuntu 22.04 does not include a generic postgresql-client meta-package. You must install a versioned client explicitly.

Step 1: Install PostgreSQL 14 client (default):

Step 2: Verify installation:


Installing the PostgreSQL Client on Ubuntu 24.04

Ubuntu 24.04 includes a working postgresql-client meta-package that installs the default version (PostgreSQL 16).

Step 1: Install PostgreSQL client:

Step 2: Verify installation:


Installing Newer PostgreSQL Client Versions (for Both Ubuntu 22.04 and 24.04)

To install a newer or alternate version of the PostgreSQL client, you can enable the official PostgreSQL APT repository.

Step 1: Add the PostgreSQL APT repository

Step 2: Install a specific client version:

Replace 16 with any other supported version as needed (15, 13, etc.).


Common Errors

Error: You must install at least one postgresql-client- package

This occurs on Ubuntu 22.04 if you try to install the non-existent postgresql-client meta-package. Fix this by installing the appropriate versioned package:

Alternatively, enable the PostgreSQL APT repository to access newer versions.


Conclusion

Installing the PostgreSQL client on Ubuntu 22.04 or 24.04 is straightforward once you know which version to target. Stick with the system default for simplicity, or use the PostgreSQL APT repository to access newer versions.

Reliable Penguin offers PostgreSQL support for all stages of your infrastructure—development, staging, or production. Contact us to learn more about our database optimization, security, and automation services.


Tags: Ubuntu 22.04, Ubuntu 24.04, PostgreSQL, psql, DevOps, Database Tools, Reliable Penguin

Have a project or a problem?

Talk with a senior engineer for practical recommendations—no obligation.

Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Categories

Get a free consultation from Reliable Penguin

Submit the form—or for immediate service call 866-649-7984.