Skip to content
Luca Dell'Oca Principal Cloud Architect @Veeam
Virtual To The Core Virtual To The Core

Virtualization blog, the italian way.

  • Media
  • About me
Virtual To The Core
Virtual To The Core

Virtualization blog, the italian way.

Use updated kernel in CentOS 7

Luca Dell'Oca, January 19, 2016December 4, 2016

CentOS is known for not using the latest versions of the Linux kernel. If you need up-to-date versions, you need to configure the OS to use different repositories.

The turtle and the hare

Among the different linux distributions, I’ve always liked and used CentOS. It’s a great solution, it helps also to learn RedHat in case one would have to work with it, and has tons of resources available online to learn and get help. But one of the limits in CentOS has always been the lack of up-to-date kernels. This article has been written in November 2015, and while the latest stable kernel of Linux is 4.2.6:

Linux kernels as of November 2015
Available Linux kernels as of November 2015

on a completely up-to-date CentOS 7 machine, the used kernel is quite older:

view source
1[root@linux-repo ~]# uname -r
23.10.0-229.20.1.el7.x86_64

Note, I’ve not said “outdated”, if you look at the list 3.10 is there as “longterm”. It’s good for production environments to use really stable and tested versions of the kernel, but I use a lot technologies like Ceph and BTRFS, and for those to work properly it’s recommended to use the latest possible kernels, as enhancements to those software is made available as kernel is updated. For example, I was facing an issue with the rebalancing of a BTRFS partition spread among different disks, and I found a fix was made available in kernel 3.14. So, I had to find a way to have newer kernels in my CentOS machines.

Install newer kernel on CentOS

As the main repository of CentOS has no newer version of the kernel, we need first of all to use a 3rd party repository. New kernels for CentOS are available via “ELRepo”.
First, we download the GPG key of ELRepo and install the elrepo-release package.

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

Now, we enable the repository (vi /etc/yum.repos.d/elrepo.repo and set enabled to 1 for [elrepo-kernels] ); then, we need to remove the old kernel headers to avoid conflicts:

view source
1yum remove kernel-headers kernel-tools kernel-tools-libs

and finally ask yum to install the new kernel packages:

view source
1yum install kernel-ml kernel-ml-headers kernel-ml-tools kernel-ml-tools-libs kernel-ml-tools-libs-devel

Yum offers us to install the 4.3 version (as of November 2015). Now, we check how the different kernels are listed in the GRUB configuration file:

view source
01[root@linux-repo ~]# grep vmlinuz /boot/grub2/grub.cfg
02 
03linux16 /vmlinuz-4.3.0-1.el7.elrepo.x86_64 root=/dev/mapper/centos_linux--demo-root ro crashkernel=auto rd.lvm.lv=centos_linux-demo/swap rd.lvm.lv=centos_linux-demo/root rhgb quiet LANG=en_US.UTF-8 systemd.debug
04 
05linux16 /vmlinuz-4.3.0-1.el7.elrepo.x86_64 root=/dev/mapper/centos_linux--demo-root ro crashkernel=auto rd.lvm.lv=centos_linux-demo/swap rd.lvm.lv=centos_linux-demo/root rhgb quiet LANG=en_US.UTF-8 systemd.debug
06 
07linux16 /vmlinuz-3.10.0-229.20.1.el7.x86_64 root=/dev/mapper/centos_linux--demo-root ro crashkernel=auto rd.lvm.lv=centos_linux-demo/swap rd.lvm.lv=centos_linux-demo/root rhgb quiet LANG=en_US.UTF-8 systemd.debug
08 
09linux16 /vmlinuz-3.10.0-229.20.1.el7.x86_64 root=/dev/mapper/centos_linux--demo-root ro crashkernel=auto rd.lvm.lv=centos_linux-demo/swap rd.lvm.lv=centos_linux-demo/root rhgb quiet LANG=en_US.UTF-8 systemd.debug
10 
11linux16 /vmlinuz-3.10.0-229.el7.x86_64 root=/dev/mapper/centos_linux--demo-root ro crashkernel=auto rd.lvm.lv=centos_linux-demo/swap rd.lvm.lv=centos_linux-demo/root rhgb quiet LANG=en_US.UTF-8
12 
13linux16 /vmlinuz-0-rescue-2612c655a4034118a6cbc12ae78334ba root=/dev/mapper/centos_linux--demo-root ro crashkernel=auto rd.lvm.lv=centos_linux-demo/swap rd.lvm.lv=centos_linux-demo/root rhgb quiet

As we want the newer 4.3 kernel to be used by default, we tell grub to do so (0 is the first entry of the list)

view source
1grub2-set-default 0
2grub2-mkconfig -o /boot/grub2/grub.cfg

After a reboot, we will have our CentOS machine using the latest kernel:

view source
1[root@linux-repo ~]# uname -r
24.3.0-1.el7.elrepo.x86_64

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to email a link to a friend (Opens in new window) Email
  • Click to share on Tumblr (Opens in new window) Tumblr
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to share on Pocket (Opens in new window) Pocket
Tech 7centoskernelnewupdatedyum

Post navigation

Previous post
Next post

Search

Sponsors

Latest Posts

  • Migrate WSL (Windows Subsystem for Linux) to a new computer
  • Pass keystrokes to a pfSense virtual machine to install it automatically
  • Automatically deploy pfSense with Terraform and Ansible
  • My Automated Lab project: #6 Create a S3 Bucket with Terraform
  • My Automated Lab project: #5 Deploy a Linux vSphere VM with Terraform and custom disks
©2025 Virtual To The Core | WordPress Theme by SuperbThemes
  • Media
  • About me
We use cookies to ensure that we give you the best experience on our website, and to collect anonymous data regarding navigations stats using 3rd party plugins; they all adhere to the EU Privacy Laws. If you continue to use this site we will assume that you are ok with it.OkNoPrivacy Policy