How to update your kernel CentOS 6

The kernel is the main component of your operating system and provides the core functions for your system's applications. Kernel updates are released periodically as new functionality and, most importantly, security updates are incorporated. This article will show you how to update your system's kernel.

[1] Login to your server via SSH as the root user.

[2] From the command prompt, run:

[root@ /]# yum update kernel*

You will be prompted to accept the new kernel. Note the kernel version displayed and enter "y" to accept the new kernel. In our example, 2.6.32-279.1.1.el6 will be the new version we're installing.

 Package             Arch       Version              Repository           Size
  kernel             x86_64     2.6.32-279.1.1.el6   updates              22 M
 Transaction Summary
 Install          1 Package(s)
 Upgrade       0 Package(s)
 Total download size: 22 M
Is this ok [y/N]: y

After accepting the installation, the kernel will be downloaded and installed.

Downloading Packages:
kernel-2.6.32-279.1.1.el6.x86_64.rpm                                                             |  22 MB     00:02
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : kernel                                                                          1/1
Installed:  kernel.x86_64 0:2.6.32-279.1.1.el6

[3] The grub.conf file maintains a list of available kernels and defines which kernel will be used when your operating system starts. Let's check your server's grub.conf to ensure it's configured to boot the new kernel. Open the grub.conf file in your favorite text editor, we'll use nano in this example.

[root@ /]# nano /boot/grub/grub.conf

[4] Let's take a look at an example grub.conf.

# grub.conf generated by anaconda
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/sda8
#          initrd /initrd-version.img
title CentOS (2.6.32-279.1.1.el6)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.32-279.1.1.el6 ro root=LABEL=/
        initrd /boot/initrd-2.6.32-279.1.1.el6.img
title CentOS (2.6.32-220.23.1.el6)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.32-220.23.1.el6 ro root=LABEL=/
        initrd /boot/initrd-2.6.32-220.23.1.el6.img

This line:


indicates which kernel will be loaded from the available kernels in this file. The kernels are referenced starting from zero, so a value of 0 indicates to use the first kernel, 1 indicates to use the second, 2 the third, and so on. You can see above that "default" has a value of 1, which indicates to use the 2.6.18-274.3.1.el5 kernel on reboot. Changing this to 0 will cause the first kernel listed to be loaded upon reboot. Change the "default" value as appropriate to load the new kernel you installed. Generally, you can change this to 0 and load the top-most kernel listed in grub.conf.

[5] Reboot your server.

[6] Once the server comes back online, login via SSH as the root user. We'll now check to see that the proper kernel was loaded. We can use the uname command to do this.

[root@ /]# uname -r
  • 4 Users Found This Useful
Was this answer helpful?

Related Articles

How to connect to your server via SSH using PuTTY

You will need the Acenet recommended SSH client PuTTY downloaded to your local machine before...

How to Fix an IPtables Lockout (VPS/Dedicated Server w/cPanel)

If you're unable to access your server via SSH because of a rule added to iptables in error, it...

How to Install APC on CentOS 6

APC (Alternative PHP Cache) is an opcode cache for PHP. APC provides a caching system for...

How to install Apache Tomcat using WHM (Web Host Manager)

This article is for client's with virtual and dedicated servers. Apache Tomcat is not supported...

How to Disable a Specific Rule for Mod security on a Single Domain

This article pertains specifically to Dedicated Servers and Virtual Servers. The apache...