Install kernel source code: Installing kernel source code in RedHat or centos, kernel headers install
Both centos and rhel5 between des following packages:
Kernel-headers: It hosts des the C header files that specify the interface between the Linux kernel and userspace libraries and programs. the header files define structures and constants that are needed for building most standard programs and are also needed for rebuilding the glibc package.
Kernel-devel: This package provides kernel headers and makefiles sufficient to build modules against the kernel package.
C) actual kernel source code: You can always download actual source code here. Look for Kernel *. RPM file.
RHEL/centos 5 install kernel Headers
Use Yum command as follows:
# Yum install kernel-devel kernel-headers
Install kernel source code
Type the command as follows:
# Cd/tmp
# Wget ftp://ftp.redhat.com/pub/redhat/linux/enterprise/5Server/en/ OS /SRPMS/kernel-2.6.18-8.1.8.el5.src.rpm
# Rpm-IVH kernel-2.6.18-8.1.8.el5.src.rpm
Note change version number as per your current kernel.
For recompiling or adding a new module or device driver you just need kernel-devel and kernel-headers packages. to rebuilt kernel RPM goto/usr/src/RedHat/specs directory, modify kernel spec file and use rpmbuild command to rebuild RHEL/centos kernel rpm.