Updating PostgreSQL on Plesk Obsidian

I’ve wanted to update Postgres for some time now, as Plesk Obsidian currently only installs version 10 by default. I also thought this would be a whole lot more difficult than it actually was. And with the release of Postgres v14, I figured this was as good a time as any to get stuck in.

The actual process I used was super simple, and very quick, however it took the better part of an afternoon to do. Mainly because the bulk of the time was spent researching, and finding out if it would be possible for me to achieve.

I should mention that my VPS is running Ubuntu 18.0.4

Safety first

I started off by making a full server backup… just in case. 👍 The actual process was super simple, and this is what worked for me.

  • ssh into the server
  • Update the apt repository and install the latest version
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install postgresql
  • Stop postgres and upgrade the cluster, renaming the new version to avoid collisions
sudo systemctl stop postgresql
sudo pg_renamecluster 14 main main_ver14
sudo pg_upgradecluster 10 main
  • Restart postgres
sudo systemctl start postgresql
  • Cleanup the clusters:
pg_lsclusters
sudo pg_dropcluster -stop 14 main_ver14
sudo pg_dropcluster -stop 10 main
  • Open Plesk and go to Tools & Settings > Database Servers and click on Refresh to let it know about the upgrade.
The Database Servers tab The Database Servers tab

And that is all there was too it! All the databases were migrated to the new install, and the only thing I only needed to was restart my support forum.