Skip to main content

Install PostgreSQL Client 17 on Ubuntu 24.04

When you try to install Postgresql on ubuntu running on aws ec2, you will not get the latest packages.

We need to update apt to use postgresql repository for latest postgres v17.

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
. /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"
sudo apt update
sudo apt -y install postgresql

psql --version
# psql (PostgreSQL) 17.5 (Ubuntu 17.5-1.pgdg24.04+1)