Home CentOS How to Install a Specific Kernel Version in CentOS

How to Install a Specific Kernel Version in CentOS

The Linux Kernel is the underlying core of all GNU/Linux distributions. The kernel, GNU standard programs, and additional programs and GUI on top of them make up a GNU/Linux operating system. CentOS is one such popular GNU/Linux operating system that comes under the RedHat family of Linux distributions.

As the Linux kernel grows in size, more and more resources are spent in its development; mainly to incorporate support for newer hardware, amongst other things. However, there can be scenarios when an upgraded Kernel version is giving certain errors on a piece of hardware. There can be cases also when you want to test an older version of the kernel for compatibility purposes.

In this article, we will see how to install a specific version of the Linux Kernel in CentOS Linux.

How to Enable ELRepo in CentOS

Before enabling ELRepo on CentOS, make sure to run the following command to get the current version of the kernel installed on the CentOS.

$ uname -r
Check Kernel Version in CentOS
Check Kernel Version in CentOS

Now, let’s enable the EL Repo repository, which is an unofficial Linux Kernel distribution repo for CentOS.

$ sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
$ sudo yum install http://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm
Enable EL Repo Repository in CentOS
Enable EL Repo Repository in CentOS

How to Install Particular Kernel Version in CentOS

Let’s now list the available kernel versions with the following command:

$ yum --enablerepo="elrepo-kernel" list available | grep “kernel-”
List of Available Kernel Versions
List of Available Kernel Versions

Now, install the particular Kernel version (in my case Kernel LT 5.4.99) using the following yum command.

$ sudo yum --enablerepo=”elrepo-kernel” install kernel-lt.x86_64
Install Specific Kernel Version in CentOS
Install Specific Kernel Version in CentOS

This will now download all the packages and install kernel version 5.4.99 LT. Once the installation is finished, reboot the machine. You can see that there are multiple Kernel versions to choose from the Grub screen now.

Choose Kernel Version
Choose Kernel Version

Once you are logged in, run the following to verify the version number.

$ uname -r
Verify Kernel Version
Verify Kernel Version

As you can see, both kernel versions are installed now and you can now choose to boot with either of the versions from the Grub screen.

Conclusion

We learned a simple and easy way to install a specific kernel version in CentOS. Thanks for reading and let us know your thoughts and questions in the comments below!

Ravi Saive
I am an Experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies. Founder of TecMint.com, LinuxShellTips.com, and Fossmint.com. Over 150+ million people visited my websites.

Each tutorial at UbuntuMint is created by a team of experienced writers so that it meets our high-quality standards.

Was this article helpful? Please add a comment to show your appreciation and support.

Got something to say? Join the discussion.

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published or shared. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.