Articles on: Application Recipe Guides

Upgrading the KVM Kernel on CentOS 7

Upgrade your KVM kernel to the latest stable version on RHEL 7, CentOS 7 and Fedora - includes BBR Support

With new devices and technology coming out periodically, it is important to keep our kernel up to date if we want to make the most of out them. Additionally, updating our kernel will help us to leverage new kernel functions and to protect ourselves from vulnerabilities that have been discovered in previous versions.

One important thing to consider is the life cycle of a kernel version – if the version you are currently using is approaching its end of life, no more bug fixes will be provided after that date.

Before upgrading your kernel, make sure to note the version of the kernel currently installed using the following command.

[root@cloudcone ~]$ uname -sr


Most modern distributions provide a way to upgrade the kernel using a package management system such as yum and an officially-supported repository.

However, this will only perform the upgrade to the most recent version available from the distribution’s repositories – not the latest one available at https://www.kernel.org/. Unfortunately, Red Hat only allows to upgrade the kernel using the former option.

As opposed to Red Hat, CentOS allows the use of ELRepo, a third-party repository that makes the upgrade to a recent version a kernel.

To enable the ELRepo repository on CentOS 7, do:

[root@cloudcone ~]$ rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org


[root@cloudcone ~]$ rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm


Once the repository has been enabled, you can use the following command to list the available kernel related packages:

[root@cloudcone ~]$ yum --disablerepo="*" --enablerepo="elrepo-kernel" list available


Next, install the latest mainline stable kernel:

[root@cloudcone ~]$ yum --enablerepo=elrepo-kernel install kernel-ml


To make the newly-installed version the default boot option, you will have to modify the GRUB configuration as follows:

Open and edit the file /etc/default/grub and set GRUB_DEFAULT=0. This means that the first kernel in the GRUB list will be used as default.

[root@cloudcone ~]$ vi /etc/default/grub
....
GRUB_DEFAULT=0
....


Next, run the following command to recreate the kernel configuration.

[root@cloudcone ~]$ grub2-mkconfig -o /boot/grub2/grub.cfg


Reboot and verify that the latest kernel is now being used by default using the uname command again:

[root@cloudcone ~]$ uname -sr


Congratulations! You have upgraded your system kernel to the latest version available!

Updated on: 12/29/2017

Was this article helpful?

Share your feedback

Cancel

Thank you!