Install Old Linux Kernel on CentOS 7

I wanted to test few old privilege escalation exploits like DirtyC0w on a CentOS 7 VM, but I had trouble switching to older kernel versions since the repository didn’t had the kernel version I wanted to install and most of the tutorials were about updating to latest kernel version.

After referring to various guides, this is the method that worked for me:

  1. Visit CentOS Wikipedia and refer to which version has the kernel version you require.

  2. Navigate to the selected CentOS version on CentOS vault. For example I selected version 7.1.1503.

  3. Copy the link similar to this -> and add this to the repository in your local machine.

    sudo yum-config-manager --add-repo= && \
    yum repolist all

    You can go to Packages and select the kernel version you want to install.

    Kernel version list

    I selected kernel-3.10.0-229.1.2.el7.x86_64.rpm and execute the following:

    sudo yum install -y kernel-3.10.0-229.1.2.el7.x86_64

    Note: Install package name must be without .rpm extention.

  4. List all the installed kernels.

    awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg

    Installed kernel list

  5. Select the default kernel to boot

    sudo grub2-set-default 3

    NOTE: Label list starts from 0, so to select 4th entry we set 3 as default.

  6. Update the setting we just made.

    sudo grub2-mkconfig -o /boot/grub2/grub.cfg
  7. Reboot the system and check the kernel version using uname -r




comments powered by Disqus