Update CentOS 7 Kernel – KVM NVMe VPS
The Kernel shipped with our CentOS 7 KVM NVMe VPS Servers is defaulted to version 3 Kernel. Specifically, any KVM NVMe VPS delivered on our network will use Kernel 3.10.x. Whilst this is a stable Kernel you can upgrade the CentOS 7 Kernel to a newer version if required. At the time of writing this document Kernel, 4.4.232.x, and Kernel 5.8.0.x are available to install for all users.
The ELRepo repository contains two Kernel versions. Kernel-lt and Kernel-ml. Both of these Kernels are fine to use for production servers. One provides long term support the other provides newer features and is updated more often.
Kernel-lt – Long Term Support Kernel
Kernel-ml – Mainline Stable Version
In this article, we will install both versions to one of our KVM NVMe VPS Servers and show you how to switch between both. You do not need to install both Kernels in a production environment.
You need access to the internal KVM/IP console to complete a Kernel update. If you do not know how to do this check out the guide above before you continue.
Import the ELRepo GPG Key
Log in to your server at the root user and import the ELRepo GPG Key. To do this issue the command;
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
Add the ELRepo Repository
Now you need to add the ELRepo repository to your server, this is where the Kernels are located.
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm

Now check your current Kernel with the below command. You should be using V3 Kernel which is 3.10.0-1127.18.2.el7.x86_64.
uname -r
Now choose which CentOS 7 Kernel to install.
Install Long Term Support CentOS 7 Kernel (Kernel-lt)
yum --enablerepo=elrepo-kernel install kernel-lt
Install Mainline CentOS 7 Kernel (Kernel-ml)
yum --enablerepo=elrepo-kernel install kernel-ml

Once the install is complete your new Kernel will be ready to use but to automatically boot to the new Kernel we need to make some changes to the existing boot options. First, reboot your server and ensure you reboot it from the HTML5 Console by clicking the “Send CNTL+ALT+DEL” button.

When the boot screen loads press the up arrow to cancel automatic boot. Here you can see a list of Kernels installed to your server. At the top, you will see your new Kernel.

The order of these Kernels is important. Thay order from 0 to 5. The top entry is 0 and the last entry is 5. So the long term support Kernel we just installed is entry 0. Reboot your server by clicking the send Send “CNTL+ALT+DEL” button again and allow it to boot as normal into your old Kernel. Log back in as the root user.
Automatically Boot From Updated Kernel
Now let’s set the new Kernel as the default Kernel to boot from. We use grub2 to do this. In the previous step, we checked the order of the Kernels. The new Kernel was entry 0 so issue the below command
grub2-set-default 0
Now from the HTML5 console hit the “CNTL+ALT+DEL” button again and the server will boot from your new Kernel. You can always switch between the different Kernels from the boot screen using the HTML5 console. In the event something goes wrong you can even use the rescue mode to revert any changes to your server. Because the HTML5 console uses the internal network you have a permanent connection to your KVM VPS.

How was this article? – Update CentOS 7 Kernel – KVM NVMe VPS
You might also like
More from All About Linux
How to install FTP and configure FTP on an Ubuntu 22 LTS instance
If you need to upload files to your NVMe VPS you have a couple of options. You can use a …
How to install a Cloudflare Origin SSL Certificate – NGINX
An SSL Certificate is vital to encrypt data between you and your clients. SSLs can be complicated things. If they …
How To Open Port FirewallD and Close Port FirewallD -CentOS 7
Open And Close Ports In FirewallD - Manage Zones In FirewallD Like IPtables, FirewallD is a Linux firewall that filters packets …