Ubuntu Server Upgrade Steps
Ubuntu is one of the most popular operating systems on servers for running websites. Additionally, VPS providers like DigitalOcean, Vultr, and Linode make it even easier to install Ubuntu with just a few clicks.
Ubuntu also constantly updates itself with newer versions. If you're using the desktop, you'll be prompted when an update is available and receive instructions on the process.
However, on the server, you may not have this privilege. So updating Ubuntu server will involve running a few command lines. Learn how to do that through the following article!
Condition
Before you start, it's a good idea to have a backup of your website files and database or a snapshot (record of all settings) of your server. This way you can always revert to the previous state of the server in case the update fails or something on the site goes down.
If you're running a production site where users are constantly using the site, you might want to send them a notification that the site will be momentarily under maintenance.
Finally, you need to have root or pseudo access to the server as it will require high privileges to run the update operation.
Once all these prerequisites are in place, you can get started.
Version check
First, check the current Ubuntu version you have. As can be seen in the image below, the current version the example is running is Ubuntu 18.04 LTS.
LTS (Long-term Support) means that it will be provided by Canonical with updates, security patches, and support for at least 5 years, plus a few more years for maintenance releases, during when the non-LTS version is only supported for about 1 year.
At the time of writing, the current LTS version is 20.04. So the article will update it to 20.04.
Clean and update packages
First, delete the files in the local repositories that can't be downloaded anymore, and remove obsolete packages that were automatically installed, as these files are now mostly useless. To do this:
Step 1. Type the command:
apt clean && apt autoclean && apt autoremove -y
Step 2. Then type the following command to update the package index list and repositories, as well as upgrade some packages:
apt update && apt dist-upgrade -y
The dist-upgrade command also fixes some conflicts on installed packages and dependencies, so it can also remove some packages that are no longer in use.
Step 3. In this step, you may have to restart the server after performing these package upgrades. So when you're prompted to reboot, type:
reboot
This command will automatically log you out of the current SSH session. Wait a while and then re-login SSH.
Upgrade Ubuntu Release
Now, you've got everything covered, updating and dealing with packages in Ubuntu. Next, you can perform the Ubuntu upgrade.
Step 1. To upgrade Ubuntu, enter the following command:
do-release-upgrade
Step 2. This process will first ask you to perform the upgrade on a new SSH daemon. Type 'y' to continue.
Step 3. Second, it will ask to update the package repositories list to Ubuntu 20.04 ('Focal' Fossa). So type 'y' when you want all the list to be updated, then continue.
Step 4. Next, the number of packages and downloads for the upgrade will be confirmed, and the upgrade can take hours. This is usually true when you are upgrading on your local computer, but server upgrades are usually faster.
Step 5. During the upgrade process, you will also receive a message as shown below. This indicates that the upgrade will update some running services and requires a service restart. Select 'Yes' so that the device does not ask for permission every time it needs to be restarted.
Step 6. Now, wait for the upgrade to proceed. At the end of the process, it will ask you to reboot again.
Those are all the steps to upgrade Ubuntu on your VPS. When you log back into SSH after rebooting, you'll be greeted with the new version: Ubuntu 20.04.
Hope you are succesful.
You should read it
- What is the difference between Ubuntu Desktop and Ubuntu Server?
- How to install FTP Server on Ubuntu
- How to Install Ubuntu Server
- How to configure DNS Server on Ubuntu Server 11.04
- How to Set Up an FTP Server on Ubuntu Linux
- How to install desktop/GUI environment in Ubuntu Server
- 7 reasons to upgrade to Ubuntu 23.04
- How to set DNS nameserver in Ubuntu Server 18.04
- Instructions for installing Ubuntu Web Server on remote host
- 5 things to do after upgrading to Ubuntu 22.04 LTS
- How to avoid restarting the server with Ubuntu Livepatch
- What's New in Ubuntu 21.10?
Maybe you are interested
The Latest Features in Meta Llama AI's Major Upgrade
6 Reasons to Upgrade to a Smart Display
3 Upgrades to Prioritize When Buying a New Mac
Samsung will support 7 years of free software upgrades for AI TVs running the Tizen operating system
Microsoft temporarily stopped urging Windows 10 users to upgrade
5 PC upgrades that get the most bang for your buck