The RHEL 8 based operating ships with a custom-built kernel to ensure its integrity and compatibility with supported hardware. The version of Kernel shipped in RHEL 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.17 on CentOS 8|Rocky Linux 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|Rocky Linux 8

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

sudo dnf -y install https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm

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 https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

Step 3: Install Linux Kernel 5.17 on CentOS 8|Rocky Linux 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

Sample output:

kernel-ml.x86_64                        5.17.1-1.el8.elrepo        elrepo-kernel
kernel-ml-core.x86_64                   5.17.1-1.el8.elrepo        elrepo-kernel
kernel-ml-devel.x86_64                  5.17.1-1.el8.elrepo        elrepo-kernel
kernel-ml-doc.noarch                    5.17.1-1.el8.elrepo        elrepo-kernel
kernel-ml-headers.x86_64                5.17.1-1.el8.elrepo        elrepo-kernel
kernel-ml-modules.x86_64                5.17.1-1.el8.elrepo        elrepo-kernel
kernel-ml-modules-extra.x86_64          5.17.1-1.el8.elrepo        elrepo-kernel
kernel-ml-tools.x86_64                  5.17.1-1.el8.elrepo        elrepo-kernel
kernel-ml-tools-libs.x86_64             5.17.1-1.el8.elrepo        elrepo-kernel
kernel-ml-tools-libs-devel.x86_64       5.17.1-1.el8.elrepo        elrepo-kernel

For long term releases

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

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

# Install mainline kernels
sudo dnf --enablerepo=elrepo-kernel install kernel-ml
sudo dnf --enablerepo=elrepo-kernel install kernel-ml-{devel,headers}

# Install long term kernels
sudo dnf --enablerepo=elrepo-kernel install kernel-lt
sudo dnf --enablerepo=elrepo-kernel install kernel-lt-{devel,headers}

This installs Linux kernel modules as dependency.

Dependencies resolved.
======================================================================================================================================================================================================
 Package                                         Architecture                         Version                                                       Repository                                   Size
======================================================================================================================================================================================================
Installing:
 kernel-ml                                       x86_64                               5.17.1-1.el8.elrepo                                           elrepo-kernel                                82 k
Installing dependencies:
 kernel-ml-core                                  x86_64                               5.17.1-1.el8.elrepo                                           elrepo-kernel                                33 M
 kernel-ml-modules                               x86_64                               5.17.1-1.el8.elrepo                                           elrepo-kernel                                27 M
 linux-firmware                                  noarch                               20210702-104.gitd79c2677.el8_5                                baseos                                      161 M

Transaction Summary
======================================================================================================================================================================================================
Install  4 Packages

Total download size: 221 M
Installed size: 612 M
Is this ok [y/N]: y

Install Additional Kernel packages

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

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

Step 4: Boot to Linux Kernel 5.17 on CentOS 8|Rocky Linux 8

After the installation of Linux Kernel 5.17 you’ll need to reboot the system.

sudo reboot

Choose kernel 5.x in the grub menu.

linux kernel 5.17 centos rocky

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

$ uname -a
Linux cent01 5.17.1-1.el8.elrepo.x86_64 #1 SMP PREEMPT Mon Mar 28 09:38:10 EDT 2022 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|Rocky Linux 8

You can remove Linux Kernel 5.x from your CentOS 8|Rocky Linux 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
4.18.0-80.el8.x86_64

Then remove Kernel 5.x installed from ELRepo.

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

Confirm removal.

.....
Dependencies resolved.
========================================================================================================================================================
Remove  22 Packages

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

For Ubuntu and Linux Mint system, check:

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

More Linux guides:

LEAVE A REPLY

Please enter your comment!
Please enter your name here