Latest news from 5wire Networks

How To Install Linux Kernel 5.x on Almalinux 8 or Rocky

By default both AlmaLinux and Rocky Linux 8.x come packaged with Linux Kernel 4.x, whereas the latest stable long term was 5.4 and stable mainline kernels 5.18. This guide will show you how to install/upgrade the current kernel version to the latest one.

Upgrade Kernel to 5.x on Almalinux 8 or Rocky

Step 1: Check Current Kernel Version

Let’s check what current version of your system Linux is running to make sure you are not using the latest Kernel. Run the following command –

uname -r

If Kernel 4 is running, you will see something like the below –


Step 2: Add ELRepo Repository to Almalinux

The packages to install the latest stable kernels are available in the ELPrepo. First, we will need to add that first on our Rocky or AlmaLinux.

Import the ELRepo’s GPG key, which will help our system to ensure whatever packages we get on our system will be verified and have not been altered somehow.

sudo rpm --import

Use the DNF package manager to install the ELrepo enterprise packages repository on AlmaLinux or Rocky.

sudo dnf install -y

Step 3: Run system update

Once the repository is added, run the system update command get the latest updates for installed packages and refresh the repository cache.

sudo dnf update

Step 4: List Kernels versions available to install

Let’s check the new kernel updates available to install.

They will be in two categories;

  1. Long-term kernel – called kernel
  2. Stable mainline kernel – represented as kernel-ml.

You can install any of them. In this guide, we will install kernel-ml.

To see the available versions, run the following command – 

dnf list available --disablerepo='*' --enablerepo=elrepo-kernel

The output will be like this: Community Enterprise Linux Kernel Re 3.9 MB/s | 2.1 MB 00:00
Last metadata expiration check: 0:00:01 ago on Tue 26 Jul 2022 08:27:43 BST.
Available Packages
bpftool.x86_64 5.18.14-1.el8.elrepo elrepo-kernel
kernel-lt.x86_64 5.4.207-1.el8.elrepo elrepo-kernel
kernel-lt-core.x86_64 5.4.207-1.el8.elrepo elrepo-kernel
kernel-lt-devel.x86_64 5.4.207-1.el8.elrepo elrepo-kernel
kernel-lt-doc.noarch 5.4.207-1.el8.elrepo elrepo-kernel
kernel-lt-headers.x86_64 5.4.207-1.el8.elrepo elrepo-kernel
kernel-lt-modules.x86_64 5.4.207-1.el8.elrepo elrepo-kernel
kernel-lt-modules-extra.x86_64 5.4.207-1.el8.elrepo elrepo-kernel
kernel-lt-tools.x86_64 5.4.207-1.el8.elrepo elrepo-kernel
kernel-lt-tools-libs.x86_64 5.4.207-1.el8.elrepo elrepo-kernel
kernel-lt-tools-libs-devel.x86_64 5.4.207-1.el8.elrepo elrepo-kernel
kernel-ml.x86_64 5.18.14-1.el8.elrepo elrepo-kernel
kernel-ml-core.x86_64 5.18.14-1.el8.elrepo elrepo-kernel
kernel-ml-devel.x86_64 5.18.14-1.el8.elrepo elrepo-kernel
kernel-ml-doc.noarch 5.18.14-1.el8.elrepo elrepo-kernel
kernel-ml-headers.x86_64 5.18.14-1.el8.elrepo elrepo-kernel
kernel-ml-modules.x86_64 5.18.14-1.el8.elrepo elrepo-kernel
kernel-ml-modules-extra.x86_64 5.18.14-1.el8.elrepo elrepo-kernel
kernel-ml-tools.x86_64 5.18.14-1.el8.elrepo elrepo-kernel
kernel-ml-tools-libs.x86_64 5.18.14-1.el8.elrepo elrepo-kernel
kernel-ml-tools-libs-devel.x86_64 5.18.14-1.el8.elrepo elrepo-kernel
perf.x86_64 5.18.14-1.el8.elrepo elrepo-kernel
python3-perf.x86_64 5.18.14-1.el8.elrepo elrepo-kernel

Step 5: Command to Install Kernel 5.x on AlmaLinux or Rocky 8

From the above command, we can now see what versions are available to install. Kernel-ML is 5.18, and Kernel-LT is 5.4.

To install any of the latest version runs:

For latest stable mainline

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

For latest Long term

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

Step 6: Reboot Your System

Once the install is completed, to apply the changes you need to rebot the system. On boot, you will see on the GRUB menu screen the newly installed Kernel 5.x has been selected by default.

You can either press Enter, or wait for the countdown to complete. 
Redhat enterprise Linux latest Kernel version 5

Whent he system boots, you can check the Kernel version by typing

uname -r

Uninstall Kernel 5.x on Almalinux or Rocky 8

Although there is no need to remove the latest added kernel, you can choose previous ones from the Grub Boot menu if you want to use them. However, in case you really want to remove then use the below commands:

Reboot your Linux system and select the default 4.x kernel of your system. When the system boots, in the terminal run –

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

For the Long term version run the following –

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


Life time discount when you purchase your first order. Applies to Web Hosting, Reseller Hosting, and Cloud Servers.

Free Domain included on yearly Web Hosting plans.

Use code WEBOFF at the checkout!

Terms and Conditions apply. Voucher code is only valid for new customers.