Upgrade Ubuntu 20.04 to 22.04 via command line

WBOY
Release: 2024-03-20 13:25:16
forward
1174 people have browsed it

通过命令行将Ubuntu 20.04升级到22.04

This article details the steps to upgrade Ubuntu 20.04 to 22.04. For users using Ubuntu 20.04, they missed the new features and advantages brought by the 22.04 version. In order to get a better experience and security, it is recommended to upgrade to a newer Ubuntu version in time. Ubuntu 22.04 is codenamed "Jamie Jellyfish", let's explore how to get the latest LTS version!

How to upgrade Ubuntu 20.04 to 22.04 via command line

Mastering the command line will give you an advantage. While it is possible to update Ubuntu via the GUI, our focus will be via the command line.

First, let’s check the currently running version of Ubuntu using the following command:

$LSB_Release-a

For this case, we confirm that we currently have Ubuntu 20.04, codenamed "focal".

Be sure to back up your system before upgrading Ubuntu. It is highly recommended to take system snapshots to ensure data recovery in any situation and avoid losing important information. Backup can be done through a variety of tools and commands. After the backup is complete, proceed with the following steps:

Step 1: Update and Upgrade

In order to start the upgrade process smoothly, it is recommended that you update the current Ubuntu version first to ensure that all software packages are up to date. Just execute a simple "update" command.

$sudo apt update

After updating packages, run the "upgrade" command to ensure all packages are upgraded for a clean transition.

$sudo apt upgrade

Finally, run the following command to check and satisfy all package dependencies:

$sudo apt dis—upgrade

Step 2: Restart the system

After updating and upgrading your Ubuntu repositories, some packages may no longer be needed. You can choose to remove them using the "AutoRemove" command. You must then reboot your system to ensure all changes take effect before we upgrade to Ubuntu 22.04. Use the following command:

$sudo apt automatic deletion

$sudo restart

Step 3: Upgrade to Ubuntu 22.04

A quick way to upgrade Ubuntu is to use the "do-Release-Upgrade" command. Once executed, it will check for new Ubuntu versions, update "Soures.list", and initiate the upgrade.

$sudo—release—upgrade

Notice how Ubuntu identifies "Jammy" as the new version after we ran the previous command, which is the codename for Ubuntu 22.04. It then proceeds to prepare for the upgrade.

Once all preparations including updating "Soures.list" are completed, you will be prompted to confirm whether to continue the upgrade. You can type "d" to view the upgrade details, or press "y" to start the upgrade, as shown below:

When you receive a prompt to confirm upgrading Firefox, hit the "Enter" key on your keyboard and the upgrade will proceed. For any prompt that appears, check its details and choose the ideal action for you.

You will also be prompted to remove obsolete packages before the upgrade is completed. You can choose to keep these packages and remove them later, or confirm the action and remove all packages except those that come with Ubuntu 22.04.

The final step is to reboot the system and boot into the new Ubuntu 22.04. When you receive the following prompt, please press the "y" key and wait for the system to restart.

After restarting, open a terminal and check the version of Ubuntu running on it. You will notice that the code name and LTS version have changed. that's all! You successfully upgraded Ubuntu 20.04 to 22.04.

$LSB_Release-a

Alternatively, you can run the "UPDATE" and "UPGRADE" commands to ensure that all packages are updated and your system is ready for use.

$sudo APT update&&sudo APT upgrade

in conclusion

It is recommended to upgrade your Ubuntu to stay current with the latest security fixes and updates. With the simple steps explained in this article, you can upgrade from Ubuntu 20.04 to Ubuntu 22.04. Hopefully you now understand what you need to do to upgrade your Ubuntu.

The above is the detailed content of Upgrade Ubuntu 20.04 to 22.04 via command line. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:mryunwei.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!