![](https://dexlinxnet.com/wp-content/uploads/2017/10/centos_logo-300x206.png)
What is a Kernel?
The kernel is the essential center of a computer operating system, the core that provides basic services for all other parts of the operating system. A synonym is nucleus. A kernel can be contrasted with a shell, the outermost part of an operating system that interacts with user commands.
What is the Currently Installed Kernel Version?
To find out the current installed version of the CentOS or any other linux version, use the following command.
# uname -r
In the Following output, the Kernel version is 4.13.7. We will discusss how to upgrade or downgrade as needed.
[test@myserver~]$ uname -r 4.10.1-1.el7.elrepo.x86_64
What is the Latest Kernel Distribution?
One important reason to update the kernel version is that eventually each version will approach to the end of life where no more fixes or enhancements will be added.
The latest Kernel versions are listed in https://www.kernel.org/
Upgrading CentOS 7 Kernel
To be able to access the ELRepo repository on CentOS 7, you will have to install the following:
# 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
You will see the following:
[root@myserver ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org [root@smyerver95 ~]# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm Retrieving http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm Retrieving http://elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm Preparing... ################################# [100%] Updating / installing... 1:elrepo-release-7.0-3.el7.elrepo ################################# [100%] [root@myserve ~]#
Next, you should be able see the contents elrepo:
# yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
With the following output as of the time of this post:
[root@myserver ~]# yum --disablerepo="*" --enablerepo="elrepo-kernel" list available Loaded plugins: fastestmirror, langpacks elrepo-kernel | 2.9 kB 00:00:00 elrepo-kernel/primary_db | 1.7 MB 00:00:01 Loading mirror speeds from cached hostfile * elrepo-kernel: elrepo.org Available Packages kernel-lt.x86_64 4.4.92-1.el7.elrepo elrepo-kernel kernel-lt-devel.x86_64 4.4.92-1.el7.elrepo elrepo-kernel kernel-lt-doc.noarch 4.4.92-1.el7.elrepo elrepo-kernel kernel-lt-headers.x86_64 4.4.92-1.el7.elrepo elrepo-kernel kernel-lt-tools.x86_64 4.4.92-1.el7.elrepo elrepo-kernel kernel-lt-tools-libs.x86_64 4.4.92-1.el7.elrepo elrepo-kernel kernel-lt-tools-libs-devel.x86_64 4.4.92-1.el7.elrepo elrepo-kernel kernel-ml.x86_64 4.13.7-1.el7.elrepo elrepo-kernel kernel-ml-devel.x86_64 4.13.7-1.el7.elrepo elrepo-kernel kernel-ml-doc.noarch 4.13.7-1.el7.elrepo elrepo-kernel kernel-ml-headers.x86_64 4.13.7-1.el7.elrepo elrepo-kernel kernel-ml-tools.x86_64 4.13.7-1.el7.elrepo elrepo-kernel kernel-ml-tools-libs.x86_64 4.13.7-1.el7.elrepo elrepo-kernel kernel-ml-tools-libs-devel.x86_64 4.13.7-1.el7.elrepo elrepo-kernel perf.x86_64 4.13.7-1.el7.elrepo elrepo-kernel python-perf.x86_64 4.13.7-1.el7.elrepo elrepo-kernel
Next you can install the latest mainline stable kernel or any other kernel needed for your particular application needs:
# yum --enablerepo=elrepo-kernel install kernel-ml
This will ask you to install version 4.13.7-1 above. Alternatively, if you issue the following command version 4.4.92-1 will be installed.
# yum --enablerepo=elrepo-kernel install kernel-lt
In the following, we will install the latest:
[root@myserver ~]# yum --enablerepo=elrepo-kernel install kernel-ml Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirror.hmc.edu * elrepo: repos.lax-noc.com * elrepo-kernel: repos.lax-noc.com * epel: mirrors.xmission.com * extras: mirror.scalabledns.com * updates: mirror.compevo.com Resolving Dependencies --> Running transaction check ---> Package kernel-ml.x86_64 0:4.13.7-1.el7.elrepo will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================== Package Arch Version Repository Size ============================================================================================================== Installing: kernel-ml x86_64 4.13.7-1.el7.elrepo elrepo-kernel 42 M Transaction Summary =============================================================================================================== Install 1 Package Total download size: 42 M Installed size: 190 M Is this ok [y/d/N]: y
Now reboot your system. After reboot use the “uname” command again to verify the new kernel is now running.
uname -r
[test@myserver ~]$ uname -r 4.13.7-1.el7.elrepo.x86_64
Optional: Set Default Kernel Version in GRUB
To boot the new version as default to modify the GRUB configuration::
Open and edit the file /etc/default/grub and set GRUB_DEFAULT=0. This means that the first kernel in the GRUB initial screen will be used as default.
GRUB_TIMEOUT=5 GRUB_DEFAULT=0 GRUB_TERMINAL_OUTPUT="console serial" GRUB_CMDLINE_LINUX="rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet console=ttyS0" GRUB_DISABLE_RECOVERY="true"
Next, run grub2-mkconfig command to recreate the kernel configuration.
# grub2-mkconfig -o /boot/grub2/grub.cfg
[root@s115-111 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... Found linux image: /boot/vmlinuz-4.13.7-1.el7.elrepo.x86_64 Found initrd image: /boot/initramfs-4.13.7-1.el7.elrepo.x86_64.img Found linux image: /boot/vmlinuz-3.10.0-693.2.2.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-693.2.2.el7.x86_64.img Found linux image: /boot/vmlinuz-3.10.0-514.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-514.el7.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-340f318856a74746911e877fbdbca5dd Found initrd image: /boot/initramfs-0-rescue-340f318856a74746911e877fbdbca5dd.img done
Once again, reboot the system and verify that the latest kernel is now being used by default.
You are all set with the latest CentOS Kernel! Yay!
10,115 total views, 1 views today