How To Upgrade Linux Kernel on Rocky Linux 8

In this guide, we want to teach you How To Upgrade Linux Kernel on Rocky Linux 8.

The Linux kernel is like a bridge that enables computing communication between applications and hardware and manages the system’s resources. Linus Torvalds developed the Linux kernel with C and Assembly and thus, he succeeded in creating a lightweight and portable core that was released to the public as open source.

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

Steps To Upgrade Linux Kernel on Rocky Linux 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 Rocky Linux 8.

Check the Current Linux Kernel Version on Rocky Linux

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-305.12.1.el8_4.x86_64 x86_64

Then, use the following command to update your Rocky Linux repository:

sudo dnf -y update

Add ELRepo Repository on Rocky Linux 8

To update the kernel on Rocky Linux, 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 Rocky Linux 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 Rocky Linux 8

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

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

In your output you will see the following:

Available Packages
bpftool.x86_64                          6.0.1-1.el8.elrepo         elrepo-kernel
kernel-lt.x86_64                        5.4.217-1.el8.elrepo       elrepo-kernel
kernel-lt-core.x86_64                   5.4.217-1.el8.elrepo       elrepo-kernel
kernel-lt-devel.x86_64                  5.4.217-1.el8.elrepo       elrepo-kernel
kernel-lt-doc.noarch                    5.4.217-1.el8.elrepo       elrepo-kernel
kernel-lt-headers.x86_64                5.4.217-1.el8.elrepo       elrepo-kernel
kernel-lt-modules.x86_64                5.4.217-1.el8.elrepo       elrepo-kernel
kernel-lt-modules-extra.x86_64          5.4.217-1.el8.elrepo       elrepo-kernel
kernel-lt-tools.x86_64                  5.4.217-1.el8.elrepo       elrepo-kernel
kernel-lt-tools-libs.x86_64             5.4.217-1.el8.elrepo       elrepo-kernel
kernel-lt-tools-libs-devel.x86_64       5.4.217-1.el8.elrepo       elrepo-kernel
kernel-ml.x86_64                        6.0.1-1.el8.elrepo         elrepo-kernel
kernel-ml-core.x86_64                   6.0.1-1.el8.elrepo         elrepo-kernel
kernel-ml-devel.x86_64                  6.0.1-1.el8.elrepo         elrepo-kernel
kernel-ml-doc.noarch                    6.0.1-1.el8.elrepo         elrepo-kernel
kernel-ml-headers.x86_64                6.0.1-1.el8.elrepo         elrepo-kernel
kernel-ml-modules.x86_64                6.0.1-1.el8.elrepo         elrepo-kernel
kernel-ml-modules-extra.x86_64          6.0.1-1.el8.elrepo         elrepo-kernel
kernel-ml-tools.x86_64                  6.0.1-1.el8.elrepo         elrepo-kernel
kernel-ml-tools-libs.x86_64             6.0.1-1.el8.elrepo         elrepo-kernel
kernel-ml-tools-libs-devel.x86_64       6.0.1-1.el8.elrepo         elrepo-kernel
perf.x86_64                             6.0.1-1.el8.elrepo         elrepo-kernel
python3-perf.x86_64                     6.0.1-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.217-1.e17.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 Rocky Linux 8

To install the latest mainline kernel on Rocky Linux 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

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 Rocky Linux 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.

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


At this point, you have learned to Upgrade Linux Kernel o Rocky Linux 8.

Hope you enjoy it.

You may be like these articles:

How To Install Erlang on Rocky Linux 8

Install PostgreSQL 14 on Rocky Linux 8


Please enter your comment!
Please enter your name here

Latest Articles


Most Popular