Operations 5 min read

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.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
How to Upgrade CentOS 7 Kernel to the Latest 5.4 Version Using ELRepo

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/Linux

View 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.rpm

List 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.elrepo

Install the latest long‑term (lt) kernel:

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

Verify 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 0

Remove old kernels (skip the running one):

# yum remove kernel -y

Reboot the system to load the new kernel:

# reboot

After 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/Linux
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxSystem AdministrationCentOSKernel upgradeELRepo
MaGe Linux Operations
Written by

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.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.