Upgrade Linux Kernel on AlmaLinux 9

This article intends to teach you to Upgrade or Update the Linux Kernel on AlmaLinux 9.

The Linux kernel is the foundation of the Linux computer operating system. A kernel is the lowest level of software that can interface with computer hardware. All Linux applications and servers also interface with the Linux kernel. All Linux distributions are based on the Linux kernel and use its services to implement various software functions.

Steps To Upgrade Linux Kernel on AlmaLinux 9

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 9.

Check the Current Version of AlmaLinux 9 Kernel

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:

Output
Linux 5.14.0-70.22.1.el9_0.x86_64 x86_64

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

sudo dnf -y update

Add ELRepo Repository on AlmaLinux 9

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 kernel.org.

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

sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

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

sudo dnf install https://www.elrepo.org/elrepo-release-9.el9.elrepo.noarch.rpm

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

Output
Running transaction
  Preparing        :                                                        1/1
  Installing       : elrepo-release-9.1-1.el9.elrepo.noarch                 1/1
  Verifying        : elrepo-release-9.1-1.el9.elrepo.noarch                 1/1

Installed:
  elrepo-release-9.1-1.el9.elrepo.noarch

Complete!

List Available Kernels on AlmaLinux 9

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:

Output
Available Packages
kernel-lt.x86_64                        6.1.28-1.el9.elrepo        elrepo-kernel
kernel-lt-core.x86_64                   6.1.28-1.el9.elrepo        elrepo-kernel
kernel-lt-devel.x86_64                  6.1.28-1.el9.elrepo        elrepo-kernel
kernel-lt-devel-matched.x86_64          6.1.28-1.el9.elrepo        elrepo-kernel
kernel-lt-doc.noarch                    6.1.28-1.el9.elrepo        elrepo-kernel
kernel-lt-headers.x86_64                6.1.28-1.el9.elrepo        elrepo-kernel
kernel-lt-modules.x86_64                6.1.28-1.el9.elrepo        elrepo-kernel
kernel-lt-modules-extra.x86_64          6.1.28-1.el9.elrepo        elrepo-kernel
kernel-lt-tools.x86_64                  6.1.28-1.el9.elrepo        elrepo-kernel
kernel-lt-tools-libs.x86_64             6.1.28-1.el9.elrepo        elrepo-kernel
kernel-lt-tools-libs-devel.x86_64       6.1.28-1.el9.elrepo        elrepo-kernel
kernel-ml.x86_64                        6.3.2-1.el9.elrepo         elrepo-kernel
kernel-ml-core.x86_64                   6.3.2-1.el9.elrepo         elrepo-kernel
kernel-ml-devel.x86_64                  6.3.2-1.el9.elrepo         elrepo-kernel
kernel-ml-devel-matched.x86_64          6.3.2-1.el9.elrepo         elrepo-kernel
kernel-ml-doc.noarch                    6.3.2-1.el9.elrepo         elrepo-kernel
kernel-ml-headers.x86_64                6.3.2-1.el9.elrepo         elrepo-kernel
kernel-ml-modules.x86_64                6.3.2-1.el9.elrepo         elrepo-kernel
kernel-ml-modules-extra.x86_64          6.3.2-1.el9.elrepo         elrepo-kernel
kernel-ml-tools.x86_64                  6.3.2-1.el9.elrepo         elrepo-kernel
kernel-ml-tools-libs.x86_64             6.3.2-1.el9.elrepo         elrepo-kernel
kernel-ml-tools-libs-devel.x86_64       6.3.2-1.el9.elrepo         elrepo-kernel
perf.x86_64                             6.3.2-1.el9.elrepo         elrepo-kernel
python3-perf.x86_64                     6.3.2-1.el9.elrepo         elrepo-kernel

From your output, look at the right-hand column, and notice a series of letters and numbers (which looks something like ‘6.1.28-1.el9.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 MainLine Kernel on AlmaLinux 9

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

sudo dnf --enablerepo=elrepo-kernel install kernel-ml -y
Output
Installed:
  kernel-ml-6.3.2-1.el9.elrepo.x86_64
  kernel-ml-core-6.3.2-1.el9.elrepo.x86_64
  kernel-ml-modules-6.3.2-1.el9.elrepo.x86_64

Complete!

Install the Latest Stable Kernel on AlmaLinux 9

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

sudo dnf --enablerepo=elrepo-kernel install kernel-lt -y
Output
Installed:
  kernel-lt-6.1.28-1.el9.elrepo.x86_64
  kernel-lt-core-6.1.28-1.el9.elrepo.x86_64
  kernel-lt-modules-6.1.28-1.el9.elrepo.x86_64

Complete!

Reboot and Choose the New AlmaLinux Kernel

At this point, you need to reboot your server:

reboot

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 9

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
Output
Generating grub configuration file ...
Adding boot menu entry for UEFI Firmware Settings ...
done

Reboot once more:

reboot

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

uname -msr
Output
Linux 6.3.2-1.el9.elrepo.x86_64 x86_64

Conclusion

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

Hope you enjoy it. You may be like these articles on the orcacore blog page:

How To Display Disk Space on AlmaLinux

Set up Time Synchronization on AlmaLinux 9

Install MariaDB 10.11 on AlmaLinux 9

1 COMMENT
  1. Magnificent website. A lot of helpful information here. I’m sending it to some pals ans also sharing in delicious. And naturally, thank you to your effort!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles

POPULAR TAGS

Most Popular