Skip to content

Instantly share code, notes, and snippets.

@FalconIA
Created July 13, 2024 11:39
Show Gist options
  • Save FalconIA/04ee100d2a6b9bd7df184897f06f66ec to your computer and use it in GitHub Desktop.
Save FalconIA/04ee100d2a6b9bd7df184897f06f66ec to your computer and use it in GitHub Desktop.
Upgrade Kernel of CentOS 7 (RHEL 7)

Upgrade Kernel of CentOS 7 (RHEL 7)

  1. Install elrepo

    wget https://elrepo.org/linux/kernel/el7/x86_64/RPMS/elrepo-release-7.0-8.el7.elrepo.noarch.rpm
    sudo rpm -Uvh elrepo-release-7.0-8.el7.elrepo.noarch.rpm
    sudo vi -i 's|http://elrepo.org/linux|https://linux.cc.iitk.ac.in/mirror/centos|g' /etc/yum.repos.d/elrepo.repo
  2. List available Kernels

    sudo yum list available --disablerepo='*' --enablerepo=elrepo-kernel
  3. Install kernel-lt

    sudo yum --enablerepo=elrepo-kernel install kernel-lt
    #sudo yum remove kernel-headers kernel-tools kernel-tools-libs 
    #sudo yum --enablerepo=elrepo-kernel install kernel-lt kernel-lt-headers kernel-lt-tools kernel-lt-tools-libs
  4. Install kernel-lt or kernel-ml

    • kernel-lt (long term support)

      sudo yum --enablerepo=elrepo-kernel install kernel-lt
      #sudo yum remove kernel-headers kernel-tools kernel-tools-libs 
      #sudo yum --enablerepo=elrepo-kernel install kernel-lt-headers kernel-lt-tools kernel-lt-tools-libs
    • kernel-ml (mainline stable)

      sudo yum --enablerepo=elrepo-kernel install kernel-ml
      #sudo yum remove kernel-headers kernel-tools kernel-tools-libs 
      #sudo yum --enablerepo=elrepo-kernel install kernel-ml-headers kernel-ml-tools kernel-ml-tools-libs
  5. Check installed Kernels

    rpm -qa | grep kernel | sort
  6. Active Kernel without reboot (If need)

    sudo kexec -u
    sudo kexec -l /boot/vmlinuz-5.4.278-1.el7.elrepo.x86_64 --initrd=/boot/initramfs-5.4.278-1.el7.elrepo.x86_64.img --reuse-cmdline
    sudo systemctl kexec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment