Currently, Ubuntu has been released a new LTS version with tons of new features. Upgrading your Server from old Ubuntu to Latest Ubuntu is a good idea but it requires some precautions when you are moving forward to upgrade your server. Upgrading your servers are so easy with given step by step method.

It will upgrade all packages and kernel to latest version so that you can use its latest features and advanced security modules. This tutorial explain you how to smoothly upgrade your WordPress server from Ubuntu old to Ubuntu new so easily.You can easily upgrade your WordPress server hosted with LAMP or LEMP stack with this tutorial.

Step-1 : Create a backup or Snapshot of your Ubuntu WordPress Server

Note: As a precaution, first of all create a backup or snapshots before proceeding to upgrade and If anything goes wrong then backup or snapshots will help you to restore your WordPress website in a last working state.

Connect your WordPress sever using SSH and create a backup. You can also use your VPS hosting backup solutions like snapshots. This feature will help you to manually create a backup using snapshots.

Step-2 : Upgrade to latest Ubuntu using its upgrade scripts

Now, Update package repository to latest:

$ sudo apt-get update

Next, Upgrade packages:

$ sudo apt-get upgrade

You will remove unwanted packages and upgrade Ubuntu to the latest version:

$ sudo apt-get dist-upgrade

Finally run the upgrade scripts:

$ sudo do-release-upgrade

Follow all the instructions during the running of upgrade scripts.

Step-3 : After upgrade finally your WordPress shows you 404 error.

You will replace all configuration files with correct version of PHP from PHP OLD to PHP NEW.

For Apache

Edit Apache virtual host:

$ sudo nano /etc/apache2/sites-available/
$ sudo nano /etc/apache2/sites-enabled/

Edit Apache configuration file:

$ sudo nano /etc/apache2/apache2.conf

Restart the Apache services to make changes in effect:

$ sudo systemctl restart apache2

For Nginx

Edit Nginx server blocks:

$ sudo nano /etc/nginx/sites-available/
$ sudo nano /etc/nginx/sites-enabled/

Edit Nginx configuration file:

$ sudo nano /etc/nginx/nginx.conf

Restart the Nginx services to make changes in effect.:

$ sudo systemctl restart nginx

If this still shows you error then look carefully which packages has been upgraded.

Congratulations now you have upgraded your WordPress server to latest Ubuntu version.