How To get A centos Kernel source

1. Maybe you do not need the full kernel source

If you need to compile a kernel driver module, the chances are you do not really need the full kernel source tree. You might just need the kernel-devel package. (If, however, you are certain that the full source tree is required, please follow the instructions in Section 2.)

In CentOS-5, there are three kernel-devel packages available:

  • kernel-devel (both 32- & 64-bit architectures)
  • kernel-xen-devel (both 32- & 64-bit architectures)
  • kernel-PAE-devel (32-bit architecture only)

In CentOS-4, there are four kernel-devel packages available:

  • kernel-devel (both 32- & 64-bit architectures)
  • kernel-smp-devel (both 32- & 64-bit architectures)
  • kernel-xenU-devel (both 32- & 64-bit architectures)
  • kernel-hugemem-devel (32-bit architecture only)
  • kernel-largesmp-devel (64-bit architecture only)

If you are running the standard kernel (for example), you can install the kernel-devel package by: