The CentOS 8 operating ships with a custom-built kernel to ensure its integrity and compatibility with supported hardware. The version of Kernel shipped in CentOS 8 Linux is 4.18. A Linux kernel comprises of the base kernel itself and a number of kernel modules.

The Linux kernel is the main component of a Linux operating system (OS) and is the core interface between a computer’s hardware and its processes. It has the following main functions:

  1. Process management: Determine which processes can use the central processing unit (CPU), when, and for how long
  2. Memory management: Keep track of how much memory is used to store what, and where
  3. Device drivers: Act as mediator/interpreter between the hardware and processes
  4. System calls and security: Receive requests for service from the processes

If you’re a bleeding edge person and would like to install the latest release of Linux kernel then this guide is for you. The list of Kernel related Packages available for CentOS are:

  • kernel: This package contains the kernel for single-core, multi-core, and multi-processor systems
  • kernel-devel : This contains kernel headers and makefiles used to build kernel modules against installed Kernel version.
  • kernel-headers: This package includes the C header files that powers interfacing between the Linux kernel and user-space libraries and programs.
  • kernel-tools: Contains tools for manipulating the Linux kernel and supporting documentation.
  • perf: This package contains the perf tool, which enables performance monitoring of the Linux kernel.
  • linux-firmware: This contains the firmware files required by various devices to operate.

Install Linux Kernel 5.x on CentOS 8

The common standard way of installing latest Kernel on CentOS is by building from source. In this guide I’ll introduce you to ELRepo which provides RPM packages.

ELRepo is an RPM repository for Enterprise Linux packages. It supports Red Hat Enterprise Linux (RHEL) and its derivatives such as Scientific Linux, CentOS e.t.c.

Step 1: Add ELRepo to CentOS 8

Add ELRepo repository to your CentOS 8 system by running the commands below.

sudo dnf -y install

A repository file will be created by the installer under the /etc/yum.repos.d directory.

$ cat /etc/yum.repos.d/elrepo.repo

Step 2: Import GPG Key

With the repository added to the system you can import the public key:

sudo rpm --import

Step 3: Install Linux Kernel 5.4 on CentOS 8

The repository we added has the elrepo-kernel channel which provides both the long-term(kernel-lt) support kernels and latest stable mainline kernels(kernel-ml) for CentOS and RHEL Linux systems.

We can list the mainline Kernel releases available in the repository:

$ sudo dnf --disablerepo="*" --enablerepo="elrepo-kernel" list available | grep kernel-ml
kernel-ml.x86_64                         5.7.4-1.el8.elrepo        elrepo-kernel
kernel-ml-core.x86_64                    5.7.4-1.el8.elrepo        elrepo-kernel
kernel-ml-devel.x86_64                   5.7.4-1.el8.elrepo        elrepo-kernel
kernel-ml-doc.noarch                     5.7.4-1.el8.elrepo        elrepo-kernel
kernel-ml-headers.x86_64                 5.7.4-1.el8.elrepo        elrepo-kernel
kernel-ml-modules.x86_64                 5.7.4-1.el8.elrepo        elrepo-kernel
kernel-ml-modules-extra.x86_64           5.7.4-1.el8.elrepo        elrepo-kernel
kernel-ml-tools.x86_64                   5.7.4-1.el8.elrepo        elrepo-kernel
kernel-ml-tools-libs.x86_64              5.7.4-1.el8.elrepo        elrepo-kernel
kernel-ml-tools-libs-devel.x86_64        5.7.4-1.el8.elrepo        elrepo-kernel

This installs Linux kernel modules as dependency.

Dependencies resolved.
 Package                                Arch                        Version                                    Repository                          Size
 kernel-ml                              x86_64                      5.7.4-1.el8.elrepo                         elrepo-kernel                       32 k
Installing dependencies:
 kernel-ml-modules                      x86_64                      5.7.4-1.el8.elrepo                         elrepo-kernel                       23 M
 kernel-ml-core                         x86_64                      5.7.4-1.el8.elrepo                         elrepo-kernel                       28 M

Transaction Summary
Install  3 Packages

Total download size: 51 M
Installed size: 87 M
Is this ok [y/N]: y

Now that we have confirmed availability of Linux Kernel 5.x, we can proceed to install it.

sudo dnf --enablerepo=elrepo-kernel install kernel-ml

Install Additional Kernel packages

sudo dnf --enablerepo=elrepo-kernel install kernel-ml-{devel,headers}

Step 4: Boot to Linux Kernel 5.4 on CentOS 8

After the installation of Linux Kernel 5.4 on CentOS 8 you’ll need to reboot the system.

sudo reboot

Choose kernel 5.x in the grub menu.

install kernel 5 centos 8

After OS has booted run uname command to confirm the Kernel version the OS is running on.

$ uname -a
Linux cent01 5.7.4-1.el8.elrepo.x86_64 #1 SMP Thu Jun 18 10:07:20 EDT 2020 x86_64 x86_64 x86_64 GNU/Linux

You many need to take further actions in confirming all OS functions are operational as expected.

Uninstall Kernel 5.x on CentOS 8

You can remove Linux Kernel 5.x from your CentOS 8 Machine at any time using dnf command.

First boot to the default OS version of Linux Kernel.

install kernel 5 centos 8 02

Confirm active Kernel.

$ uname -r

Then remove Kernel 5.x installed from ELRepo.

sudo dnf remove kernel-ml kernel-ml-{devel,headers}

Confirm removal.

Dependencies resolved.
 Package                                    Arch                       Version                                 Repository                          Size
 kernel-ml                                  x86_64                     5.7.4-1.el8.elrepo                      @elrepo-kernel                       0  
 kernel-ml-devel                            x86_64                     5.7.4-1.el8.elrepo                      @elrepo-kernel                      50 M
 kernel-ml-headers                          x86_64                     5.7.4-1.el8.elrepo                      @elrepo-kernel                     5.0 M
Removing unused dependencies:
 kernel-ml-core                             x86_64                     5.7.4-1.el8.elrepo                      @elrepo-kernel                      64 M
 kernel-ml-modules                          x86_64                     5.7.4-1.el8.elrepo                      @elrepo-kernel                      23 M
 perl-Carp                                  noarch                     1.42-396.el8                            @BaseOS                             41 k
 perl-Errno                                 x86_64                     1.28-416.el8                            @BaseOS                            9.3 k
 perl-Exporter                              noarch                     5.72-396.el8                            @BaseOS                             54 k
 perl-File-Path                             noarch                     2.15-2.el8                              @BaseOS                             63 k
 perl-IO                                    x86_64                     1.38-416.el8                            @BaseOS                            137 k
 perl-PathTools                             x86_64                     3.74-1.el8                              @BaseOS                            179 k
 perl-Scalar-List-Utils                     x86_64                     3:1.49-2.el8                            @BaseOS                            122 k
 perl-Socket                                x86_64                     4:2.027-3.el8                           @BaseOS                            124 k
 perl-Text-Tabs+Wrap                        noarch                     2013.0523-395.el8                       @BaseOS                             24 k
 perl-Unicode-Normalize                     x86_64                     1.25-396.el8                            @BaseOS                            623 k
 perl-constant                              noarch                     1.33-396.el8                            @BaseOS                             26 k
 perl-interpreter                           x86_64                     4:5.26.3-416.el8                        @BaseOS                             14 M
 perl-libs                                  x86_64                     4:5.26.3-416.el8                        @BaseOS                            5.8 M
 perl-macros                                x86_64                     4:5.26.3-416.el8                        @BaseOS                            5.1 k
 perl-parent                                noarch                     1:0.237-1.el8                           @BaseOS                            9.0 k
 perl-threads                               x86_64                     1:2.21-2.el8                            @BaseOS                            107 k
 perl-threads-shared                        x86_64                     1.58-2.el8                              @BaseOS                             76 k

Transaction Summary
Remove  22 Packages

Freed space: 163 M
Is this ok [y/N]: y

For Ubuntu and Linux Mint system, check:

How to Install Linux Kernel 5.x on Ubuntu / Linux Mint

CentOS 7: How To Install Linux Kernel 5.x on CentOS 7

More Linux guides:

Top Terminal Based Monitoring Tools for Linux

Install Kubernetes Cluster on CentOS 7 with kubeadm

Configuring Open vSwitch on CentOS | RHEL | Fedora

broot – Easy way to see and navigate directory trees in Linux

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here