How to Upgrade to the Latest Version of Ubuntu
How to Upgrade to the Latest Version of Ubuntu
Last updated: May 28, 2024
1. Overview
Ubuntu is a Debian-based, open-source Linux distribution made for desktops, cloud computing, the Internet of Things (IoT), and enterprise servers, i.e., servers that collectively satisfy the requirements of an enterprise or a company instead of a single user.
As Ubuntu users, we can optimize the Linux flavor in many ways to help it reach its full potential. One such way is upgrading to the newest available version on the Internet.
In this tutorial, we’ll discuss a step-by-step process to upgrade Ubuntu to the latest version.
2. Optimize Package List
The first step in the process is to optimize the package list on Ubuntu.
Firstly, we update the package list on the distribution:
The apt command works as a package manager on Ubuntu and other Debian-based distros. When we combine it with the update subcommand, it updates the package list on the current installation with the latest available versions and gives us a list of upgradable packages. Moreover, as we need to be a root user to perform this operation, we’ve used the sudo command.
As we can see, six packages can be upgraded in this case.
So, let’s upgrade them using the apt upgrade command:
We provide yes as an input into the terminal when prompted to continue with the package upgrade process.
After the process is complete, we use the autoremove command to remove all the unnecessary packages from the distro and also utilize the –purge option to remove all of their configuration files too:
Again, we’ve entered yes as an input to the prompt to continue the removal procedure.
The package list is now optimized. Hence, it’s time to proceed to the next step.
3. Install update-manager-core
The update-manager-core package is essential for upgrading Ubuntu from one version to another.
Before installing the package, we reboot the distribution to ensure that it’s working fine:
Then, we install the package:
Once the installation is complete, we can move on to the upgrade itself.
4. Upgrade Ubuntu to the Latest Version
We’ve already optimized the package list in Ubuntu, which helps prevent problems during the upgrade process. Moreover, we’ve installed the update-manager-core package, enabling us to upgrade Ubuntu.
Now, let’s learn how to install the latest version of Ubuntu.
4.1. Initiating the Version Upgrade Process
First, we obtain the newest version of Ubuntu that’s available on the Internet:
The do-release-upgrade command upgrades a distribution to the latest version. However, the -c option, short for –check-dist-upgrades, tells the command to only check for the newest available version of Ubuntu.
Evidently, the latest version is 23.04. So, let’s upgrade the distro to this version using the above command with no options:
Visibly, we’ve successfully initiated the operation.
4.2. Navigating Through the Process
During the operation, we encounter back-to-back prompts that we have to answer correctly to proceed to the next step and eventually finish the upgrade process.
The first prompt asks for permission to start upgrading Ubuntu. Here, we hit Enter to give permission and start the upgrade process:
Then, we see some information regarding the upgrade and a prompt that urges us to verify the information. In this case, we type yes in the terminal to validate the information and proceed to the next step:
The next prompt seeks permission to remove outdated packages from the distro. Here, we again type yes to give permission and move on to the final step:
The final prompt asks us to restart the system to finish the upgrade process. In this case, we input yes for the last time in the terminal to proceed:
Now, we’ve finished upgrading Ubuntu. Let’s see how to verify the Ubuntu upgrade.
5. Verify Version Upgrade
We can verify if we have the latest version of Ubuntu, i.e., 23.04, by running a single command in the terminal:
The lsb_release command prints information about the Linux Standard Base (LSB). However, the -a option, short for –all, tells the command to display information regarding the distro, which contains its distributor ID, description, release number, and codename.
The Release label shows the release number, i.e., the current version of Ubuntu, which is 23.04 in this case. This indicates that we’ve upgraded to the latest version of Ubuntu.
6. Enable Third-Party Repositories
When we upgrade Ubuntu, all third-party repositories are disabled, which can cause problems when operating on the upgraded Ubuntu version. Therefore, we can enable them after the upgrade to keep the distro running smoothly.
However, if enabling third-party repositories causes problems, we can fix this by disabling them again.
Now, let’s go through the process of enabling a disabled repo.
6.1. Finding Disabled Repos
First, we find the third-party repos that are disabled on Ubuntu. To do that, we navigate to the sources.list.d directory located in /etc/apt:
Then, let’s list the contents of /etc/apt/sources.list.d:
The -l option restricts each line to contain only a single entry.
Evidently, there are some disabled repos in the directory that we can enable one by one.
6.2. Enabling a Disabled Repo
Let’s see how to enable a disabled repository by enabling the google-chrome.list repo, which provides Google Chrome on Ubuntu.
So, let’s open the repo or file in the nano editor:
Upon opening the file, we see its contents in the terminal:
The hash (#) symbol indicates the line after it’s commented out, making Google Chrome disabled on the distro. To enable it, we remove the hash:
After modifying, we press Ctrl + x to quit the editor and then hit y to save the file. The Google Chrome repository is enabled upon saving, and all future updates are now available.
Now, we can follow this process for every repo in the directory to enable all of them on Ubuntu.
7. Software From Unsupported Ubuntu Releases
Upgrading software from an old and unsupported Ubuntu release can provide access to new features. Additionally, upgrading software enables us to apply critical security patches that can protect the systems from cyberattacks.
Additionally, some tools may have dependencies that are only available in older or unsupported Ubuntu releases.
Therefore, let’s explore how to install or upgrade software from the old and unsupported Ubuntu releases. In summary, the procedure involves changing the repositories and reflecting that change internally within the operating system.
7.1. Installing Software
To install software from an old and unsupported Ubuntu release, first, we edit the /etc/apt/sources.list file. The source.list file contains the software sources the package management system uses to install software packages.
Therefore, we open the source.list file using an editor like nano:
Now, we replace the archive.ubuntu.com repository with the old-releases.ubuntu.com repository in the source file. We can achieve this task either by editing the source file manually or running a command from the terminal:
Let’s take a look at the updated source file:
Moreover, after updating the source file, let’s update the package lists:
This way, we ensure that the package management system can install packages from the archive of old Ubuntu releases. Now, we can utilize the apt-get command to install software from old and unsupported Ubuntu releases.
7.2. Upgrading Software
If we installed some software from the archive of old Ubuntu releases and want to upgrade them, we need to modify the software sources in the /etc/apt/sources.list file. We replace the old-releases.ubuntu.com repository with the archive.ubuntu.com repository. Let’s complete this task from the terminal via sed and an in-place update:
After performing the replacement, let’s again check the sources.list file:
Furthermore, after modification of the source file, we download the latest software source information and keep the local copy of the package database up-to-date by executing the update command:
The update command doesn’t install or upgrade any packages. It only updates the list of software, addresses (URLs), and versions.
Finally, let’s upgrade all the software to their latest versions using the dist-upgrade command. To perform an extensive update, including installing new packages or removing obsolete ones, we pick the dist-upgrade command over the upgrade command:
It’s important to note that we might need to restart the computer to complete the updation procedure.
8. Conclusion
In this article, we learned how to upgrade to the latest version of Ubuntu and also touched upon the steps that we can perform before and after the upgrade to keep the distro running smoothly.
Finally, we discussed how to install or upgrade software from the old and unsupported Ubuntu releases.
Comments