This guide provides step-by-step instructions on how to install the PostgreSQL 17 client on your system using the official PostgreSQL APT repository. Follow these steps to ensure a successful installation.
- A machine running Ubuntu or a Debian-based Linux distribution.
- Access to a terminal and permission to execute
sudocommands.
First, update your APT package index to make sure you have the latest list of available packages:
sudo apt updateAdd the PostgreSQL official APT repository to your system to ensure you get the latest versions of PostgreSQL packages:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'After adding the new repository, update your APT package index again to include the newly available PostgreSQL packages:
sudo apt updateNow, install the PostgreSQL 17 client package:
sudo apt install postgresql-client-17After the installation is complete, verify that the PostgreSQL client has been installed correctly by checking its version:
psql --versionYou should see the version of the PostgreSQL client displayed, confirming that the installation was successful.