How to Install Linux Kernel 5.17/5.4 on AlmaLinux 8


Almalinux, as many know, is a downstream version of RHEL, which often means it is incredibly stable but usually has very outdated packages in terms of features and not security updates. Currently, Almalinux features kernel 4.18, but some users may require a more recent kernel for purposes of better hardware compatibility, among many other things.

ELREPO has both Linux Kernel Mainline LTS versions. The mainline version is the most recent stable release of the Linux Kernel, and the current LTS Kernel they are supporting is 5.4.

The following tutorial will show you how to import the ELRepo kernel repository and install 5.17 or with the alternative 5.4 kernel on Almalinux 8 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.

Advertisement


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, use the following command:

sudo dnf install https://www.elrepo.org/elrepo-release-8.el8.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:

Install Linux Kernel 5.17/5.4 on AlmaLinux 8

Install Linux Kernel 5.17 Mainline

The first option is to install the latest Linux Kernel from the stable branch. Given that Almalinux focuses on being extremely stable, this kernel version may bring inconsistencies where the long-term release kernel 5.4 may be better suited. The advantage of using the latest kernel is better performance across your system, so the benefits need to be weighed up.

See also  How to Install UbuntuDDE on Ubuntu 22.04/20.04

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

Advertisement


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

Now reboot your system; during the boot window with kernels to choose from, select kernel 5.17 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:

Install Linux Kernel 5.17/5.4 on AlmaLinux 8

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 hostnamectl command.

hostnamectl

Example output:

Install Linux Kernel 5.17/5.4 on AlmaLinux 8

Congratulations, you have installed the latest 5.17 kernel on your AlmaLinux 8 system.

Advertisement


Install Linux Kernel 5.4 LTS

The second option and perhaps more recommended for systems that operate as servers is to install the Linux kernel 5.4 first before upgrading to the latest kernel on offer from the mainline branch.

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

sudo dnf --enablerepo=elrepo-kernel install kernel-lt kernel-lt-devel kernel-lt-headers -y

Now reboot your system; during the boot window with kernels to choose from, select kernel 5.4 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:

Install Linux Kernel 5.17/5.4 on AlmaLinux 8

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 hostnamectl command.

Advertisement


hostnamectl

Example output:

Install Linux Kernel 5.17/5.4 on AlmaLinux 8

Congratulations, you have installed the latest 5.4 kernel on your AlmaLinux 8 system.

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.

See also  How to Install Linux Kernel 6.0 on Linux Mint 21 LTS

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

First, disable the ELRepo repository using the following command.

Advertisement


sudo dnf config-manager --set-disabled elrepo

Confirm this repository has been disabled by using the following dnf repolist command; nothing should be returned if it has been disabled successfully.

sudo dnf repolist | grep elrepo

Next, re-install the default kernel packages.

sudo dnf reinstall kernel*

Once returned, your default kernel should be returned to 4.8. Confirm this by using one of the version check commands listed in the tutorial.

Comments and Conclusion

In the tutorial, you have learned how to install the Linux mainline kernel 5.17 and the long-term support kernel 5.4. Overall, most focus is on Linux kernel 5.17, with many new features, support, and security.

Overall, Linux Kernel 5.17 brings support for recursive id-mapped mounts; CO-RE support that creates compiled BPF programs more portable; a replacement P-state driver for contemporary AMD CPUs; the random number generator switched to BLAKE2s and got much faster; a replacement Real-Time Linux Analysis tool; the fscache networking caching backend was rewritten; new fanotify flag to interchange some inotify patterns; support for giving names to anonymous memory mappings.

Many other improvements have been included in the release, far too long to list. Please review Linux 5.17 Kernel release changelog for detailed changes before installing the new kernel.

Advertisement



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

Leave a Comment