Upgrading your CentOS Linux release 7.9 to the latest long-term support kernel can enhance your system’s security, stability, and performance. Here’s a step-by-step guide to help you through the process.
🛑 Prerequisites
Before proceeding, ensure that you:
- Are logged in as a user with
sudo
privileges. - Have a backup of important data.
- Understand thatIt seems the message was cut off. I’ll provide the conversion of the updated content into HTML starting from the point where the prerequisites are explained:
- Are logged in as a user with
sudo
privileges. - Have a backup of important data.
- Understand that upgrading the kernel can be risky, and it’s essential to follow the steps carefully.
📦 Step 1: Check Your Current Kernel Version
To see which kernel version you are currently running, use the following command:
uname -r
This command will display your current kernel version. Make a note of this in case you need to revert back to it.
🔄 Step 2: Enable ELRepo Repository
ELRepo is a repository that focuses on hardware-related packages. It’s a good source for stable kernel updates.
- Import the ELRepo public key:
- Install the ELRepo repository:
sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
sudo yum install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
🆕 Step 3: Install the New Kernel
Option 1: Install the Latest Mainline Kernel
- List available kernels:
- Install the latest mainline kernel:
yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
sudo yum --enablerepo=elrepo-kernel install kernel-ml
Option 2: Install the Latest Long-Term Support Kernel
- List available LTS kernels:
- Install the latest LTS kernel:
yum --disablerepo="*" --enablerepo="elrepo-kernel" list available | grep lt
sudo yum --enablerepo=elrepo-kernel install kernel-lt
⚙️ Step 4: Update the GRUB Configuration
- Check the GRUB menu entries:
- Set the default GRUB entry:
Use the provided command to list all the GRUB menu entries:
awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
Look for the entry that corresponds to the newly installed kernel.
If the latest kernel is at the top of the list, you can set it as the default by using:
sudo grub2-set-default 0
If it’s not the first entry, replace
0
with the appropriate number corresponding to the new kernel’s position.🔁 Step 5: Reboot and Verify
- Reboot your system:
- Verify the new kernel:
sudo reboot
Once your system reboots, log in and execute the following command:
uname -r
This should display the version of the kernel that you installed, whether it’s the mainline or the LTS version.
🛡 Step 6: Final Checks
After the upgrade, it’s crucial to:
- Check that all services are running as expected.
- Monitor the system for any unusual behavior.
Congratulations! 🎉 You have successfully upgraded your CentOS 7.9 kernel to the latest long-term support version.
- Are logged in as a user with