The yum command can be used to list the currently installed kernels. In this example, the architecture of the kernel is x86_64, and the version is 3.10.0-327.el7.
~]# yum list installed kernel Installed Packages kernel.x86_64 3.10.0-327.el7
Or, the uname command can be used to view the version and architecture of the current kernel.
~}# uname -r 3.10.0-327.el7.x86_64
In the prior examples, the following is the breakdown of the version.
- 3 - major version
- 10 - minor version
- 0 = revision
- 327.el7 = fix
- x86_64 = architecture
The apt-get -u update or yum check-update commands can be used to determine if a new kernel is available. If a new kernel is available, the new kernel will be displayed in the output.
[root@server1 ~]# yum check-update | grep kernel kernel.x86_64 220.127.116.11 updates kernel-tools.x86_64 18.104.22.168 updates kernel-tools-libs.x86_64 22.214.171.124 updates
The yum update kernel_name command can be used to install a new kernel. This will not overwrite the current kernel. If you cannot use yum to install a new kernel, you can download the kernel from https://www.kernel.org. Typically, kernels are downloaded from https://www.kernel.org/pub/linux/kernel/.
[root@server1 ]# yum update kernel_name . . . Installed: kernel.x86_64 0:3.10.0-514.26.2.el7
After the new kernel is installed, GRUB should automatically be configured to boot into the new kernel. This can be verified by confirming that the new kernel is the top most listing of the following command.
~]# grep ^menuentry /boot/grub2/grub.cfg menuentry 'CentOS Linux (3.10.0-514.26.2.el7.x86_64) . . . menuentry 'CentOS Linux (3.10.0-354.el7.x86_64) . . .
If you need to configure GRUB to boot into the prior kernel by default, use the following command. In this example, "1" represents the second menu entry of the prior command, and "0" would represent the first menu entry of the prior command.
~]# grub2-set-default 1