Upgrading the kernel always gives me trouble on CentOS 7.x so here's some notes on how I did it:

1. Figure out what your current active kernel is:

Current kernel:

uname -a
Linux kernelupgrade 3.10.0-327.10.1.el7.x86_64 #1 SMP Tue Feb 16 17:03:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

2. Install theĀ ELRepo repository:

Install the ELRepo repository:

yum -y install http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

Install the ML kernel (mainline) - at the time of writing this got me kernel 4.11:

yum -y --disablerepo=* --enablerepo=elrepo-kernel install kernel-ml

Check kernels available to boot with, using the command: `awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg`:

awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : CentOS Linux (4.11.0-1.el7.elrepo.x86_64) 7 (Core)
1 : CentOS Linux (3.10.0-327.10.1.el7.x86_64) 7 (Core)
2 : CentOS Linux (0-rescue-17115f95ddd92d410be8cb803e2d845d) 7 (Core)

3. Figure out what your current default kernel for booting is and change it:

OK- and what's the current default boot kernel ? Use the `grub2-editenv list` command:

grub2-editenv list
saved_entry=CentOS Linux (3.10.0-327.10.1.el7.x86_64) 7 (Core)

To set the 4.11.0 kernel above as the default, we need to select option "0" (since it's the 1st on the list) - we use the `grub2-set-default` command:

grub2-set-default 0
# the above command has no output

Now check what's the default again - we can see it has changed:

grub2-editenv list
saved_entry=0

4. Reboot your system for the kernel change to take effect:

reboot now

After the reboot:

uname -a
Linux kernelupgrade 4.11.0-1.el7.elrepo.x86_64 #1 SMP Mon May 1 09:01:59 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux

5. What if we also want to install theĀ kernel-lt (long term support) kernel?

To install the kernel-lt we can do this:

yum -y --disablerepo=* --enablerepo=elrepo-kernel install kernel-lt

Let's check the available kernels again:

awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : CentOS Linux (4.4.66-1.el7.elrepo.x86_64) 7 (Core)
1 : CentOS Linux (4.11.0-1.el7.elrepo.x86_64) 7 (Core)
2 : CentOS Linux (3.10.0-327.10.1.el7.x86_64) 7 (Core)
3 : CentOS Linux (0-rescue-17115f95ddd92d410be8cb803e2d845d) 7 (Core)

Once again, let's check what's the current default:

grub2-editenv list
saved_entry=CentOS Linux (4.11.0-1.el7.elrepo.x86_64) 7 (Core)

Let's change it to the 4.4.66 kernel, which is in position "0" again:

grub2-set-default 0

And check again:

grub2-editenv list
saved_entry=0

OK, now reboot:

uname -a
Linux kernelupgrade 4.4.66-1.el7.elrepo.x86_64 #1 SMP Thu May 4 08:30:11 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux

woohoo! and we're done!

Sources: