How to Install Linux Kernel 6.0 on CentOS 9 Stream | CentOS 8 Stream

As anyone who has used CentOS Stream 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, CentOS Stream 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.

For most users, the best option is to use the ELRepo repository, which has an excellent reputation amongst EL9 and EL8 distributions such as AlmaLinux, Rocky Linux, etc. The following tutorial will show you how to import the ELRepo for CentOS 9 or CentOS 8 Stream desktop or server using cli commands for the users that require to update their kernel for better hardware support.

Recommended Steps Before Installation

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 mainline kernel 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

Next, install the repository with the following command; ensure you import the correct version for your distribution version; if not, your kernel installation will fail.

Import ELRepo EL9 for CentOS Stream 9:

sudo dnf install -y

Import ELRepo EL9 for CentOS Stream 8:

sudo dnf install -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:

print out to check kernel 6.0 available on centos stream

Install Linux Kernel 6.0 – Linux Mainline Kernel

The first option is to install the latest Linux Kernel from the stable branch. Since CentOS Stream focuses on being extremely stable, 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 to any kernel listed here for any problems.



example centos stream 6.0 on boot screen

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.


Example output:

example output checking linux kernel 6.0 installed on centos stream

Congratulations, you have installed the latest Linux Kernel mainline on your 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.

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:

example re-installing default kernel on centos stream

Remember to 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 CentOS 9 Stream, confirm it.

uname -r

Example output:


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))

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

Leave a Comment