How to Use Standard Kernel Instead of Hardened One?
In web hosting, cPanel is a commonly used third-party graphical control panel that helps manage website hosting through a simple interface and automation. cPanel servers may use KernelCare to improve security by applying kernel patches without requiring a server reboot.
However, in some situations, administrators may need to replace a hardened kernel with a standard kernel due to compatibility issues or specific performance requirements.
In this guide, we explain the process of replacing the hardened kernel of a cPanel server with a standard kernel.
Types of Kernel
There are two types of kernels discussed in this guide.
1. Hardened Kernel
A hardened kernel is modified to improve security and reduce vulnerabilities that attackers could exploit. KernelCare is used to ensure that security updates or patches can be applied without requiring a server reboot, helping to reduce downtime.
2. Standard Kernel
A standard kernel is generally provided by operating system distributions such as Ubuntu or CentOS. It does not necessarily include the additional security modifications and live-patching features associated with a hardened kernel. It follows the patches and updates provided by operating system maintainers.
Steps to Replace the Hardened Kernel
Step 1: Back Up and Prepare for Setup
Ensure that you have proper backups and access to the server console.
This is very important because kernel changes can render your system unbootable if they are not performed carefully.
Step 2: Check the Existing Kernel
Check the current kernel version to confirm which kernel is currently running.
Run the following command:
uname -r
This command displays the current kernel version. If you are using a hardened kernel, proceed with the following steps.
Step 3: Install the Standard Kernel
For CentOS/RHEL systems, install the standard kernel by running the following command:
yum install kernel
For Ubuntu/Debian systems, use:
apt-get install linux-image-generic
Step 4: Update the Bootloader
After installing the standard kernel, update the bootloader to ensure that the system boots with the newly installed kernel.
For CentOS/RHEL systems, run:
grub2-set-default 0
For Ubuntu/Debian systems, run:
update-grub
Step 5: Remove the Hardened Kernel
To prevent the system from reverting to the hardened kernel, the original procedure suggests removing KernelCare.
For CentOS/RHEL systems, use:
yum remove kernelcare
For Ubuntu/Debian systems, use:
apt-get remove kernelcare
Step 6: Reboot the Server
After making the required changes, reboot the server to load the newly selected kernel.
Run:
reboot
Step 7: Verify the Changes
Once the server has rebooted, verify that it is using the standard kernel.
Run the following command:
uname -r
Ensure that the output matches the version of the standard kernel you installed.
Things to Consider After Replacement
Here are some important things to consider once the replacement is completed.
1. Backup and Recovery
Maintain a strong backup and recovery plan. Kernel updates and changes can result in unexpected issues. Therefore, ensure that proper backups are available so you can restore the system quickly whenever required.
2. Security Patches
Without KernelCare, you need to ensure that security patches and updates are regularly applied to your kernel.
For RHEL/CentOS systems, use:
yum update kernel
For Debian/Ubuntu systems, use:
apt-get update && apt-get upgrade
3. Continuous Monitoring and Maintenance
Monitor your systems for performance and stability. Replacing the kernel may cause changes in server behavior, so monitoring tools and system logs can help you identify issues at an early stage.
Conclusion
By following the above steps, you can transition from a hardened kernel to a standard kernel on your cPanel server. Ensure that proper backups, security updates, and continuous monitoring are maintained to help preserve server stability and security.