Tag Archives: PostgreSQL

ubuntu 24 install postgresql 17

apt install postgresql-common
/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh

apt update && apt upgrade
apt install postgresql-17

pg_ctlcluster 17 main start
pg_ctlcluster 17 main status
pg_ctl: server is running (PID: 1028)
/usr/lib/postgresql/17/bin/postgres "-D" "/var/lib/postgresql/17/main" "-c" "config_file=/etc/postgresql/17/main/postgresql.conf"

vim /etc/postgresql/17/main/pg_hba.conf
host all all 0.0.0.0/0 md5
host all all ::/0 md5

vim /etc/postgresql/17/main/postgresql.conf
listen_addresses = '*'

pg_ctlcluster 17 main restart

upgrade postgres 15 -> 16

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg

apt update
apt install postgresql-16

pg_dropcluster --stop 16 main
pg_upgradecluster --method=upgrade --link 15 main

pg_lsclusters

15 main 5433 down postgres /var/lib/postgresql/15/main /var/log/postgresql/postgresql-15-main.log
16 main 5432 online postgres /var/lib/postgresql/16/main /var/log/postgresql/postgresql-16-main.log