HOW TO UPGRADE THE SERVER TO UBUNTU 04.22
Requirements
Potential errors
1: System backup
2: Update current packages
sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
3: Upgrading Ubuntu using the do-release-upgrade tool
sudo do-release-upgrade
Checking for new Ubuntu releaseNo new release found
sudo do-release-upgrade -d
Reading cacheChecking package managerContinue running under SSH?This session appears to be running under ssh. It is not recommendedto perform a upgrade over ssh currently because in case of failure itis harder to recover.If you continue, an additional ssh daemon will be started at port'1022'.Do you want to continue?Continue [yN]
After that, the do-release-upgrade command will tell you to start sshd on port 1022.
Starting additional sshd
To make recovery in case of failure easier, an additional sshd will
be started on port '1022'. If anything goes wrong with the running
ssh you can still connect to the additional one.
If you run a firewall, you may need to temporarily open this port. As
this is potentially dangerous it's not done automatically. You can
open the port with e.g.:
'iptables -I INPUT -p tcp --dport 1022 -j ACCEPT'
To continue please press [ENTER]
Press the Enter key. Next, you may be warned that the mirror record was not found. Most of the time you can just ignore this warning and continue with the update (most likely there is actually a local mirror for 22.04). Enter y:
Updating repository information
No valid mirror found
While scanning your repository information no mirror entry for the
upgrade was found. This can happen if you run an internal mirror or
if the mirror information is out of date.
Do you want to rewrite your 'sources.list' file anyway? If you choose
'Yes' here it will update all 'focal' to 'jammy' entries.
If you select 'No' the upgrade will cancel.
Continue [yN]
After downloading the new package lists and calculating the changes, the system will ask if you want to start the update. Type y again to continue:
Do you want to start the upgrade?
4 packages are going to be removed. 107 new packages are going to be
installed. 554 packages are going to be upgraded.
You have to download a total of 547 M. This download will take about
1 minute with a 40 Mbit connection and 14 minutes with a 5 Mbit connection
connection.
Using and installing an upgrade can take several hours. Once the
download has finished, the process cannot be canceled.
Continue [yN] Details [d]
You may get a warning about not being able to turn off the lock screen:
Unable to disable lock screen
It is highly recommended that the lock screen be disabled during the
upgrade to prevent later issues. Please ensure your screen lock is
disabled before continuing.
If you are connecting to an Ubuntu server, you can ignore this warning by pressing Enter.
The system will then extract, unpack and install new packages. Even if your system uses a fast connection, it will take some time.
During installation, interactive windows with various questions may appear on the screen. For example, you may be asked if you want to automatically restart services when necessary. And here you can confidently answer Yes. The system may also ask if you want to replace the edited configuration file. This is always a case-by-case situation that requires software-specific knowledge, which is beyond the scope of this guide.
After installing the new packages, you will be asked if you are ready to remove the outdated packages. In a standard system without user configuration, you can simply answer y. If your system has a lot of custom settings, you can type d and check the list of packages to remove (in case it contains something you'll need to reinstall later).
Remove obsolete packages?
53 packages are going to be removed.
Continue [yN] Details [d]
Finally, if everything went well, the system will tell you that the update is complete and a reboot is required. Enter Y to continue:
System upgrade is complete.
Restart required
To complete the upgrade, restart is required.
If you selected 'y' system will be restarted.
Continue [yN]
In your SSH session, you should probably see something like:
Connection to 203.0.113.241 closed by remote host.
Connection to 203.0.113.241 closed.
You may need to press some key to exit the local command line, as your SSH session will be terminated on the server side.
Wait for the server to reboot and then connect again. When you log in, you should see a welcome message confirming that you are on a new version of Ubuntu:
Welcome to Ubuntu 22.04 LTS (GNU/Linux 5.15.0-25-generic x86_64)
Conclusion
You now have a working Ubuntu 22.04 installation. After the upgrade, you will probably need to examine the configurations of the services and deployed applications and make the necessary changes.