Refreshing your CentOS, cPanel, or Fedora kernel is a breeze. Just remember a few key steps to avoid any hiccups.
Just a Quick Heads up: This guide is specifically for CentOS 6 and cPanel servers.
1. Limit the number of kernels installed
This helps prevent your /boot partition from filling up due to constant kernel additions.
First, log into your server using SSH
Then, type:
yum install yum-utils
package-cleanup --oldkernels --count=2
Next, modify /etc/yum.conf to set an install limit:
pico /etc/yum.conf
Add or update the following line: installonly_limit=2
Save with: Ctrl-O
Exit with: Ctrl-X
2. Refresh the kernel
For most VPSes, a symbolic link like /etc/grub.conf -> /boot/grub/grub.conf is already set up, so no need to manually update grub config.
To verify the symbolic link, type:
ls -la /etc/grub.conf
If it returns:
lrwxrwxrwx 1 root root 20 Sep 10 2015 /etc/grub.conf -> /boot/grub/grub.conf
No need to fret about the date, as long as it points to /boot/grub/grub.conf, you're good to go. If the symlink isn't there, you can either contact support for help or type these commands:
cp /boot/grub/grub.conf /root/grub.conf
rm /etc/grub.conf
cd /etc
ln -s /boot/grub/grub.conf /etc/grub.conf
You're now ready to update the kernel:
Type: yum update
Answer all questions with yes
You should see something like this:
Running Transaction
Installing : kernel-2.6.32-504.23.4.el6.x86_64 1/2
Cleanup : kernel-2.6.32-431.29.2.el6.x86_64 2/2
Verifying : kernel-2.6.32-504.23.4.el6.x86_64 1/2
Verifying : kernel-2.6.32-431.29.2.el6.x86_64 2/2
Removed:
kernel.x86_64 0:2.6.32-431.29.2.el6
Installed:
kernel.x86_64 0:2.6.32-504.23.4.el6
All done!
root@ls1 [/etc]#
Here's a single command to set kernel count and get the newest kernel:
[ ! -h /etc/grub.conf ] && mv -f /etc/grub.conf /boot/grub/grub.conf && ln -s /boot/grub/grub.conf /etc/grub.conf
yum install yum-utils -y && package-cleanup --oldkernels --count=2 -y && sed -i 's/installonly_limit=.*/installonly_limit=2/g' /etc/yum.conf && yum clean all && yum update -y
Time to restart your server:
Just type: reboot