That said, if you are looking for the quickest way to upgrade Ubuntu, the command line is the solution. We will cover upgrading Ubuntu via the command line.”
Upgrading Ubuntu Via Command Line
There are two ways to upgrade Ubuntu. You can choose to install the latest version, which deletes all your data and files. Alternatively, you can upgrade from the terminal without installing Ubuntu afresh, which we will do in this article.
Key Points Before Upgrading
Before we upgrade Ubuntu, there are a few considerations to note.
- You must have sudo privileges to initiate the upgrade
- Your root partition should have 3 – 4 GB of free space.
- You require a strong internet connection.
- Create a backup of your data by creating a complete system snapshot.
- There is no means of downgrading your Ubuntu
How to Upgrade Ubuntu to Latest Version
With Ubuntu, you can upgrade the whole version or the installed packages.
To only upgrade the packages, use the commands below.
To upgrade the whole version, start by checking the current Ubuntu version you are running.
For this case, we are running Ubuntu 20.04.4. The current release when writing this article is Ubuntu 22.04. Follow the steps below to Upgrade Ubuntu. The first upgrade will get version 21.10, but you can again upgrade it to 22.04.
Step 1. Install the Update Manager Core Package
Open your terminal and enter the command below.
For the upgrade to work, ensure the upgrade policy is set to “Prompt=Its” or “Prompt=normal” in the /etc/update-manager/release-upgrades file.
Note that this guide assumes you are upgrading your desktop Ubuntu version. However, if you are working remotely over ssh, you will need to temporarily open port 1022 for the upgrade to work, especially if you are running a firewall.
Step 2: Install Pending Package Updates
It’s a good habit to install any pending software updates before upgrading the whole system.
Reboot your system before proceeding to upgrade.
Step 3: Start the Upgrade
With a stable connection to save time, run the command below to download the needed files and upgrade your Ubuntu to the latest version. The download size is around 1.8 GB. Therefore, your internet speed determines how fast it takes.
When prompted whether to install the downloaded packages, confirm to upgrade the system.
Once the upgrade completes, choose to restart the machine to finish the upgrade. Click the y keyboard key and press the enter key.
You can verify the upgrade by checking the current version, as shown.
Our current upgraded version is 21.10. However, if you run the upgrade command again, it will upgrade to the latest version. The upgrading process is simple. The only thing you should have is enough time to let the process complete and a stable internet connection. Furthermore, any prompts during the process are clear, and you will be required to select an option to proceed. Therefore, ensure to create a backup to roll back to in case something messes along the way. If you follow the procedure listed in this guide, you shouldn’t have any trouble.
Conclusion
You now know how to upgrade Ubuntu to the latest version from the command line. Staying updated is recommended as new releases offer better tools. However, always create a backup of your data and note that you can’t degrade Ubuntu unless via a fresh install. Enjoy the new Ubuntu upgrade!