1. Home
  2. Linux
  3. How to upgrade to ubuntu server 22 04 lts

How to upgrade to Ubuntu Server 22.04 LTS

A new version of Ubuntu Server is out, and with it comes tons of excellent new additions, bug fixes, and more. This guide is for you if you’re looking to try out 22.04 on your system. Follow along to learn how to upgrade to Ubuntu Server 22.04 LTS!

Update existing OS packages

Before attempting to upgrade Ubuntu Server to the new 22.04 LTS release, the existing OS (21.10 or 20.04) needs to be updated. So first, log into the Ubuntu Server with an SSH connection or sit at it physically to update your system. Then, run the apt update command.

sudo apt update

Running the apt update command will check for updates and patches for your Ubuntu Server OS. Once upgrades are detected, you’ll see a message, “X package can be upgraded. Run ‘apt list –upgradable’ to see it.”

To view available upgrades for your Ubuntu Server system, execute the apt list –upgradable command.

apt list --upgradable

After looking at available updates to your Ubuntu Server system, you can install them using the apt upgrade command. Note that if you have not updated Ubuntu Server in a few weeks, this update could take time to complete.

sudo apt upgrade -y

With all of the updates and patches installed on your Ubuntu system, it is time to reboot the OS. Why? Often Ubuntu Server includes security patches that require a restart. To reboot directly from the command line, run the reboot command.

sudo reboot

Create a backup of your data

Upgrading Ubuntu Server is considered safe, and during the process, you likely won’t lose any data. However, it is still a good idea to create a backup of your existing data to ensure that a backup can be restored if anything goes wrong.

The best way to backup data in Ubuntu Server is to do it off-site. What is “off-site?” A backup of your Ubuntu Server data is taken off the machine and placed somewhere else. The easiest way to go about this is to transfer it to another server in your home, a removable SSD or HDD, etc.

Unsure about how to create an off-site backup on Ubuntu Server? Check out the “Backups” section on the official Ubuntu Server documentation page. It covered Bacula, Shell scripts, and other backup solutions.

Setting up the Update Manager on Ubuntu Server

To update Ubuntu Server correctly, you must install the “update-manager-core” package. This package will help you update your existing Ubuntu Server installation to the new 22.04 LTS release.

Installing the “update-manager-core” package is done with the apt install command in a terminal shell.

sudo apt install update-manager-core

Upon installing the “update-manager-core” package on your system, look at the “release-upgrades” file. This file will tell you your upgrade preferences.

tail /etc/update-manager/release-upgrades

If you’ve installed an LTS previously, it should say “Prompt=lts” at the bottom. Leave “Prompt=lts” as is. With this setting, Ubuntu will only upgrade to 22.04 LTS, and the LTS releases that come after (are much more stable).

On the other hand, If you’re using a non-LTS release, it should say “Prompt=normal.” Change it to “Prompt=lts” in a text editor (as root) if you upgrade from a non-LTS release.

Save the file when done.

Upgrading Ubuntu Server

To upgrade your Ubuntu Server system to Ubuntu Server 22.04 LTS, start by gaining a root shell in the terminal window. On Ubuntu, this is done with the sudo -s command.

sudo -s

Once you’ve got a root shell, execute the do-release-upgrade command. This command will start the upgrading process for Ubuntu. If you cannot get the upgrade tool to begin the upgrade process, you can force it by entering the do-release-upgrade -d command instead.

Note: do not upgrade over SSH without using a terminal session manager like Screen. The Screen tool helps you resume a terminal session if you get disconnected.

do-release-upgrade

Upon entering the do-release-upgrade command, Ubuntu Server will take you through the 22.04 LTS upgrade process. Be sure to read and follow the prompts carefully to finish the upgrade process.

Getting a fresh copy of Ubuntu Server 22.04 LTS

While upgrading an existing Ubuntu Server installation is a great way to try out new features, sometimes it is better to restart and install a fresh copy. So if you’ve been toying around with re-installing Ubuntu Server, here’s how you can get your hands on the latest 22.04 LTS ISO.

To start, head over to Ubuntu.com/server. Once there, find the green “Download Ubuntu Server” button and click on it with the mouse. You’ll then be able to download the latest Ubuntu Server 22.04 LTS ISO, which can be used for a fresh installation.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.