Downloading and using kernel source code (2.6.32.12 and newer) overview

If you know you need to get your kernel source (or at least its headers) for a kernel version 2.6.32.12 and newer, you can find instructions to do so here.


Why would I want kernel source code?

There may come a time when you need the kernel source code, usually to build kernel headers, compile a module or some other server voodoo. Most users won't need to mess with the kernel source on a virtual server, so if you don't know that you need it, you probably don't and can safely skip this article. If you know you do, though, read on.

Note that the instructions in this article apply to kernels version 2.6.32.12 and newer. We'll cover checking the version in a bit. If you do have an older kernel version you'll need to check another article, or pop into support chat for help finding the right source code package.

Contents

The distribution-specific articles describe how to obtain and work with the kernel source code.

• Why would I want kernel source code?

• Install development tools

• Check the kernel version

• The kernel repository

• A choice of sources

• A choice of formats

• Downloading the source

• Unpack

• Make the headers

• Preparing to compile a module

• Summary

Distribution links

To access the article that corresponds to the Linux distribution running on your slice, click the appropriate link below:

Ubuntu:  Downloading and using kernel source code (2.6.32.12 and newer) on Ubuntu

Debian:  Downloading and using kernel source code (2.6.32.12 and newer) on Debian

CentOS:  Downloading and using kernel source code (2.6.32.12 and newer) on CentOS

Fedora:  Downloading and using kernel source code (2.6.32.12 and newer) on Fedora

Gentoo:  Downloading and using kernel source code (2.6.32.12 and newer) on Gentoo

Arch:  Downloading and using kernel source code (2.6.32.12 and newer) on Arch

Our Red Hat Enterprise Linux images use a kernel provided by Red Hat for use with the Xen virtualization environment, rather than our own custom build. The best approach for RHEL users would be to locate the appropriate kernel packages in their repository:

sudo yum search kernel-xen

For most RHEL users just looking to instal kernel headers or compile a module, installing the "devel" package that turns up in that search will suffice. Be sure and use sudo when searching yum, because the kernel packages will not be visible to non-root users. While most the instructions in the CentOS article could be adapted by RHEL users once the kernel source package is installed, try installing the "devel" package if it might suit your needs (the simplest solution is often the best).

Further reading

To read more about tinkering with the kernel sources and some of the makefile targets available, you might look at the collection of docs at the Linux Kernel Documentation Index.

The individual distributions often have their own kernel packages and tools for working with them. While you usually won't be able to use their kernel package on a virtual server, some of the related tools may be handy enough to warrant a look through their documentation to see what's available.

  • -- Jered
Want to comment?


(not made public)

(optional)

(use plain text or Markdown syntax)