How to Upgrade Linux Kernel in Ubuntu 16.04 Server

tep 1 - Update Ubuntu Repository and Upgrade all Packages

The first thing we want to do before we upgrade the kernel is to update the Ubuntu repositories and to upgrade all packages to their latest versions.

Connect to your ubuntu server through SSH login. You have to be root user for the next steps. If root login is disabled on your server, then login as your normal user and run 'sudo -s to become root.

ssh [email protected]

Update all repositories of the system.

sudo apt update

Update ubuntu repository

Then upgrade all packages installed with the command below.

sudo apt upgrade -y

Finally, reboot the server to ensure that potentially installed kernel updates get applied.

sudo reboot

Now check again for upgradable packages with the command below.

sudo apt list --upgradeable

Make sure you have no pensing updates.

Step 2 - Checking the Active Kernel Version

In this step, we will check the active kernel of our system. We need to know the system architecture and the kernel version that is used on the system.

Check the active kernel used by the system with the uname command.

uname -msr

You will get the kernel version as below.

Linux 4.4.0-78-generic x86_64

This means, we are using the Generic Linux kernel version 4.4 with x86_64/64-bit system.

The Generic kernel is a general purpose kernel. If you want to use your box for tasks like editing, encoding video and audio, it's e.g. recommended to use one of the 'lowlatency' kernels.

Step 3 - Install New Kernel Version

Now we know that we are using kernel 4.4 at the moment. In this step, we will upgrade the used kernel to the latest mainline kernel build version 4.11.2. All mainline kernel build can be downloaded from this site -

Create a new directory for the mainline kernel version.

sudo mkdir -p ~/4.11.2
cd ~/4.11.2

Download the generic kernel version packages (because we are using generic version) using the wget command.


Download Mianline Kernel Build

Now install the packages with the dpkg command below.

dpkg -i *.deb

When the kernel package installation is complete, update grub and reboot the system.

sudo update-grub
sudo reboot

Update Grub Ubuntu 16.04

After server rebooting, check again the kernel version.

uname -msr

You will get a new kernel on the system: 4.11.2.

Linux 4.11.2-041102-generic x86_64

A new Kernel Version has been Installed

Step 4 - Remove the old Kernel

At this stage, the kernel version of our server is updated to 4.11.2. In this step, we will remove the old kernel and just leave the new version that we are using now.

For this purpose, we will use a command-line utility named 'byobu'. It's a great utility to safely remove and purge an old kernel from the system and will never remove the currently running kernel.

Install byobu with the apt command below.

sudo apt install byobu

Install Byobu ubuntu 16.04

Whet it's complete, check installed kernel version on the system.

dpkg -l | grep linux-image

We will get the result as below.

Get ubuntu kernel Installed on the System

On the server, iI have installed three versions of the Ubuntu kernel: 4.4.62 - 4.4.78 - 4.11.2. And for now, the system is using the latest kernel 4.11.2. We will remove the old kernel 4.4 and leave the latest one 4.11.2.

Run the command below to remove the old kernel.

sudo purge-old-kernels

If you see the result below:

No kernels are eligible for removal

Then you only have 2 kernel versions installed. By default, byobu will keep at least 2 kernel version on the system to ensure that you have a fallback kernel when the first one fails.

If you want to keep the only one (the latest) kernel, then you can use the command below to remove all except of one Kernel.

purge-old-kernels --keep 1 -q

Now update grub and you will get the only one kernel version installed on the system.

sudo update-grub

Remove Old Kernel Ubuntu 16.04

The Ubuntu Kernel now is upgraded to the latest version 4.11.2 from the mainline kernel build, the old kernel version has been removed from the system for freeing disk space.

  • kernel upgrade ubuntu
  • 0 Kunder som kunne bruge dette svar
Hjalp dette svar dig?

Relaterede artikler

How To Install and Use Docker on Ubuntu 16.04

Introduction Docker is an application that makes it simple and easy to run application processes...

Change Main IP of the server :: Vesta Panel

If we are changing the main IP of a server installed with Vesta panel, we can use the following...

cPanel: Apache-FastCGI Data Timeout Error

If you are using a cPanel server and have FastCGI enabled in Apache, you might be facing the...

Domainkey installer in cPanel

You can use the following cPanel script to install domainkey for an account...

Email issues :: Common Troubleshooting Steps

Here I will discuss some common errors and their solution: We are using a mail relay setup for...