To obtain the kernel headers only:
# yum install kernel-devel
To get the kernel source, this will get a little complicated:
Download source rpm with yum
First we need to install the utility that will download the latest kernel source.
#yum install yum-utils
#yumdownloader –source kernel –enablerepo updates-source
This will download the src.rpm file.
Install the kernel source
Install the kernel source package downloaded above:
#rpm -ivh kernel-2.6.18-1.2849.fc6.src.rpm
#rpmbuild -bp –target=$(uname -m) /usr/src/redhat/SPECS/kernel-2.6.spec
The source will now be located in two directories underneath /usr/src/redhat/BUILD/kernel-2.6.18/. vanilla will contain the standard kernel.org source tree (without patches). linux-2.6.18.ARCH will contain the patched redhat kernel sources.