CentOS 7.9 Kernel Upgrade Guide

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.

    1. Import the ELRepo public key:
    2. sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
    3. Install the ELRepo repository:
    4. 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

    1. List available kernels:
    2. yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
    3. Install the latest mainline kernel:
    4. sudo yum --enablerepo=elrepo-kernel install kernel-ml

    Option 2: Install the Latest Long-Term Support Kernel

    1. List available LTS kernels:
    2. yum --disablerepo="*" --enablerepo="elrepo-kernel" list available | grep lt
    3. Install the latest LTS kernel:
    4. sudo yum --enablerepo=elrepo-kernel install kernel-lt

    ⚙️ Step 4: Update the GRUB Configuration

    1. Check the GRUB menu entries:
    2. 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.

    3. Set the default GRUB entry:
    4. 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

    1. Reboot your system:
    2. sudo reboot
    3. Verify the new kernel:
    4. 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.

Scroll to Top