Questions? Feedback? powered by Olark live chat software
Author Avatar

Kernel CentOS, cPanel & Fedora Update

Written by: on 11 April 2014 03:00 PM 11 April 2014 03:00 PM

This guide provides instruction to check your server kernel information & upgrade your server to latest kernel. Read & learn.

To update the kernel in CentOS, cPanel or Fedora is very simple. However, there are a few tricks to ensure you don't run into trouble.

Note: This article applies to CentOS 6 and cPanel servers. Clients with CentOS 7 installed should read this article.

1. Set a maximum number of installed kernels

This ensure you will not run out of disk space in the /boot partition by continually adding new kernels.

  • Logging into your server via SSH
  • Type:
    • yum install yum-utils
    • package-cleanup --oldkernels --count=2
  • Edit /etc/yum.conf and set an install limit:
    • pico /etc/yum.conf
    • Enter or update the line if it exists: installonly_limit=2
    • Save: Ctrl-O
    • Quit: Ctrl-X

2. Update the kernel

On most VPSes there is a symbolic link created as:  /etc/grub.conf -> /boot/grub/grub.conf and there is no need to update grub config manually.

To check if there is symbolic link type the command:

ls -la /etc/grub.conf

If the output is as below:

lrwxrwxrwx 1 root root 20 Jun 30  2014 /etc/grub.conf -> /boot/grub/grub.conf

Don't worry about the date, as long as it points to the /boot/grub/grub.conf then the symlink is in place correct you are ok. If the symlink does not exist you can either email support and have us check and update the kernel for you. Or type the following commands:

  • cp /boot/grub/grub.conf /root/grub.conf
  • rm /etc/grub.conf
  • cd /etc
  • ln -s /boot/grub/grub.conf /etc/grub.conf

Now all is prepared to update the kernel:

  • Type: yum update
  • Answer yes to all the questions

It will display something similar to 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

kernel.x86_64 0:2.6.32-431.29.2.el6

kernel.x86_64 0:2.6.32-504.23.4.el6

root@vps [/etc]#

Single Commands to set number of kernels and install the latest 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

Reboot your server:

  • Type: reboot


(5 vote(s))
Not helpful