How do I upgrade the Ubuntu server version?
Upgrading Ubuntu server is a common practice every 2 years when a new Long-Term Support (LTS) version is released.
Updated
If there's a new Ubuntu LTS version that you'd like to upgrade to on your server, you can follow the Ubuntu upgrade steps.
Login as root and run:
# Update everything first
apt update
apt dist-upgrade -o APT::Get::Always-Include-Phased-Updates=true
# Upgrade to the next LTS version
do-release-upgrade
This will upgrade core packages like the Linux kernel, glibc, etc. After upgrading, we recommend deploying new copies of your application to ensure that build steps still work.
After rebooting, your server will be running the latest Ubuntu LTS.
Additional changes might be needed with other software to ensure compatibility with the new version.
PostgreSQL Collation
Your PostgreSQL server may warn about collation version mismatches after an upgrade.
To fix this, SSH into your server as root and run the following:
su postgres
psql
\c template1
ALTER DATABASE template1 REFRESH COLLATION VERSION;
REINDEX DATABASE template1;