How to Install Linux Kernel 6.0 on AlmaLinux 9

As anyone who has used AlmaLinux for any time knows, one of its primary focuses is stability. This can often mean that the distribution is relatively stable but usually has very outdated packages in terms of new features. For example, at the time of this writing, AlmaLinux features kernel 5.14, but some users may require a more recent kernel for better hardware compatibility, among many other things. While this focus on stability is admirable, it can be frustrating for users who need the latest and most significant features that newer kernels often provide. Fortunately, there are a few ways to work around this issue. One option is to use the ELRepo repository, which has an excellent reputation amongst EL9 distributions such as CentOS Stream, Rocky Linux, etc.

Some of the various changes besides the typical CPU improvements include the following.

  • Kernel support for NVMe in-band authentication.
  • Runtime verification subsystem.
  • Raspberry Pi 4 V3D kernel driver.
  • IO_uring user-space block driver.
  • Buffered writes on XFS file systems.
  • Send Protocol V2 support for Btrfs.
  • H.265/HEVC API promoted to stable.

For a complete list of changes, visit the 6.0 kernel changelog by visiting Kernel Newbies.

The following tutorial will show you how to import the ELRepo kernel repository and install Linux Kernel 6.0 on AlmaLinux 9 Workstation or Server using the command line terminal.

Update AlmaLinux

Before you begin, update your system to ensure all existing packages are up to date, as this is essential when installing/upgrading Linux kernels to avoid conflicts.



sudo dnf upgrade --refresh

Import and Install ELRepo & GPG Key

The first step is to import the repository from the ELRepo project. This has the latest available kernel or the LTS version with regular updates, so you do not need to compile kernels and install and upgrade using the dnf package manager.

First, import the GPG key to verify the installation package.

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

Next, install the repository with the following command.

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

To verify the imported repository, you can search ELRepo to see the supported kernels available for installation.

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

Example output:

How to Install Linux Kernel 6.0 on AlmaLinux 9

Install Linux Kernel 6.0 – Linux Mainline Kernel

The first option is to install the latest Linux Kernel from the stable branch. Given that AlmaLinux focuses on being extremely durable, this kernel version may bring inconsistencies, but for most systems, it should work fine and increase performance. Always have a backup solution in place when installing kernels on critical systems like you would with any significant packages.



In your terminal, use the following command to begin the installation.

sudo dnf --enablerepo=elrepo-kernel install kernel-ml kernel-ml-core kernel-ml-headers kernel-ml-modules kernel-ml-modules-extra -y

Now reboot your system; during the boot window with kernels to choose from, select kernel 6.0 if this option is not selected automatically. Remember, you can switch back to any kernel listed here for any problems that may occur.

reboot

Example:

How to Install Linux Kernel 6.0 on AlmaLinux 9

Once back in your system, verify the new kernel and build by checking the kernel.

uname -r

Or, for more detailed information, use something like the hostnamectl command.

hostnamectl

Example output:



How to Install Linux Kernel 6.0 on AlmaLinux 9

Congratulations, you have installed the latest 6.0 kernel on your AlmaLinux 9 workstation desktop or a headless server.

How to Update Kernel from ELRepo

ELRepo uses the DNF manager, as you would have noticed when installing the kernel. To check and keep the kernel up to date, use the following command as you would with any other package.

sudo dnf upgrade --refresh

Remember, for any kernel updates, you will need to reboot your system.

How to Restore Default Kernel

For users who find the new kernel has bugs for their hardware, say, loss of sound, use the following steps to restore the default kernel; if you installed an alternative kernel, replace the default kernel section with whatever you want to install.

First, disable the ELRepo repository using the following command.

sudo dnf config-manager --set-disabled elrepo

Confirm this repository has been disabled using the following dnf repolist command.



Next, re-install the default kernel packages.

sudo dnf reinstall kernel kernel-core kernel-modules kernel-headers

Users that have removed all unused kernels use the install command instead.

sudo dnf install kernel kernel-core kernel-modules kernel-headers

Example output:

How to Install Linux Kernel 6.0 on Rocky Linux 8

Remember to reboot.

reboot

Select Linux Kernel 5.14 on system boot, and this is probably the simple way to revert to the kernel.

Once you have returned to Linux Kernel 5.14, which is the default currency for AlmaLinux, confirm it.



uname -r

Example output:

5.14.0-70.26.1.el9_0.x86_64

Lastly, you can optionally remove all unused kernels. I would cite caution for this.

sudo dnf --setopt=protected_packages= remove $(rpm -q kernel-core | grep -v $(uname -r))

Comments and Conclusion

The tutorial taught you how to install the latest 6.0 Linux kernel and some other handy hints about using ELRepo. Note, if your system is a production system or for similar use, it would be advised to use the existing kernel that ships the standard installation for the most stability. However, those wanting to try kernel 6.0, ensure you have adequate backups.


Not what you were looking for? Try searching for additional tutorials.

Leave a Comment