How to install Linux Kernel 5.x on CentOS 8

You can support us by downloading this article in PDF format through the following link.

Download the guide in PDF format

turn off


CentOS 8 operation comes with a custom kernel to ensure its integrity and compatibility with supported hardware. The kernel version included in CentOS 8 Linux is 4.18. The Linux kernel includes the basic kernel itself and many kernel modules.

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

  1. Process management: Determine which processes can use the central processing unit (CPU), when to use it and how long it will last
  2. Memory management: Keep track of how much memory is used for storage and where
  3. Device driver: Act as an intermediary/interpreter between hardware and process
  4. System calls and security: Receive service request from process

If you are a novice and want to install the latest version of the Linux kernel, this guide is for you. The list of kernel-related packages available for CentOS is as follows:

  • core: This package contains cores for single-core, multi-core and multi-processor systems
  • Kernel development : Contains the kernel header file and makefile for installing the kernel module of the installed kernel version.
  • Kernel header: This package includes C header files that facilitate the interface connection between the Linux kernel and user space libraries and programs.
  • Kernel tools: Contains tools and supporting documentation for manipulating the Linux kernel.
  • Performance: This package contains performance Tools that can monitor the performance of the Linux kernel.
  • linux firmware: Contains firmware files required for the operation of various devices.

Install Linux Kernel 5.x on CentOS 8

A common standard method for installing the latest kernel on CentOS is to build from source code. In this guide, I will introduce you to ELRepo, which provides RPM packages.

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

Step 1: Add ELRepo to CentOS 8

Add the ELRepo repository to the CentOS 8 system by running the following command.

sudo dnf -y install

The installer will create a repository file in the /etc/yum.repos.d directory.

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

Step 2: Import GPG key

After adding the repository 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 an elrepo-kernel channel that can provide long-term (Kernel) Support kernel and latest stable mainline kernel (Kernel-ml) (Applicable to CentOS and RHEL Linux systems).

We can list the mainline kernel versions 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 will install the Linux kernel module as a 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 the availability of Linux Kernel 5.x, we can continue to install it.

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

Install other kernel packages

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

Step 4: Boot to Linux Kernel 5.4 on CentOS 8

After installing Linux Kernel 5.4 on CentOS 8, you need to restart the system.

sudo reboot

Select kernel 5.x in the grub menu.

After the operating system starts, run the uname command to confirm the kernel version that the operating system is running.

$ 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

Many of you need to take further measures to confirm that all OS functions are operating as expected.

Uninstall Kernel 5.x on CentOS 8

You can use the dnf command to remove Linux Kernel 5.x from the CentOS 8 computer at any time.

First boot to the default operating system version of the Linux kernel.

How to install Linux Kernel 5.x on CentOS 8

Confirm the active kernel.

$ uname -r

Then remove the installed Kernel 5.x 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 systems, please 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:

The top terminal-based monitoring tool for Linux

Use kubeadm to install Kubernetes cluster on CentOS 7

Configure Open vSwitch on CentOS | RHEL | Fedora

broot-An easy way to view and navigate the directory tree in Linux

You can support us by downloading this article in PDF format through the following link.

Download the guide in PDF format

turn off