When installing certain Linux software, you might have come across the term “kernel headers” and wondered why the software you were installing required it. Surely, you already have your kernel installed on your dedicated server, so what are they talking about?
Kernel headers refer to the source code of the Linux kernel. On most binary distributions (think Red Hat, SUSE, Debian, etc.), only the binary form of the kernel is installed by default. This usually takes the form of a package called linux-image-(version-number) or something similar. In order to compile software into a kernel module, that software requires the actual source code for the kernel, called kernel headers.
Normally, software does not require direct access into the kernel, but for some software, virtualization for example, it needs to create kernel modules. It does this by compiling the modules for your specific kernel version. Therefore, you must have the kernel headers for the current version of your kernel installed. To find out which version you currently have installed, type: “uname -a” from the command line.
Next, find the kernel headers in your package management system (i.e. YUM or APT) and install them. Once installed, you should be able to complete the installation of whatever software you are trying to use.
Third-party kernel modules will need to be recompiled every time you upgrade to a new kernel version. Many virtualization programs will do this automatically when you perform the update, as long as the kernel headers package is updated at the same time. If it does not happen automatically, you will need to manual do it each time.