Install/Upgrade Linux Kernel 5.16/5.4 on CentOS 8 Stream

CentOS 8 Stream, 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. CentOS 8 Stream currently features kernel 4.18, but some users may require a more recent kernel for better hardware compatibility, amongst 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 both 5.16/5.4 kernels on CentOS 8 Stream Workstation or Server.

Prerequisites

The tutorial will utilize the terminal, which can be found in your show applications menu.

Example:

Install Linux Kernel 5.16/5.4 on CentOS 8 Stream

Updating Operating System

Update your CentOS Stream operating system to make sure all existing packages are up to date:

sudo dnf upgrade --refresh -y

The tutorial will be using the sudo command and assuming you have sudo status.

To verify sudo status on your account:

sudo whoami

Example output showing sudo status:

[joshua@centos-stream ~]$ sudo whoami
root

To set up an existing or new sudo account, visit our tutorial on adding a User to Sudoers on CentOS Stream.

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

sudo dnf install https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm

Example output:

Install Linux Kernel 5.16/5.4 on CentOS 8 Stream

Type Y, then press the ENTER KEY to proceed.

Verify the repo exists on your system using the following command.

dnf repolist | grep elrepo

Example output:

elrepo                    ELRepo.org Community Enterprise Linux Repository - el8

Alternatively, in the terminal, you can search ELRepo to see the supported kernels and available to install.

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

Example output:

Install Linux Kernel 5.16/5.4 on CentOS 8 Stream

Option 1 – Install Linux Kernel 5.16 Mainline

The first option is to install the latest Linux Kernel from the stable branch. CentOS 8 Stream focuses on being extremely stable, so 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.

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

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

Example output:

Install Linux Kernel 5.16/5.4 on CentOS 8 Stream

Type Y, then press the ENTER KEY to proceed.

Now reboot your system; during the boot window with kernels to choose from, select kernel 5.16 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.16/5.4 on CentOS 8 Stream

Once back in your system, verify the new kernel and build:

uname -r

Example output:

5.16.7-1.el8.elrepo.x86_64

Congratulations, you have installed the latest 5.16 kernel on your system.

Option 2 – Install Linux Kernel 5.4 LTS

The second option and perhaps more recommended for servers operating is installing 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

Example output:

Install Linux Kernel 5.16/5.4 on CentOS 8 Stream

Type Y, then press the ENTER KEY to proceed.

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.16/5.4 on CentOS 8 Stream

Once back in your system, verify the new kernel and build:

uname -r

Example output:

5.4.177-1.el8.elrepo.x86_64

Congratulations, you have installed the latest 5.4 LTS kernel 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, and you will need to reboot your system.

Comments and Conclusion

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

The Linux 5.16 kernel release has a great new feature, FUTEX2, or futex_watv(), which aims to improve the Linux gaming experience, growing considerably with better native Linux porting for Windows games utilizing Wine.

Other improvements include improved write congestion management task scheduler for CPU clusters sharing L2/L3 cache.

More information can be found on the Linux 5.16 Kernel release changelog.



Follow LinuxCapable.com!

Like to get automatic updates? Follow us on one of our social media accounts!