Technically, Linux is just a POSIX-compliant kernel.It provides a set of application programming interfaces (APIs) through which user programs can interact with the kernel and hardware.A kernel alone is not a complete operating system.There is a complete operating system based on the Linux kernel called the Linux operating system, or GNU/Linux (which contains many of the system components of the GNU Project). - From the wiki

During normal operation, the kernel is responsible for performing two important tasks:

  • Serves as an interface between the hardware and the software running on the system.
  • Manage system resources as hilariously as possible

1、Detecting installed kernel version

View the currently running kernel version

#uname -sr

The default kernel version for Centos 7 is Linux 3.10.x.

For the latest version you can visit the https://www.kernel.org website.

2、Upgrading the kernel in Centos 7

Install the ELRepo repository and use this third-party repository to upgrade the kernel to the latest version.

#rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
#rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

Once the repository is started, use the following command to list the available kernel-related packages:

#yum --disablerepo="*" --enablerepo="elrepo-kernel" list available

Find the kernel-ml.x86_64 line and you can see the version number displayed in the center

Install the latest mainline stable kernel

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

3、Setting grub’s default kernel version

GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved # This sets saved to 0
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

Then recreate the kernel configuration

#grub2-mkconfig -o /boot/grub2/grub.cfg
#reboot

After rebooting, log in to the system and type uname -sr to verify that the kernel was upgraded successfully.