Upgrade kernel version in Centos

Notes from the author: Probably you were spending some time looking up this answer like I did before you. If you are interesting in collaborate, let me know, you can DM me via twitter, linkedin or instagram. You can have an space in this blog. Appreciate if you can at least follow me via my social accounts. Thanks.

c, like:

[root@fss-a1 ~]# uname -r
3.10.0-1160.36.2.el7.x86_64

And you want to upgrade kernel version in Centos. Just execute:

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh https://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
yum --enablerepo=elrepo-kernel -y install kernel-lt
vim /etc/default/grub #change GRUB_DEFAULT=0
grub2-mkconfig -o /boot/grub2/grub.cfg
reboot

You should have something like (/etc/default/grub):

GRUB_TIMEOUT=1
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=0
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL="serial console"
GRUB_SERIAL_COMMAND="serial"
GRUB_CMDLINE_LINUX="console=tty0 crashkernel=auto net.ifnames=0 console=ttyS0"
GRUB_DISABLE_RECOVERY="true"

An output like:

[root@fss-a1 ~]# sudo grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.142-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-5.4.142-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1160.36.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.36.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1127.19.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1127.19.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1127.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1127.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-cab9605edaa5484da7c2f02b8fd10762
Found initrd image: /boot/initramfs-0-rescue-cab9605edaa5484da7c2f02b8fd10762.img
done
[root@fss-a1 ~]# reboot

After reboot you will have the new kernel

[root@fss-a1 ~]# uname -r
5.4.142-1.el7.elrepo.x86_64

Thanks.

Blog at WordPress.com.