How to Check and Upgrade your Linux Kernel Version via Command Line in CentOS 7

This article describes how to check and upgrade the Linux kernel in OpenVZ, KVM, and Dedicated Servers (including the CloudLinux platform).

Checking the Kernel Version

To check system parameters such as the kernel version and build date, OS architecture, hostname, etc., you can use the uname command, which is included in coreutils package:

# uname -rv
3.10.0-693.11.6.el7.x86_64 #1 SMP Thu Jan 4 01:06:37 UTC 2018

To view the current kernel version and build date, run uname -r. Depending on the platform your server is running on, you may see slightly different output, even for the same CentOS 7 operating system.

If you run a VPS (Virtual Private Server) as an OpenVZ container, you will see the "stab" in the kernel version:

# uname -r

If you run CentOS 7 on a Dedicated Server or a KVM virtual server, you could see "el7" in the kernel version, which refers to Red Hat Enterprise Linux, from which CentOS is derived:

# uname -r

If you are running CloudLinux, you could see "lve" in the kernel version:

# uname -r

Another way to check would be with the following yum command:

yum info kernel -q

This command may run noticeably longer, because yum uses a python interpreter and one or more plugins by default. However, it gives more detailed information. Here is an example of possible output from this command:

# yum info kernel -q
Available Packages
Name        : kernel
Arch        : x86_64
Version     : 3.10.0
Release     : 693.11.6.el7
Size        : 43 M
Repo        : updates/7/x86_64
Summary     : The Linux kernel
URL         :
License     : GPLv2
Description : The kernel package contains the Linux kernel (vmlinuz), the core of any
            : Linux operating system.  The kernel handles the basic functions
            : of the operating system: memory allocation, process allocation, device
            : input and output, etc.

Upgrading the Linux Kernel

If you have a VPS as an OpenVZ container, it is not possible to upgrade your kernel independently, because all virtual containers run the same kernel loaded on the node. Therefore, voluntary upgrade can be performed only on Dedicated Servers and KVM-based virtual servers.

To upgrade the kernel, you can run this yum command:

yum upgrade kernel

By default, this command should ask for confirmation to install new kernel:

Is this ok [y/d/N]:

If you want to skip the confirmation, you can use the -y switch:1)

yum upgrade kernel -y

Once the new kernel is installed you need to load it. To do so, you need to reboot the server:


Once the server has finished rebooting, you should check the loaded kernel version as described in previous section.

KernelCare Usage

KernelCare is a live-patching software for Linux kernels distributed by CloudLinux. When using KernelCare, the server does not require rebooting for kernel upgrades, and kernel patches are checked and applied on the fly automatically every 4 hours. It is available only for Dedicated Servers and KVM virtual servers.

You can check if KernelCare is installed as follows:

# yum info kernelcare -q
Installed Packages
Name        : kernelcare
Arch        : x86_64
Version     : 2.14
Release     : 2
Size        : 217 k
Repo        : installed
From repo   : kernelcare
Summary     : KernelCare tools
URL         :
Description : KernelCare userland tools

To check if patches have been applied, run:

kcarectl --info

More details about KernelCare can be found in the following places:

Removing Old Kernels

Sometimes you may need to remove old kernels from the server manually. To check all installed kernels, this yum command could be used again:

# yum list kernel -q
Installed Packages
kernel.x86_64                                       3.10.0-693.11.1.el7                                              @updates
kernel.x86_64                                       3.10.0-693.11.6.el7                                              @updates

Using the command package-cleanup with the --oldkernels switch would remove all old kernels, leaving only 'count' most recent ones (by default count=2). For example, to remove all kernels except the one most recently installed and loaded, run the following command:

package-cleanup --oldkernels --count=1
However, it is not recommended to skip confirmations unnecessarily, especially for big changes like new kernels, since these especially should not be performed accidentally.
dedicated-servers/kernel-version.txt · Last modified: 2018/01/25 15:35 by Marjorie S.