Introduction:
Upgrading your Ubuntu system to the latest LTS release is an essential task to ensure you have access to the latest features, security updates, and improvements. This step-by-step guide will walk you through the process of upgrading to Ubuntu 22.04 LTS (Jammy Jellyfish). Please ensure you meet the prerequisites before proceeding.
Prerequisites:
1. At least 20 GB of free disk space.
2. A regular user configured with sudo privileges.
3. A fast and stable internet connection.
4. A fully charged UPS or battery.
5. Close all open applications.
Step 1: Backup All Your Data
Before you begin the upgrade, it's crucial to back up your data, especially databases and files. Consider using snapshot services if you're on a cloud server.
Step 2: Upgrade System Packages
Upgrade all packages to their latest versions. Log in to your system and use the following commands:
sudo apt update
sudo apt upgrade -y
sudo reboot
lsb_release -a
Ensure your system has been upgraded to Ubuntu 20.04.4 LTS.
Step 3: Open TCP Port 1022
If connected via SSH, open port 1022 for SSH as a fallback in case the connection on port 22 drops:
sudo ufw allow 1022/tcp
sudo ufw reload
sudo ufw status
Step 4: Upgrade to Ubuntu 22.04 Jammy Jellyfish
Upgrade to Ubuntu 22.04 using the `do-release-upgrade` tool:
sudo apt install update-manager-core
sudo do-release-upgrade
Follow prompts to open port 1022, update the sources.list file, and accept package changes. Allow service restarts during package upgrades.
Step 5: Verify the Upgrade
After rebooting, log in and verify the upgrade's success with the following commands:
lsb_release -a
uname -mrs
Check that you're running Ubuntu 22.04 LTS.
Step 6: Delete the Firewall Rule
Remove the opened port 1022 as it's no longer needed:
sudo ufw delete allow 1022/tcp
Step 7: Enable Third-Party Repositories
After the upgrade, third-party repositories are disabled. To re-enable them, find and edit the files in `/etc/apt/sources.list.d/`. Remove the `#` at the beginning of each line to uncomment them.
Step 8: Free Up Disk Space
To free up disk space, remove unnecessary packages:
sudo apt autoremove --purge
Your Ubuntu system is now successfully upgraded to Ubuntu 22.04 LTS (Jammy Jellyfish). Enjoy the latest features and improvements!