How to upgrade Ubuntu Server

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!

Prerequisites

Before you start, it’s best 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 access root or pseudo 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.

Check version

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.

Current version is Ubuntu 18.04 LTS
Current version 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.

See more:  How to set up or disable Linux Mint update notifications

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 files in the local repositories that can no longer be downloaded, and remove obsolete packages that were automatically installed, as these files are now mostly useless. To do this:

1. Type the command:

apt clean && apt autoclean && apt autoremove -y
Remove unnecessary packages
Remove unnecessary packages

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

Comeinand dist-upgrade also fixes some conflicts on installed packages and dependencies, so it can also remove some packages that are no longer in use.

Update package index list and repositories, upgrade some packages
Update package index list and repositories, upgrade some packages

3. At 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.

1. To upgrade Ubuntu, enter the following command:

do-release-upgrade

2. This process will first ask you to perform the upgrade on a new SSH daemon. Import “y” to continue.

Enter “y” to continue
Enter “y” to continue

3. Second, it will ask to update the package repositories list to Ubuntu 20.04 (“Focal” Fossa). So enter “y” when want all list to be updated then continue.

Update package repositories list to Ubuntu 20.04
Update package repositories list to Ubuntu 20.04

4. Next, the number of packages, the download size 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.

See more:  The Cat command in Linux
The number of packages, the download size for the upgrade will be confirmed
The number of packages, the download size for the upgrade will be confirmed

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. Choose “Yes” so that the device doesn’t ask for permission every time it needs to reboot

Select “Yes” so that the device does not ask for permission every time it needs to be restarted
Select “Yes” so that the device does not ask for permission every time it needs to be restarted

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 the reboot, you will be greeted with the new version: Ubuntu 20.04.

Hope you are succesful.

Source link: How to upgrade Ubuntu Server
– https://techtipsnreview.com/

, ,

Leave a Reply

Your email address will not be published. Required fields are marked *