Installing the Linux Kernel 6.x on AlmaLinux 9

AlmaLinux 9 is a community-driven, open-source Linux distribution built to provide a free, enterprise-grade operating system. It is designed to be a drop-in replacement for Red Hat Enterprise Linux (RHEL) and uses many of its technologies. One of the key benefits of AlmaLinux 9 is its ability to run the latest and greatest software, including the Linux kernel. In this article, we'll show you how to install kernel 6 on AlmaLinux 9 using the ELRepo repository.

What is ELRepo?

ELRepo is a community repository for Enterprise Linux that provides additional packages for AlmaLinux 9 and other distributions. The repository provides a number of useful packages, including updated kernels, drivers, and other software. ELRepo is particularly useful for users who need access to the latest stable Linux kernels and drivers, which are often not available in the distribution's official repositories.

Why Upgrade to Kernel 6?

Upgrading to kernel 6 offers a number of benefits, including improved hardware support, better performance, and enhanced security. The latest version of the Linux kernel is also more likely to receive regular updates and bug fixes, making it a more reliable choice for users who want to run the latest software.

Finding the current kernel version

Use the uname command to display the current version of kernel the system is running.:

uname -sr

Output:

[root@vps ~]# uname -sr
Linux 5.14.0-162.6.1.el9_1.x86_64

Enabling ELRepo

Before you can install kernel 6 on AlmaLinux 9, you'll need to install ELRepo. The ELRepo repository can be installed by adding the ELRepo repository to your system's package sources. To do this, open a terminal window and run the following commands:

Import the public key and install the ELRepo RPM package using the below command.

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
dnf install https://www.elrepo.org/elrepo-release-9.el9.elrepo.noarch.rpm

Output:

[root@vps ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
[root@vps ~]# dnf install https://www.elrepo.org/elrepo-release-9.el9.elrepo.noarch.rpm                                      Last metadata expiration check: 0:02:44 ago on Tue 03 Jan 2023 07:28:58 PM UTC.
elrepo-release-9.el9.elrepo.noarch.rpm                                                        54 kB/s |  12 kB     00:00
Dependencies resolved.
=============================================================================================================================
Package                        Architecture           Version                            Repository                    Size
=============================================================================================================================
Installing:
elrepo-release                 noarch                 9.1-1.el9.elrepo                   @commandline                  12 k

Transaction Summary
=============================================================================================================================
Install  1 Package

Total size: 12 k
Installed size: 5.0 k
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
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!
elrepo-kernel

Installing Kernel 6

Run the following command to install the latest mainline stable kernel:

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

output:

[root@vps ~]# dnf --enablerepo=elrepo-kernel install kernel-ml
ELRepo.org Community Enterprise Linux Repository - el9                                       107 kB/s | 121 kB     00:01
Last metadata expiration check: 0:00:01 ago on Tue 03 Jan 2023 07:32:57 PM UTC.
Dependencies resolved.
=============================================================================================================================
Package                          Architecture          Version                           Repository                    Size
=============================================================================================================================
Installing:
kernel-ml                        x86_64                6.1.2-1.el9.elrepo                elrepo-kernel                 18 k
Installing dependencies:
kernel-ml-core                   x86_64                6.1.2-1.el9.elrepo                elrepo-kernel                 57 M
kernel-ml-modules                x86_64                6.1.2-1.el9.elrepo                elrepo-kernel                 52 M

Transaction Summary
=============================================================================================================================
Install  3 Packages

Total download size: 108 M
Installed size: 147 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): kernel-ml-6.1.2-1.el9.elrepo.x86_64.rpm                                                39 kB/s |  18 kB     00:00
(2/3): kernel-ml-core-6.1.2-1.el9.elrepo.x86_64.rpm                                           12 MB/s |  57 MB     00:04
(3/3): kernel-ml-modules-6.1.2-1.el9.elrepo.x86_64.rpm                                       9.3 MB/s |  52 MB     00:05
-----------------------------------------------------------------------------------------------------------------------------
Total                                                                                         19 MB/s | 108 MB     00:05
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing        :                                                                                                     1/1
Installing       : kernel-ml-core-6.1.2-1.el9.elrepo.x86_64                                                            1/3
 Running scriptlet: kernel-ml-core-6.1.2-1.el9.elrepo.x86_64                                                            1/3
Installing       : kernel-ml-modules-6.1.2-1.el9.elrepo.x86_64                                                         2/3
Running scriptlet: kernel-ml-modules-6.1.2-1.el9.elrepo.x86_64                                                         2/3
Installing       : kernel-ml-6.1.2-1.el9.elrepo.x86_64                                                                 3/3
Running scriptlet: kernel-ml-core-6.1.2-1.el9.elrepo.x86_64                                                            3/3
Running scriptlet: kernel-ml-6.1.2-1.el9.elrepo.x86_64                                                                 3/3
Verifying        : kernel-ml-6.1.2-1.el9.elrepo.x86_64                                                                 1/3
Verifying        : kernel-ml-core-6.1.2-1.el9.elrepo.x86_64                                                            2/3
Verifying        : kernel-ml-modules-6.1.2-1.el9.elrepo.x86_64                                                         3/3

Installed:
kernel-ml-6.1.2-1.el9.elrepo.x86_64  kernel-ml-core-6.1.2-1.el9.elrepo.x86_64  kernel-ml-modules-6.1.2-1.el9.elrepo.x86_64

Verify the installed Kernel version

By default, the system will set the newly installed kernel as the default version to use and boot with.

You can verify this by running the below command,

grubby --default-kernel

Once confirmed, reboot the system to boot with the latest kernel installed. After reboot this can be further verified by running the uname command,

uname -sr

output:

[root@vps ~]# uname -sr
Linux 6.1.2-1.el9.elrepo.x86_64

CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS