This guide explains how to replace cPanel's hardened kernel with a standard third-party kernel. While cPanel provides a preconfigured hardened kernel, you have the flexibility to install an alternative kernel version. Note that this process requires a server reboot and will cause downtime, so plan accordingly.

Prerequisites

Before proceeding, it is recommended to enable symlink protection when removing the hardened kernel. Ensure you have SSH root access to your server. Additionally, make sure to back up any critical data or configurations before making changes to the kernel. Familiarize yourself with the potential risks associated with changing kernels and ensure that the new kernel version is compatible with all your server's hardware and software.

How to Replace the Kernel

  1. Step 1: Remove the cPanel kernel repository

    Log in to your server via SSH and remove the cPanel kernel repository file. This step ensures that you do not accidentally reinstall the hardened kernel later.

    rm /etc/yum.repos.d/cPkernel.repo
  2. Step 2: List available kernels

    View all available kernel versions that can be installed. This command will display a list of kernel packages along with their versions, allowing you to choose the one that suits your needs.

    yum list --showduplicates kernel
  3. Step 3: Install your chosen kernel

    Install the kernel version of your choice by replacing KERNELNAME with the specific version. It is crucial to select a stable and compatible kernel version to avoid system instability.

    yum install KERNELNAME

    For example, to install kernel version 3.10.0-1160.el7.x86_64:

    yum install kernel-3.10.0-1160.el7.x86_64

    Note: It is recommended to install the most recent stable kernel version available that is compatible with your server's hardware and software.

  4. Step 4: Verify the installed kernel

    Before rebooting, verify that the new kernel has been successfully installed. This step ensures that you have the correct version before proceeding to a system restart.

    rpm -q kernel

    This command will list all installed kernels on your system. Look for the newly installed kernel in the output.

  5. Step 5: Reboot the server

    Once the installation is complete, reboot your server to load the new kernel. This step will apply the changes and switch to the newly installed kernel version.

    reboot

    After the server reboots, log back in via SSH to ensure that the system is running on the correct kernel version.

  6. Step 6: Verify the active kernel

    Check which kernel is currently active after the reboot. This step confirms that the server has successfully booted into the new kernel.

    uname -r

    This command will display the version of the currently running kernel, allowing you to verify that the change was successful.

Tips and Considerations

  • Test in a Safe Environment: If possible, test the new kernel in a staging or development environment before applying it to your production server. This helps identify any potential issues before they affect live services.
  • Monitor System Performance: After switching kernels, closely monitor system performance and stability. Keep an eye on logs for any unusual behavior or errors that may indicate compatibility issues.
  • Consult Documentation: Review the documentation of both the new kernel and your server's hardware to ensure full compatibility. Pay special attention to driver support and hardware requirements.