The kernel is the core and most essential component of Linux operating systems. It provides an interface between software applications and computer hardware. It manages I/O disks, filesystems, CPU, and processes. The kernel is responsible for managing resources as efficiently as possible. The community of kernel Developers builds and deploys patches and updates to the Linux kernel to roll out security updates, bug fixes, and new functionality. If you are using a Linux operating system, updating the kernel to the latest version is a good idea.

This post will show you how to install the latest Linux kernel on Ubuntu 20.04.

Step 1 – Update and Upgrade the System

First, check your current operating system using the following command:

lsb_release -a

You will get your operating system version in the following output:

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.3 LTS
Release:	20.04
Codename:	focal

Next, install the required dependencies with the following command:

apt-get install gnupg2 wget -y

Next, update and upgrade all system packages to the latest version.

apt-get update -y
apt-get upgrade -y

Once all the packages are upgraded, restart your system to apply the changes:

reboot

Step 2 – Check the Current Kernel Version

Next, check the currently installed kernel version with the following command:

uname -r

You will get the current kernel version in the following output:

5.15.0-33-generic

Step 3 – Download the Linux Kernel Installation Script

Next, download the Linux kernel installation script on your system. This script will allow us to install the latest kernel on Linux.

You can download it using the wget command:

wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh

Once the download is complete, you will get the following output:

--2022-04-13 15:35:52--  https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.109.133, 185.199.111.133, 185.199.110.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.109.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 26474 (26K) [text/plain]
Saving to: ‘ubuntu-mainline-kernel.sh’

ubuntu-mainline-kernel.sh           100%[=================================================================>]  25.85K  --.-KB/s    in 0.001s  

2022-04-13 15:35:52 (26.9 MB/s) - ‘ubuntu-mainline-kernel.sh’ saved [26474/26474]

Next, set the execution permissions to the downloaded script with the following command:

chmod +x ubuntu-mainline-kernel.sh

Step 4 – Install the Latest Kernel Version

First, list all available kernel versions using the following command:

./ubuntu-mainline-kernel.sh -r

You will see all kernel versions in the following output:

v6.2.5		v6.2.6		v6.2.7		v6.2.8		v6.2.9		v6.2.10		v6.2.11		v6.2.12		v6.2.13		v6.2.14
v6.2.15		v6.2.16		v6.3.0		v6.3.1		v6.3.2		v6.3.3		v6.3.4		v6.3.5		v6.3.6		v6.3.7
v6.3.8		v6.3.9		v6.3.10		v6.3.11		v6.3.12		v6.3.13		v6.4.0		v6.4.1		v6.4.2		v6.4.3
v6.4.4		v6.4.5		v6.4.6		v6.4.7		v6.4.8		v6.4.9		v6.4.10		v6.4.11		v6.4.12		v6.4.13
v6.4.14		v6.4.15		v6.4.16		v6.5.0		v6.5.1		v6.5.2		v6.5.3		v6.5.4		v6.5.5		v6.5.6
v6.5.7		v6.5.8		v6.5.9		v6.5.10		v6.5.11		v6.5.12		v6.6.0		v6.6.1		v6.6.2

Next, run the Linux kernel installation script followed by your kernel version to install the specified kernel on your system.

./ubuntu-mainline-kernel.sh -i v6.2.0

You will see the following output:

Downloading amd64/CHECKSUMS: 100%   
Downloading amd64/CHECKSUMS.gpg: 100%   
Importing kernel-ppa gpg key ok
Signature of checksum file has been successfully verified
Checksums of deb files have been successfully verified with sha256sum
Installing 4 packages
Cleaning up work folder

Step 5 – Restart the System

After the latest kernel installation, you must restart your system to boot the system from the newly installed kernel.

reboot

Also Read

How to Use Rsync to Copy/Sync Files Between Servers

Step 6 – Verify the Latest Kernel Version

After the successful restart, run the following command to check the newly installed kernel version:

uname -r

You should see the following output:

6.2.0-060200-generic

Conclusion

In this post, we explained how to install the latest Kernel version on Ubuntu 20.04. You can now easily upgrade or install the latest Kernel version to your server. Try it on dedicated hosting from Atlantic.Net!