How To

Install a Newer Linux Kernel on Rocky Linux and AlmaLinux

Rocky Linux and AlmaLinux inherit RHEL’s kernel, which is frozen at a single version for the life of a release and only gets security and bugfix backports. That stability is the whole point of an enterprise distro, but it also means the kernel can be years behind upstream, which bites when you put the OS on recent hardware or need a feature that only exists in a newer kernel. ELRepo solves this with prebuilt mainline and long-term kernels packaged as RPMs you install with dnf.

Original content from computingforgeeks.com - post 60590

This guide installs a newer kernel on Rocky Linux and AlmaLinux 10 and 9 from ELRepo, including the GPG key change that EL10’s stricter crypto policy now requires. Every command here was run on Rocky Linux 10.1 and 9.7 in June 2026, where ELRepo’s mainline kernel was the 7.0.x series. AlmaLinux uses the exact same steps because both are RHEL rebuilds.

Before you begin

You need a Rocky Linux or AlmaLinux 10 or 9 system you can reboot, a user with sudo, and console access to pick the old kernel from the GRUB menu if needed. One caveat to plan for:

  • ELRepo’s mainline and long-term kernels are not signed for Secure Boot. On a machine with Secure Boot enabled they will not boot, so you must disable Secure Boot in firmware first. Enrolling ELRepo’s MOK key does not help here, because that key only covers ELRepo’s driver modules, not the kernels themselves. Check your current state with mokutil --sb-state.
  • The stock distro kernel stays installed throughout, so you always have a known-good fallback in the boot menu.

Step 1: Check your current kernel

Record the running kernel first. The command to check the kernel version is uname -r:

uname -r

On a stock Rocky Linux 10 install this is the frozen RHEL 10 kernel:

6.12.0-124.8.1.el10_1.x86_64

Step 2: Add the ELRepo repository

Import the ELRepo GPG key first. Use the v2 key, which is the one that works on EL10. The original key fails to import on Rocky and AlmaLinux 10 because the newer rpm crypto policy rejects its signature, so the v2 key is the correct choice on both 10 and 9:

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

Then install the ELRepo release package. On version 10 use the el10 package; on version 9 swap it for the el9 one:

sudo dnf install -y https://www.elrepo.org/elrepo-release-10.el10.elrepo.noarch.rpm

The Rocky 9 and AlmaLinux 9 equivalent is https://www.elrepo.org/elrepo-release-9.el9.elrepo.noarch.rpm. This adds the ELRepo repositories, including the elrepo-kernel repo that carries the newer kernels.

Step 3: Install the kernel

ELRepo ships two kernels. kernel-ml tracks the latest mainline release, and kernel-lt tracks the most recent long-term release. Check what the mainline package currently offers:

sudo dnf --disablerepo="*" --enablerepo=elrepo-kernel list available kernel-ml

The available version prints from the elrepo-kernel repo:

kernel-ml.x86_64               7.0.12-1.el10.elrepo                elrepo-kernel

Install the mainline kernel from that repo:

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

If you want the long-term kernel instead, install kernel-lt the same way, but note that ELRepo packages kernel-lt only for version 9 (and 8), not version 10. On Rocky Linux and AlmaLinux 10, kernel-ml is the only ELRepo kernel available. Do not install both at once; pick the one that fits the table at the end of this guide.

Step 4: Boot into the new kernel

Rocky and AlmaLinux use BootLoaderSpec entries managed by grubby, not a hand-edited GRUB config. Point the default at the new kernel by its image path:

sudo grubby --set-default /boot/vmlinuz-7.0.12-1.el10.elrepo.x86_64

Confirm grubby now points at it:

sudo grubby --default-kernel

It echoes the mainline kernel image as the default:

/boot/vmlinuz-7.0.12-1.el10.elrepo.x86_64

Reboot to load it:

sudo reboot

Step 5: Verify the new kernel

After the reboot, check what is running:

uname -r

It reports the ELRepo mainline kernel, tagged .elrepo:

7.0.12-1.el10.elrepo.x86_64

The screenshot below shows the ELRepo mainline kernel installed and running on Rocky Linux 10:

Terminal showing the ELRepo mainline kernel installed and running on Rocky Linux 10

Removing the ELRepo kernel

To go back to the stock kernel, first reboot and select it from the GRUB menu (or set it as default with grubby), then remove the ELRepo package. Boot off the kernel you want to keep, then:

sudo dnf remove -y kernel-ml
sudo grubby --set-default "$(ls -t /boot/vmlinuz-*.el10_* | head -1)"

On version 9 the stock image matches /boot/vmlinuz-*.el9_* instead. That removes the mainline kernel and repoints the default at the stock RHEL kernel.

kernel-ml or kernel-lt: which to pick

The two ELRepo kernels serve different needs. Choose based on why you need a newer kernel in the first place:

PackageTracksBest for
kernel-mlLatest mainline releaseNewest hardware support and features, willing to update more often
kernel-ltLatest long-term (LTS) release (version 9 and 8 only)Newer than stock but with a longer support window and fewer jumps

For a workstation chasing new hardware support, kernel-ml is the right call. For a server on version 9 that just needs to clear a specific hardware or feature gap without frequent major bumps, kernel-lt is the safer pick. On version 10 that choice is made for you, since ELRepo currently ships only kernel-ml there. Either way, the stock kernel stays installed, so you can always fall back. If you would rather not use a third-party repo at all, the alternative is to manage packages with dnf as usual and build a kernel yourself, the same idea as the mainline kernel install on Ubuntu but compiled from source on the Red Hat side.

Keep reading

Customize KDE Plasma Desktop with Themes|Modules|Extensions AlmaLinux Customize KDE Plasma Desktop with Themes|Modules|Extensions How To Extract .xz files on a Linux System CentOS How To Extract .xz files on a Linux System Extend Root Filesystem Using LVM on Linux KVM Extend Root Filesystem Using LVM on Linux Install PostgreSQL 19 on Ubuntu, Debian, Rocky Linux & AlmaLinux AlmaLinux Install PostgreSQL 19 on Ubuntu, Debian, Rocky Linux & AlmaLinux Install Valkey on Rocky Linux 10 / AlmaLinux 10 Databases Install Valkey on Rocky Linux 10 / AlmaLinux 10 Manage SELinux Status, Context, Ports and Booleans Using Ansible CentOS Manage SELinux Status, Context, Ports and Booleans Using Ansible

Leave a Comment

Press ESC to close