How to update (and upgrade) your Ubuntu 22.04 LTS server

Keeping Ubuntu up-to-date is mission-critical for both speed and security. Since packages are regularly updated with new enhancements and security patches, your server is potentially vulnerable if updates are neglected for too long.

Sometimes, Ubuntu also needs to reboot in order to apply new kernel updates.

As a sysadmin, it’s your job to be on top of these things.

Note: This article is written for Ubuntu 22.04 LTS, but the steps can be replicated on most other Ubuntu versions as well.

Regular package and kernel updates

The regular updating process is relatively straightforward. Run the following command as your root or sudo user. Sometimes, packages will ask if you want to update their configuration files – although this varies, we recommend not doing so unless instructed otherwise.

sudo apt update && sudo apt upgrade -y

If prompted to, reboot your system after the updates are finished installing.

sudo reboot

You’ve now successfully updated your system, and by restarting, ensured that all package and kernel updates are applied.

Optionally, you can clean leftover packages with the following command.

sudo apt autoremove && sudo apt clean

This will keep the package manager neat and tidy.

Release upgrades

When new major LTS versions of Ubuntu are released, the update process is slightly different. Start by making sure your packages are up-to-date.

sudo apt update && sudo apt upgrade -y

Then, run the release upgrade to install the new version of Ubuntu LTS.

sudo do-release-upgrade

Follow the steps in the upgrade process, and finish off by rebooting your system.

sudo reboot

You can learn more about Ubuntu release upgrades here.

Share your love