How To Upgrade Linux Kernel on AlmaLinux 8

In this tutorial, we want to teach you How To Upgrade or Update your Linux Kernel on AlmaLinux 8.

The Linux kernel is the central (core) component of the Linux operating system. Its responsibilities include managing the system’s resources and the communication between hardware and software components. It also maintains the security of your system.

In this tutorial, you will learn how to upgrade to the latest Linux Kernel on AlmaLinux 8 using ELRepo.

Steps To Upgrade Linux Kernel on AlmaLinux 8

To complete this guide, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide the Initial Server Setup with AlmaLinux 8.

Check the Current Linux Kernel Version on AlmaLinux

The first step is to check the version of your kernel. To do this, you can use the following command:

uname -msr

In your output you will see:

Linux 4.18.0-372.9.1.el8.x86_64 x86_64

Then, use the following command to update your AlmaLinux repository:

sudo dnf -y update

Add ELRepo Repository on AlmaLinux 8

To update the kernel on AlmaLinux, you’ll need to install a third-party repository called ElRepo. ElRepo offers the latest kernel version available from

First, import the ElRepo GPG key with the following command:

sudo rpm --import

Fix error: db5 error(-30969) from dbenv

Note: While running this command, if you get an error like this:

error: db5 error(-30969) from dbenv->open: BDB0091 DB_VERSION_MISMATCH: Database environment version mismatch

You can fix it by running the commands below:

# sudo dnf upgrade --refresh rpm glibc
# sudo rm /var/lib/rpm/.rpm.lock
# sudo dnf upgrade dnf

After that rerun the command, and it runs correctly.

Then, run the command below to add and install the ElRepo on AlmaLinux 8:

sudo dnf install

When you are finished, you will get the following output:

Running transaction
  Preparing        :                                                        1/1
  Installing       : elrepo-release-8.3-1.el8.elrepo.noarch                 1/1
  Verifying        : elrepo-release-8.3-1.el8.elrepo.noarch                 1/1



List Available Kernels on AlmaLinux 8

At this point, you can check for the available kernels on your server. To do this, run the command below:

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

In your output you will see the following:

Available Packages
bpftool.x86_64                          6.0.5-1.el8.elrepo         elrepo-kernel
kernel-lt.x86_64                        5.4.220-1.el8.elrepo       elrepo-kernel
kernel-lt-core.x86_64                   5.4.220-1.el8.elrepo       elrepo-kernel
kernel-lt-devel.x86_64                  5.4.220-1.el8.elrepo       elrepo-kernel
kernel-lt-doc.noarch                    5.4.220-1.el8.elrepo       elrepo-kernel
kernel-lt-headers.x86_64                5.4.220-1.el8.elrepo       elrepo-kernel
kernel-lt-modules.x86_64                5.4.220-1.el8.elrepo       elrepo-kernel
kernel-lt-modules-extra.x86_64          5.4.220-1.el8.elrepo       elrepo-kernel
kernel-lt-tools.x86_64                  5.4.220-1.el8.elrepo       elrepo-kernel
kernel-lt-tools-libs.x86_64             5.4.220-1.el8.elrepo       elrepo-kernel
kernel-lt-tools-libs-devel.x86_64       5.4.220-1.el8.elrepo       elrepo-kernel
kernel-ml.x86_64                        6.0.5-1.el8.elrepo         elrepo-kernel
kernel-ml-core.x86_64                   6.0.5-1.el8.elrepo         elrepo-kernel
kernel-ml-devel.x86_64                  6.0.5-1.el8.elrepo         elrepo-kernel
kernel-ml-doc.noarch                    6.0.5-1.el8.elrepo         elrepo-kernel
kernel-ml-headers.x86_64                6.0.5-1.el8.elrepo         elrepo-kernel
kernel-ml-modules.x86_64                6.0.5-1.el8.elrepo         elrepo-kernel
kernel-ml-modules-extra.x86_64          6.0.5-1.el8.elrepo         elrepo-kernel
kernel-ml-tools.x86_64                  6.0.5-1.el8.elrepo         elrepo-kernel
kernel-ml-tools-libs.x86_64             6.0.5-1.el8.elrepo         elrepo-kernel
kernel-ml-tools-libs-devel.x86_64       6.0.5-1.el8.elrepo         elrepo-kernel
perf.x86_64                             6.0.5-1.el8.elrepo         elrepo-kernel
python3-perf.x86_64                     6.0.5-1.el8.elrepo         elrepo-kernel

From your output, look at the right-hand column, and notice a series of letters and numbers (which looks something like ‘5.4.220-1.e18.elrepo’). This is the kernel version.

Use these two pieces of information to decide which kernel version you want to install. As you can see, the Linux 6 kernel is the latest mainline release.

Install the Latest Kernel on AlmaLinux 8

To install the latest mainline kernel on AlmaLinux 8, run the command below:

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


To install the latest stable kernel, run the following command:

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


Reboot and Choose the New Linux Kernel on AlmaLinux

At this point, you need to reboot your server:


You’ll be presented with the GRUB or boot menu.

Use the arrow keys to select the Linux kernel you have just installed, then press Enter. Your operating system should boot normally.

Set the Default Kernel Version on ALmaLinux 8

Once you confirm that the new kernel is compatible and working correctly, you’ll want to edit the GRUB boot utility so that, by default, it loads your new kernel.

Navigate to /etc/default/ and open the grub file with your text editor. Or, type the following in the terminal:

sudo vi /etc/default/grub

Once the file opens, look for the line that says GRUB_DEFAULT=X, and change it to GRUB_DEFAULT=0. This line will instruct the boot loader to default to the first kernel on the list, which is the latest.

Save the file, and then type the following command in the terminal to recreate the kernel configuration:

sudo grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...

Reboot once more:


Verify that the boot loader is set to load the latest kernel by default on AlmaLinux 8.

uname -msr
Linux 6.0.5-1.el8.elrepo.x86_64 x86_64


At this point, you have learned to Update or Upgrade the Linux kernel on AlmaLinux 8.

Hope you enjoy it.

You may be like these articles:

How To Upgrade Linux Kernel on Centos 7

How To Configure Automatic Kernel Updates on Linux

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!