Setting up the kernels on your Centos 6/RHEL installation is pretty straightforward and installing basic compile tools ensures that you can build from source if necessary, although it is recommended to use the repos unless this is unavoidable.
If you are using Nvidia graphics drivers this is essential and
meaning you have got 2 different ones installed
$ rpm -qa | grep kernel
Shows the kernel files you have, similar to below
kernel-firmware-2.6.32-279.1.1.el6.noarch
dracut-kernel-004-284.el6_3.noarch
kernel-2.6.32-279.1.1.el6.i686 New
kernel-2.6.32-279.el6.i686 Old
With old from the original install and the newly released one installed on update.
Reboot and boot from the new kernel (press the space bar)
Remove the old one
$ sudo yum -y remove kernel-2.6.32-279.el6.i686
And add matching headers and devel
$ sudo yum -y install kernel-headers kernel-devel
Repeat the command above to check they match as below
kernel-devel-2.6.32-279.1.1.el6.i686
kernel-headers-2.6.32-279.1.1.el6.i686
kernel-firmware-2.6.32-279.1.1.el6.noarch
dracut-kernel-004-284.el6_3.noarch
kernel-2.6.32-279.1.1.el6.i686
Now you have a correct /usr/src/kernels folder so you can install gcc and basic tools
$
sudo yum -y install gcc gcc-c++ automake autoconf make
Add any others
that you require and you should be able to compile without kernel errors.
Labels: Centos 6, compile tools, matched kernels, RHEL