Close all open applications.<\/li>\n<\/ol>\n\n\n\nStep 1: Backup all your data<\/h2>\n\n\n\n It is prudent to take a backup of all your databases and files before embarking on any major upgrade of an operating system. This ensures you will not lose your data in case something goes wrong during the upgrade process. <\/p>\n\n\n\n
Cloud server providers offer snapshot services. Therefore, if you are running a virtual machine or cloud VPS, ensure you take a complete snapshot so that you can restore your instance in case it breaks.<\/p>\n\n\n\n
Step 2: Upgrade all the system packages<\/h2>\n\n\n\n Once the backup is in place, log in to your instance and upgrade all the packages to their latest versions. This upgrades the entire system to the latest Ubuntu release.<\/p>\n\n\n\n
To list upgradable packages, run the command (note: if you haven’t done this in a while, you may want to run the sudo apt update<\/em> command first to get the most current details possible):<\/p>\n\n\n\n$ sudo apt list –upgradable<\/code><\/p>\n\n\n\nNext, refresh the local package index and upgrade the packages in one single command as follows:<\/p>\n\n\n\n
$ sudo apt update && sudo apt upgrade -y<\/code><\/p>\n\n\n\n <\/figure>\n\n\n\nThis might take a while depending on the number of installed packages with pending upgrades. Once the upgrade is complete, reboot your system to take advantage of the latest kernel that will come with the upgrade.<\/p>\n\n\n\n
$ sudo reboot<\/code><\/p>\n\n\n\nThen log back into the system and confirm it has been upgraded to the latest release, which, at the time of publishing this guide, is Ubuntu 20.04.4 LTS.<\/p>\n\n\n\n
$ lsb_release -a<\/code><\/p>\n\n\n\n <\/figure>\n\n\n\nStep 3: Open TCP port 1022<\/h2>\n\n\n\n If you are connected to your Ubuntu instance via SSH, the upgrade tool will open another SSH port (1022) as a fallback port in case the SSH connection drops on port 22. <\/p>\n\n\n\n
To simplify things, we recommend that you open port 1022 on your firewall as follows. We also recommend speaking with your networking team beforehand to ensure you are minimizing potential security risks. Be sure to follow Step 6 below to close the port when you are done.<\/p>\n\n\n\n
$ sudo ufw allow 1022\/tcp<\/code><\/p>\n\n\n\nTo apply the firewall rule, reload the firewall.<\/p>\n\n\n\n
$ sudo ufw reload<\/code><\/p>\n\n\n\nThen verify that the port has been opened by probing the firewall status as shown.<\/p>\n\n\n\n
$ sudo ufw status<\/code><\/p>\n\n\n\n <\/figure>\n\n\n\nStep 4: Upgrade to Ubuntu 22.04 Jammy Jellyfish <\/h2>\n\n\n\n At this point, upgrading to Ubuntu 22.04 will be a straightforward and seamless process. There are two ways to upgrade to the latest Ubuntu version: You can use the do-release-upgrade <\/strong>tool, which works for both CLI and GUI instances, or the GUI update tool.<\/p>\n\n\n\nIn this guide, we will use the do-release-upgrade <\/strong>tool. If it is not installed, you can install it by running the command:<\/p>\n\n\n\n$ sudo apt install update-manager-core<\/code><\/p>\n\n\n\nTo commence the upgrade, run the command:<\/p>\n\n\n\n
$ sudo do-release-upgrade<\/code><\/p>\n\n\n\nDuring the upgrade, the upgrade tool will probe for the latest LTS release and walk you through a series of prompts.<\/p>\n\n\n\n
First and foremost, it will detect your SSH connection and notify you that an additional SSH service will be started on port 1022. Simply type “Y<\/strong>” to proceed.<\/p>\n\n\n\nNext, the upgrade tool will notify you to open port 1022, which will be used as an alternative SSH port in case of an SSH connection interruption on the default port. Since you already opened the port, just hit ENTER.<\/p>\n\n\n\n <\/figure>\n\n\n\nNext, you will be prompted to update the “sources.list<\/strong>” file from \u2018focal\u2019 to \u2018jammy\u2019 entries. To proceed with the upgrade, press “Y<\/strong>” and press ENTER.<\/p>\n\n\n\n <\/figure>\n\n\n\nThe update tool will calculate all the changes and provide a summary of the following:<\/p>\n\n\n\n
\nInstalled packages that are no longer supported by Canonical.<\/li>\n\n\n\n The number of packages to be removed.<\/li>\n\n\n\n The number of new packages that will be installed.<\/li>\n\n\n\n The number of packages that will be upgraded.<\/li>\n\n\n\n Total download size and how long the download will take.<\/li>\n<\/ol>\n\n\n\nTo continue, once again, press “Y<\/strong>” and press ENTER.<\/p>\n\n\n\n <\/figure>\n\n\n\nSome services will need to be restarted once some libraries and packages are upgraded. On this pop-up, select ‘Yes<\/strong>‘ to restart these services during package upgrades without being prompted.<\/p>\n\n\n\n <\/figure>\n\n\n\nFrom here, the upgrade tool will proceed to download all the requisite packages from the official Ubuntu repositories and upgrade them.<\/p>\n\n\n\n <\/figure>\n\n\n\nWhen prompted on what to do with the modified “sshd_config<\/strong>” configuration file, you can choose to install the package maintainer\u2019s version or keep the local version installed. Then, select ‘Ok<\/strong>\u2019.<\/p>\n\n\n\n <\/figure>\n\n\n\nNext, press “Y<\/strong>” and hit ENTER to remove obsolete packages.<\/p>\n\n\n\n <\/figure>\n\n\n\nThereafter, all the old packages alongside their configuration files will be removed.<\/p>\n\n\n\n <\/figure>\n\n\n\nThe entire process takes quite some time, so patience will be required. This is a good time to take a break and grab some coffee.<\/p>\n\n\n\n
Once the upgrade is complete, you will be prompted to restart the system to finish the upgrade. Press “Y<\/strong>” and hit ENTER to reboot. This will cause you to lose connection to the server.<\/p>\n\n\n\n <\/figure>\n\n\n\nStep 5: Verify the upgrade to Ubuntu 22.04<\/h2>\n\n\n\n After rebooting, log back in and confirm the upgrade was successful. <\/p>\n\n\n\n
The command lsb_release -a<\/code> checks the version of Linux, while the command uname -mrs<\/code> checks the kernel version.<\/p>\n\n\n\nFrom the output below, you can see that we are now currently running Ubuntu 22.04 LTS. Also, note that we are using kernel 5.15 which is the kernel version that comes with Ubuntu 22.04 by default.<\/p>\n\n\n\n <\/figure>\n\n\n\nStep 6: Delete the firewall rule you created<\/h2>\n\n\n\n Now that you are finished with the update and no longer need port 1022 open, run the following command to close the port and prevent it from becoming a security vulnerability.<\/p>\n\n\n\n
sudo ufw delete allow 1022\/tcp<\/code><\/p>\n\n\n\nStep 7: Enable third-party repositories<\/h2>\n\n\n\n During the upgrade, all third-party repositories are disabled. You might want to re-enable them now that the upgrade is complete. You can find these repositories in the \/etc\/apt\/sources.list.d<\/code> directory. <\/p>\n\n\n\nTo display these repositories, run the command:<\/p>\n\n\n\n
$ ls -l etc\/apt\/sources.list.d\/<\/code><\/p>\n\n\n\nTo enable them, simply open each file and uncomment the entries by deleting the # sign at the beginning of each line.<\/p>\n\n\n\n
Finally, free up the disk space by removing all the unnecessary packages as follows:<\/p>\n\n\n\n
$ sudo apt autoremove –purge<\/code><\/p>\n\n\n\nConclusion<\/h2>\n\n\n\n As you have seen, upgrading Ubuntu 20.04 to Ubuntu 22.04 is a simple process that requires just a few commands.<\/p>\n\n\n\n
If you are an IT admin overseeing the updates of multiple Ubuntu systems, in addition to macOS and Windows device updates, your workflow can become quite complicated very quickly.<\/p>\n\n\n\n
With JumpCloud, an OS-agnostic device management solution<\/a>, in place you can gain complete visibility into all of the update statuses in your heterogeneous fleet and simplify your patching process. <\/p>\n\n\n\nLearn more about what\u2019s possible with automated patch management for Ubuntu<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"Learn how to upgrade your system from Ubuntu 20.04 to Ubuntu 22.04 in this tutorial.<\/p>\n","protected":false},"author":150,"featured_media":63947,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_oasis_is_in_workflow":0,"_oasis_original":0,"_oasis_task_priority":"","inline_featured_image":false,"footnotes":""},"categories":[23],"tags":[],"collection":[2778],"platform":[],"funnel_stage":[3017],"coauthors":[2535],"acf":[],"yoast_head":"\n
How to Upgrade Ubuntu 20.04 to Ubuntu 22.04 - JumpCloud<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n \n \n \n\t \n\t \n\t \n