Upgrading CentOS kernel to the latest version
Step-by-step guide
Step #1. Update the installed packages and install the fastestmirror package
(needed to select the most available repository for installation at the time)
yum -y install yum-plugin-fastestmirror
Step #2. Import the public key of the ELRepo repository and install this repository
Step #3. Clear the yum cache before installing
Step #4. Install thekernel-ml package from the installed repository
Step #5. Check the version of the installed kernel in the OS loader
To do this, you can use the following command:
The output will look like this
0 : CentOS Linux (5.3.8-1.el7.elrepo.x86_64) 7 (Core)
1 : CentOS Linux (3.10.0-1062.4.1.el7.x86_64) 7 (Core)
2 : CentOS Linux (3.10.0-957.el7.x86_64) 7 (Core)
3 : CentOS Linux (0-rescue-14dc8360d3c94457b2b096d6da6b8737) 7 (Core
As you can see the latest version of the kernel is marked as option 0. We set this option as the default option for the bootloader and regenerate its configuration.
grub2-mkconfig -o /boot/grub2/grub.cfg
After that, we reboot the system and after loading we check the installed kernel version
Linux 5.3.8-1.el7.elrepo.x86_64 x86_64
As you can see, the system booted with the correct kernel version. After that, you can uninstall older versions
package-cleanup --oldkernels