Ubuntu Server Upgrade Steps

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.

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.

Picture 1 of Ubuntu Server Upgrade Steps

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

Picture 2 of Ubuntu Server Upgrade Steps

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.

Picture 3 of Ubuntu Server Upgrade Steps

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.

Picture 4 of Ubuntu Server Upgrade Steps

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.

Picture 5 of Ubuntu Server Upgrade Steps

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.

Picture 6 of Ubuntu Server Upgrade Steps

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.

Picture 7 of Ubuntu Server Upgrade Steps

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.

Update 21 May 2021
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile