Install PostgreSQL 15 on Debian/Ubuntu servers

Published on Jun. 22, 2023 by Gabriel Bordeaux

Introduction

Install PostgreSQL 10

Install PostgreSQL 15 step by step

Add the PostgreSQL repository to your sources

echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list

Import the repository signing key

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
apt-key add -

Install PostgreSQL 15

apt-get update
apt-get -y install postgresql-15

Connection to PostgreSQL

su postgres
postgres@debian:/root$ psql
postgres=# SELECT version();
                                                           version                                                           
-----------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 15.3 (Ubuntu 15.3-1.pgdg22.10+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 12.2.0-3ubuntu1) 12.2.0, 64-bit
(1 row)