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
- 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
May be interested
- How to install desktop/GUI environment in Ubuntu Serverif you are just installing ubuntu server for the first time, you may want a familiar user interface, similar to ubuntu desktop, for example.
- How to upgrade Ubuntu from the command linesometimes you cannot use the graphical utility to upgrade ubuntu, in which case you must use the command line to upgrade it.
- Canonical Urges Ubuntu 20.04 LTS Users to Upgrade or Purchase Extended Supportas a long-term support release, ubuntu 20.04 lts (long-term support) will be supported with continuous updates for a total of 5 years, meaning it will reach end-of-life around april 2025.
- How to set DNS nameserver in Ubuntu Server 18.04for years, whenever you need to configure a dns nameserver in linux, users will find /etc/resolv.conf. some simple settings will help your computer reach out to the outside world:
- 5 reasons to upgrade to Ubuntu 19.04 'Disco Dingo'some new additions in ubuntu 19.04 'disco dingo' show that developers have spent more time working directly on gnome.
- Ubuntu 21.04 users need to update the system ASAPaccording to the proposed roadmap, it is only a few days before canonical will officially stop providing updates for ubuntu 21.04 'hirsute hippo', which has been available since april last year.
- Instructions for installing Ubuntu Web Server on remote hostin the following article, we will show you how to install and configure ubuntu web server system on remote host. to do this, you need to prepare several factors as follows ...
- How to avoid restarting the server with Ubuntu Livepatchif you administer your own server (s), sooner or later you will encounter this problem. you must restart the operating system, but the machine that is providing an important service cannot be interrupted.
- What's New in Ubuntu 21.10?version 21.10 is the latest release of ubuntu and although canonical is turning more attention to the cloud and developers, ubuntu 'impish indri' still comes with some notable changes for those users use the ubuntu desktop every day.
- How to Set up an FTP Server in Ubuntu Linuxthis wikihow article will show you how to set up and connect to an ftp server from your ubuntu linux computer. ftp servers are useful for storing files from your computer and allowing others to browse them. in order to set up an ftp server...