Major Version Upgrade on Debian
- make a snapshot/backup of the machine
- check the running clusters using
pg_lsclusterscommand - drop the new cluster (the one running the target version)
sudo -u postgres pg_dropcluster --stop 15 main - (optional) if you are ssh-ing from a macOS/Item2 the LC_CTYPE is wrongly set
- run
export LC_CTYPE=en_US.UTF-8 export LC_ALL=en_US.UTF-8
- run
- upgrade the old cluster
sudo -u postgres pg_upgradecluster 13 main - check the running clusters using
pg_lsclusterscommand - drop the old cluster (be sure the upgrade was successful)
sudo -u postgres pg_dropcluster 13 main - uninstall old postgresql packages