Our KVM VPS has a possibility of upgrading kernel version which is one of the most common reasons why some of the customers chooses the KVM VPS over the Standard VPS. Higher version of kernel is required by some of the applications or services.
By default does not have the latest kernel version available so this article might help to resolve the case. We will provide the details on how to manually change your kernel version.
First, it is always good to know, what is the current version of your kernel, you can check that with the following command:
uname -sr
The outcome should be simple and specific:
Linux 4.14.0-041400-generic
Kernel upgrade for Ubuntu
Secondly, you need to download the required files for your chosen kernel version. All the available kernel versions can be found in this page:
http://kernel.ubuntu.com/~kernel-ppa/mainline/
Source provides all the required files for kernel to upgrade. Once you check the specific version of Kernel you may see many links to download, for example:
Build for amd64 succeeded (seeĀ BUILD.LOG.amd64):
linux-headers-4.13.0-041300_4.13.0-041300.201709031731_all.deb
linux-headers-4.13.0-041300-generic_4.13.0-041300.201709031731_amd64.deb
linux-headers-4.13.0-041300-lowlatency_4.13.0-041300.201709031731_amd64.deb
linux-image-4.13.0-041300-generic_4.13.0-041300.201709031731_amd64.deb
linux-image-4.13.0-041300-lowlatency_4.13.0-041300.201709031731_amd64.deb
The first one is required, and then you need the rest of 2, which both has to match for example: both generic or both lowlatency.
You download all the files for example:
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.14/linux-headers-4.14.0-041400-generic_4.14.0-041400.201711122031_amd64.deb wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.14/linux-image-4.14.0-041400-generic_4.14.0-041400.201711122031_amd64.deb wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.14/linux-headers-4.14.0-041400_4.14.0-041400.201711122031_all.deb
Once the download is complete you need to install it with the following command:
dpkg -i *.deb
It may take up to few minutes, but once it is done you have to reboot the system for changes to become active:
reboot
After reboot you may check and make sure the kernel version is upgraded:
uname -sr
That is it. Your Kernel version is upgraded for your Ubuntu system.
Kernel upgrade for CentOS
We will be using ELRepo, a third-party repository that makes the upgrade to a recent version a kernel. To enable these repository you will need to execute the following commands:
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
Once you install the repositories, you will need to list the available packages:
yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
You will be presented will all the available packages, like this:
We will choose the main kernel package: kernel-ml (it is not shown in the image above since we installed it already). To upgrade your Kernel to the latest version use the following command:
yum --enablerepo=elrepo-kernel install kernel-ml
After the upgrade reboot the server:
reboot
Check the kernel version again:
uname -sr
Kernel version may not be changed instantly, so you will have to do the last changes and set default Kernel version in GRUB. Open a GRUB configuration:
nano /etc/default/grub
You will have to change one line as in the example below and save it:
GRUB_DEFAULT=0
The following command will recreate the Kernel configuration within GRUB:
grub2-mkconfig -o /boot/grub2/grub.cfg
One final reboot is need after this, and your Kernel version will be changed.