Update the CentOS 7 kernel

On some occasions I have found that the VPS provider maintains a specific version of the CentOS 7 kernel that can be very old, a version 3.10 or similar, when we need a higher version, for example a 5.x.

This tutorial has been created on a Clouding.io VPS. You can create your own VPS from 3€/month.

In addition, you have the possibility to create your VPS with the WordPress image in one click.

PARTNERSHIP

We will follow some previous steps… and when we have all the information, we will do the update.

First we will validate that CentOS allows the kernel update.

vim /etc/yum.repos.d/CentOS-Base.repo

We will look for whether it is activated or not, and if it is not, we will.

enabled=1

With this, if we update, it will put us version 3.10, which is the one that the system has by default. To do this, we will configure, always tailored to backup, that the own system is available.

yum clean all && yum update
yum -y install kernel-devel kernel

With this, we will have that CentOS will have its official kernel and its updates.

The next step will be to install new versions of the kernel… the last one available, as far as possible.

For this, we will install the repos of ElRepo.

yum -y install yum-plugin-fastestmirror
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
yum clean all && yum update

From here, we will install the latest version available

yum --enablerepo=elrepo-kernel install kernel-ml

And once installed, we’ll review which kernels are available.

sudo awk -F' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg

In principle, of the whole list, the first of it will be 0, with the new kernel.

sudo grub2-set-default 0

We will make the change in the boot configuration.

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

And finally we will restart the machine.

reboot

When restarting, we can see if the new kernel has been applied.

uname -snr

And with this we can have a much more updated system and required by some software related to the web, mail or DNS.


About this document

This document is regulated by the EUPL v1.2 license, published in WP SysAdmin and created by Javier Casares. Please, if you use this content in your website, your presentation or any material you distribute, remember to mention this site or its author, and having to put the material you create under EUPL license.