How To Install The Latest Kernel Version

Reading Time: 7 minutes

In this tutorial, we will learn how to install the latest kernel version on multiple Linux distributions. 

What Is A Kernel

terminal.cli.2.20.20

First, let’s define what a kernel is defined as. The Linux kernel is basically the brain of your hardware. Its main purpose is to facilitate communications between your hardware and software. As an example, if an application needs to make a change (say switching the screen resolution of your monitor), the software submits a request to the kernel, and the kernel uses the available video driver options to modify the resolution. 

1280px-Kernel_Layout

There are five types of kernels available. They are characterized as follows:

  • Microkernel: A microkernel operates similar to the monolithic kernel, but it is fashioned to be smaller. It manages only the elementary functions like memory administration, inter-process communication, and multitasking functions.
  • Monolithic Kernel: The monolithic kernel operates many of the computer system services using the main kernel threads which occupy the same memory region.
  • Hybrid Kernel: A hybrid kernel is an architecture that is an aggregation of both the microkernel and the monolithic kernel architecture. This design adds extra code to the kernel-space to improve performance.
  • Exokernel: An exokernel is a form of OS created at MIT (Massachusetts Institute of Technology) that provides application-level administration of hardware assets.
  • Nano Kernel: The nano kernel is a microkernel that allows for hardware abstraction, but lacks control over other computer systems. This kernel is tinier than a conventional microkernel.

Now that we have a basic understanding of what kernel is and what it can do, let’s install and/or update our kernel to the latest version. We will cover the basic installation of a kernel on the following operating systems:

  • CentOS
  • Ubuntu
  • Debian
Note:
Please keep in mind that you should always take a backup of your system before any system wide changes.

Kernel installation

First, we will cover kernel installations for both CentOS 7 and a newly released version of CentOS 8. Let’s begin with CentOS 7.
(We will only be touching on the 64-bit versions today.)

CentOS 7

To begin with, we need to ensure that all of our packages are up to date. To achieve this, we will run a yum update command.

[root@host ~]# yum -y update

Next, we want to confirm that we are using CentOS 7. The output of our command will look like this.

[root@host ~]# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
root@host [~]#

After this, let’s check our current kernel version. When we run the uname command, it will return output similar to this. (the kernel version number on your system may vary from the one shown below)

[root@host ~]# uname -srv
Linux 3.10.0-1062.4.0.el7.x86_64 #1 SMP Fri Oct 18 17:15:30 UTC 2019

If we break down this output, it denotes the following information about the kernel version.

  •  Linux = this is the open-source operating system 
  •  3.10.0-1062.4.0.el7.x86_64 = this is the kernel version
  •  #1 SMP Fri Oct 18 17:15:30 UTC 2019 = this is the kernel release date

Now that we know the kernel version, we can compare it to the latest kernel versions available. We can then add the new repository to receive the latest kernel version. We will be using the ELRepo (or Enterprise Linux package) repository which supports multiple RedHat/CentOS based operating systems. We can accomplish this task using the following command.

[root@host ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

This command will only provide an output if the repository has not been previously added to your system. Next, we will run the command to install the repository.

[root@host ~]# rpm -Uvh https://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm

After this, we will verify that the repository installed correctly, and ensure that the ELRepo is included in our list of available repositories.

[root@host ~]# yum repolist
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
 * base: mirrors.liquidweb.com
 * elrepo: ord.mirror.rackspace.com
 * epel: mirrors.liquidweb.com
 * extras: ftpmirror.your.org
 * remi: mirror.pit.teraswitch.com
 * remi-php56: mirror.pit.teraswitch.com
 * remi-safe: mirror.pit.teraswitch.com
 * updates: mirror.tzulo.com
repo id repo name status
base/7/x86_64 CentOS-7 - Base 10,097
bintray--ookla-rhel bintray--ookla-rhel 5
elrepo                                                                 ELRepo.org Community Enterprise Linux Repository - el7 129
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13,188
extras/7/x86_64 CentOS-7 - Extras 323
remi Remi's RPM repository for Enterprise Linux 7 - x86_64 6,024
remi-php56 Remi's PHP 5.6 RPM repository for Enterprise Linux 7 - x86_64 441
remi-safe Safe Remi's RPM repository for Enterprise Linux 7 - x86_64 3,676
updates/7/x86_64 CentOS-7 - Updates 1,446
repolist: 35,329

We can see that the ELRepo is indeed included in our list. The only thing we have left to do is to install the new kernel version. We can deploy the new kernel with the following command.

[root@host ~]# yum --enablerepo=elrepo-kernel install kernel-ml

The “ml” addition stands for “mainline stable” and this indicates that the kernel is installed from the stable branch of kernel archives. You can check your kernel version again, and it will be on the latest version available.  Now when we run the uname command, our output will look like this.

[root@host ~]# uname -srv
Package kernel-ml-5.5.4-1.el7.elrepo.x86_64 installed 
kernel.red.2.20.20
Photo by Michael Dziedzic on Unsplash

CentOS 8

We can follow the same steps we used for CentOS 7 above until we reach the repository installation step.

[root@host ~]# yum -y update
[root@host ~]# cat /etc/redhat-release
[root@host ~]# uname -srv
[root@host ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

After we add the RPM-GPG-KEY using the rpm –import command for the ELRepo repository, we will run the following dnf command to add the repository. 

[root@host ~]# dnf install https://www.elrepo.org/elrepo-release-8.0-2.el8.elrepo.noarch.rpm

During the installation, we will be prompted to select ‘y’ or “n’, to accept the deployment. Type ‘y’ and the kernel will be installed. The output will look like this.

Installed:
  elrepo-release-8.0-2.el8.elrepo.noarch

Next, we will check the list of installed repositories using our dnf command.

[root@host ~]# dnf repolist
Last metadata expiration check: 0:02:47 ago on Mon 17 Feb 2020 07:00:54 AM EST.
repo id repo name status
AppStream CentOS-8 - AppStream 5,093
BaseOS CentOS-8 - Base 2,080
elrepo ELRepo.org Community Enterprise Linux Repository - el8 69
extras CentOS-8 - Extras 3

After verifying the ELRepo is installed, we are ready to update to the latest kernel version.

[root@host ~]# dnf --enablerepo=elrepo-kernel install kernel-ml

Installed:

  kernel-ml-5.5.4-1.el8.elrepo.x86_64 kernel-ml-modules-5.5.4-1.el8.elrepo.x86_64 kernel-ml-core-5.5.4-1.el8.elrepo.x86_64

And that’s it! You now know how to upgrade the kernel on both CentOS 7 & CentOS 8.

kernel.blue.2.20.20
Photo by Michael Dziedzic on Unsplash

Ubuntu 18

First, we will run the following command to ensure our system is up to date. This command will update all repositories on our system.

root@ubuntu:~# apt update

Next, we will run the apt upgrade command to upgrade all packages that are currently installed.

Next, we will run the apt upgrade command to upgrade all packages that are currently installed. 

Now we can verify which kernel version we are currently running using the uname command. 

root@ubuntu:~# uname -msr
Linux 4.4.0-78-generic x86_64

Next, we will need to create a directory to temporarily store the latest mainline kernel version. Now, we will create the directory with the following command.

root@ubuntu:~# mkdir -p ~/4.15.0

Next, lets cd into the new folder we just created.

root@ubuntu:~# cd ~/4.15.0

Now we can download the latest generic kernel version using wget command. Here is where you can find the latest Kernel PPA versions for ubuntu. The command we will use to download a kernel will look like this.

root@ubuntu:~/4.15.0# wget https://kernel.ubuntu.com/~kernel-ppa/mainline/drm-intel-nightly/current/linux-headers-5.6.0-994_5.6.0-994.202002162102_all.deb
Note:
This is just example. You should download kernel version that you require.

Then, we can install the downloaded kernel package using the dpkg I command.

root@ubuntu:~/4.15.0# dpkg -i *.deb

Finally, all you need to do is to run the update-grub command and reboot your system.


root@ubuntu:~/4.15.0# update-grub
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.15.0-88-generic
Found initrd image: /boot/initrd.img-4.15.0-88-generic
Found linux image: /boot/vmlinuz-4.15.0-70-generic
Found initrd image: /boot/initrd.img-4.15.0-70-generic
Found linux image: /boot/vmlinuz-4.15.0-66-generic
Found initrd image: /boot/initrd.img-4.15.0-66-generic
Found linux image: /boot/vmlinuz-4.15.0-13-generic
Found initrd image: /boot/initrd.img-4.15.0-13-generic
Found linux image: /boot/vmlinuz-4.11.2-041102-generic
Found initrd image: /boot/initrd.img-4.11.2-041102-generic
done

root@ubuntu:~/4.15.0# reboot

And that’s it! The Ubuntu kernel has been upgraded.

kernel1.2.20.20

Debian 10 (Buster)

Initially, we will check what our currently installed kernel version is.

root@host:/# uname -r
4.19.0-6-amd64

Next, we will ensure that all of our packages are updated.

root@host:/# aptitude update

Then, we need to search for any available kernels using this command.

root@host:/# aptitude search linux-image

The output will provide us with a rather lengthy list of available kernels.

linux-image-unsigned-5.3.0-1010-azure - Linux kernel image for version 5.3.0 on 64 bit x86 SMP
linux-image-unsigned-5.3.0-1011-gcp - Linux kernel image for version 5.3.0 on 64 bit x86 SMP
linux-image-unsigned-5.3.0-1012-azure - Linux kernel image for version 5.3.0 on 64 bit x86 SMP
linux-image-unsigned-5.3.0-1012-gcp - Linux kernel image for version 5.3.0 on 64 bit x86 SMP
linux-image-unsigned-5.3.0-1013-azure - Linux kernel image for version 5.3.0 on 64 bit x86 SMP
linux-image-unsigned-5.3.0-29-generic - Linux kernel image for version 5.3.0 on 64 bit x86 SMP
linux-image-unsigned-5.3.0-29-lowlatency - Linux kernel image for version 5.3.0 on 64 bit x86 SMP
linux-image-unsigned-5.3.0-40-generic - Linux kernel image for version 5.3.0 on 64 bit x86 SMP
linux-image-unsigned-5.3.0-40-lowlatency - Linux kernel image for version 5.3.0 on 64 bit x86 SMP
linux-modules-nvidia-390-5.3.0-1010-aws - Linux kernel nvidia modules for version 5.3.0-1010
linux-modules-nvidia-390-5.3.0-1010-azure - Linux kernel nvidia modules for version 5.3.0-1010
linux-modules-nvidia-390-5.3.0-1011-aws - Linux kernel nvidia modules for version 5.3.0-1011
linux-modules-nvidia-390-5.3.0-1011-gcp - Linux kernel nvidia modules for version 5.3.0-1011
linux-modules-nvidia-390-5.3.0-1012-azure - Linux kernel nvidia modules for version 5.3.0-1012
linux-modules-nvidia-390-5.3.0-1012-gcp - Linux kernel nvidia modules for version 5.3.0-1012
linux-modules-nvidia-390-5.3.0-1013-azure - Linux kernel nvidia modules for version 5.3.0-1013
linux-modules-nvidia-435-5.3.0-26-generic - Linux kernel nvidia modules for version 5.3.0-26
linux-modules-nvidia-435-5.3.0-26-lowlatency - Linux kernel nvidia modules for version 5.3.0-26
linux-modules-nvidia-435-5.3.0-29-generic - Linux kernel nvidia modules for version 5.3.0-29
linux-modules-nvidia-435-5.3.0-29-lowlatency - Linux kernel nvidia modules for version 5.3.0-29
linux-modules-nvidia-435-5.3.0-40-generic - Linux kernel nvidia modules for version 5.3.0-40
linux-modules-nvidia-435-5.3.0-40-lowlatency - Linux kernel nvidia modules for version 5.3.0-40
linux-image-5.0.0-1025-oem-osp1 - Signed kernel image oem-osp1
linux-image-5.0.0-1030-oem-osp1 - Signed kernel image oem-osp1
linux-image-5.0.0-1033-oem-osp1 - Signed kernel image oem-osp1
linux-image-5.0.0-1037-oem-osp1 - Signed kernel image oem-osp1
linux-image-oem-osp1 - OEM OSP1 Linux kernel image
linux-image-unsigned-5.0.0-1025-oem-osp1 - Linux kernel image for version 5.0.0 on 64 bit x86 SMP
linux-image-unsigned-5.0.0-1030-oem-osp1 - Linux kernel image for version 5.0.0 on 64 bit x86 SMP
linux-image-unsigned-5.0.0-1033-oem-osp1 - Linux kernel image for version 5.0.0 on 64 bit x86 SMP
linux-image-unsigned-5.0.0-1037-oem-osp1 - Linux kernel image for version 5.0.0 on 64 bit x86 SMP

We can further narrow our command line output by utilizing the grep command to limit the output to a specific set of kernel versions. 

root@host:/# aptitude search linux-image | grep 4.15
linux-image-4.15.0-1050-oem - Signed kernel image oem
linux-image-unsigned-4.15.0-1050-oem - Linux kernel image for version 4.15.0 on 64 bit x86 SMP
linux-image-4.15.0-1059-oem - Signed kernel image oem
linux-image-4.15.0-1065-oem - Signed kernel image oem
linux-image-4.15.0-1066-oem - Signed kernel image oem
linux-image-4.15.0-1067-oem - Signed kernel image oem
linux-image-unsigned-4.15.0-1059-oem - Linux kernel image for version 4.15.0 on 64 bit x86 SMP
linux-image-unsigned-4.15.0-1065-oem - Linux kernel image for version 4.15.0 on 64 bit x86 SMP
linux-image-unsigned-4.15.0-1066-oem - Linux kernel image for version 4.15.0 on 64 bit x86 SMP
linux-image-unsigned-4.15.0-1067-oem - Linux kernel image for version 4.15.0 on 64 bit x86 SMP

Now, we can choose the latest kernel version or a specific version that we want to install. Once a kernel package has been selected, run this command to install it.

root@host:/# aptitude install linux-image-4.15.0-1059-oem
Note:
This is just example kernel version we installed to demonstrate the command.

And that’s it! We are done. The kernel version of your choice has been installed on your Debian system.

Care To Join Us? See If You Qualify!

Liquid Web offers a wide selection of plans and products that can accommodate all of your hosting needs! Our clients can also choose from an extensive array of additional hosting options, and other select opportunities that can definitely address any needs or concerns. We pride ourselves on being “The Most Helpful Humans In Hosting®” and our clients agree!

Author Bio

About the Author: Dean Conally

I am Linux enthusiast and console gamer, dog lover and amateur photograph. I've been working at Liquidweb for a bit less than two years. Always looking for knowledge to expand my expertise, thus tackling new technologies and solutions one day at the time.

Refer a friend and get hosting credit!