How to Upgrade CentOS 7 Kernel to the Latest 5.4 Version Using ELRepo
This guide walks through checking the current kernel, adding the ELRepo repository, listing available kernels, installing the latest long‑term 5.4 kernel on CentOS 7, setting it as default, removing old kernels, and verifying the upgrade after reboot.
First, check the current kernel version:
# uname -a
Linux localhost.localdomain 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/LinuxView the GRUB boot menu entries:
# awk -F' ' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : CentOS Linux (3.10.0-1160.el7.x86_64) 7 (Core)
1 : CentOS Linux (0-rescue-9c44fe6cef3746b2b96d834164eb6b07) 7 (Core)Install the ELRepo repository:
# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
# yum install -y https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpmList available kernel packages from ELRepo:
# yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
... (list truncated) ...
kernel-lt.x86_64 5.4.270-1.el7.elrepo
kernel-ml.x86_64 6.7.8-1.el7.elrepoInstall the latest long‑term (lt) kernel:
# yum --disablerepo='*' --enablerepo=elrepo-kernel install kernel-lt -yVerify the new kernel appears in the GRUB menu (it should be entry 0):
# awk -F' ' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : CentOS Linux (5.4.270-1.el7.elrepo.x86_64) 7 (Core)
1 : CentOS Linux (3.10.0-1160.el7.x86_64) 7 (Core)
2 : CentOS Linux (0-rescue-9c44fe6cef3746b2b96d834164eb6b07) 7 (Core)Set the new kernel as the default boot entry:
# grub2-set-default 0Remove old kernels (skip the running one):
# yum remove kernel -yReboot the system to load the new kernel:
# rebootAfter reboot, confirm the kernel version has been upgraded to 5.4:
# uname -a
Linux localhost.localdomain 5.4.270-1.el7.elrepo.x86_64 #1 SMP Fri Mar 1 17:34:36 EST 2024 x86_64 x86_64 x86_64 GNU/LinuxSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
