Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to upgrade Linux kernel on CentOS 7

Confirm the current kernel version:

$ uname -snr
Linux 3.10.0-1062.18.1.el7.x86_64 x86_64

Add the ELRepo repository:

yum update -y
rpm --import
rpm -Uvh

Confirm there is an LTS kernel upgrade available:

yum list available --disablerepo='*' --enablerepo=elrepo-kernel | grep kernel-lt

Install the latest LTS kernel:

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

List available kernel versions:

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

Change the default kernel and reboot:

grub2-set-default 0
grub2-mkconfig -o /boot/grub2/grub.cfg

Confirm the new kernel when the server is back online:

$ uname -msr
Linux 4.4.223-1.el7.elrepo.x86_64 x86_64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment