Tips for Compiling and Installing a Linux 2.6 Kernel

You've heard and read all about the new Linux 2.6 kernal. Now it's time to roll up your sleeves compile and install it — safely, of course, and without overwriting your existing kernel.

By Carla Schroder | Posted Mar 10, 2004
Page 1 of 2
Print ArticleEmail Article
  • Share on Facebook
  • Share on Twitter
  • Share on LinkedIn
We recently highlighted some of the new features of the Linux 2.6 kernel. Now we'll look at the process of compiling and installing a new kernel safely, without overwriting your existing kernel.

You can install as many kernels as you like on a Linux system, and select the one you want to run at boot time. This makes it easy to test different kernels, and different kernel configurations, with particular sets of hardware or applications. The wise network admin always tests new kernels before running them on production machines.

Being able to compile, upgrade, modify and test new kernels is a useful skill to have. It's not that difficult &$151; Linux is designed to be modular, so you can plug in or remove bits as you need. A typical general-purpose Linux distribution lards the kernel with all kinds of things you'll never need, so you'll often see a performance gain after configuring and re-compiling your stock kernel.

Get A Pre-Fab Kernel To Play With
Look to your own distribution for already-built kernels. SuSE, Mandrake, and Red Hat customize their kernels extensively, while other distributions don't mess with them quite as much. If you're looking to reduce potential troubles, stick to your distribution packages. For example, Red Hat users can use up2date to automatically download and install new kernels. up2date will configure the bootloader to boot the new kernel by default. It will not replace your old kernel, and both will be in the boot menu. If, instead, you download and install a kernel RPM, be sure to install it with rpm -i, not rpm -U, because the -i flag will install the new kernel without touching the old one. The -U flag will overwrite your existing kernel. Debian users need look no further than apt-get install kernel-image-2.6.x.

Customizing A Kernel
You'll need the kernel source code to compile and customize a kernel. Again, you can look to your own distribution for kernel sources, so that you can customize the kernel, and still have the benefits of any modifications made by the vendor. Each distribution has its own method for customizing kernels, so be sure to check the documentation for your distribution.

Or, if you wish to try a plain-vanilla, unmodified kernel, go to the motherlode at The Linux Kernel Archives. The following steps are generic to most Linuxes.

Hardware Requirements
Compiling a Linux kernel takes a bit of muscle, and a lot of disk space. Use a machine with at least a 500 MHz CPU, 128MB of RAM, and a good 500MB of free disk space. The build process needs a lot of room, so you'll get most of that disk space back. When it's completed, the 2.6 kernel takes up as much as 40MB, and kernel sources as much as 80MB. You can get away with using a slower CPU and less RAM, it will just take a lot longer. There is also the option of building kernels on fast machines to use on less-powerful machines.

Continued on Page 2: Software Requirements

Comment and Contribute
(Maximum characters: 1200). You have
characters left.
Get the Latest Scoop with Enterprise Networking Planet Newsletter