- 1 Hyper-V 2012 R2: Pros and Cons of Generation 1 vs. Generation 2 VMs
- 2 Harnessing the Power of Hyper-V Network Virtual Switches
- 3 Working with SSH and Secure FTP Servers in Windows
- 4 Discover Windows 8's Hidden Server Features
- 5 Server Virtualization Customer Reviews: VMware, Hyper-V, XenServer and More
Linux 2.6: Compiling and Installing
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 the existing kernel. You've done your due diligence, and still the new Linux 2.6 kernel calls. Only one solution: Roll up your sleeves and begin the compilation and installation process. We offer some tips to help make the process as pain-free as possible.
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 the 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 the 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 you can customize the kernel and still have the benefits of any vendor modifications. 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.
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, 128 MB of RAM, and a good 500 MB 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 40 MB, and kernel sources as much as 80 MB. 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.
Kernel compilation is fussy about the tools used. Here's the major software requirements from the Documentation/Changes file, which you'll find in the kernel tarball.
|Gnu C||2.95.3||# gcc --version|
|Gnu make||3.78||# make --version|
|binutils||2.12||# ld -v|
|util-linux||2.10||# fdformat --version|
|module-init-tools||0.9.10||# depmod -V|
|jfsutils||1.1.3||# fsck.jfs -V|
|reiserfsprogs||3.6.3||# reiserfsck -V 2>&1|grep reiserfsprogs|
|xfsprogs||2.6.0||# xfs_db -V|
|pcmcia-cs||3.1.21||# cardmgr -V|
|quota-tools||3.09||# quota -V|
|PPP||2.4.0||# pppd --version|
|isdn4k-utils||3.1pre1||# isdnctrl 2>&1|grep version|
|nfs-utils||1.0.5||# showmount --version|
|procps||3.1.13||# ps --version|
|oprofile||0.5.3||# oprofiled --version|
It's important to pay attention to these, especially gcc. If you compile your new kernel with any other version of gcc, you'll probably get errors. Most newer Linux distributions ship with gcc 3.x. You can have more than one version of gcc installed on your system. Install gcc 2.95.3, without overwriting your existing gcc installation, then invoke it with
# gcc -V 2.95.3
Note that you can safely ignore any unneeded components. For example, if you're not running quota, you won't need to update quota-tools, even if it's on your system. If you're not using the JFS filesystem, you won't need jfsutils. And so forth. These items matter only if you're using them. The most important programs are gcc, Gnu make, binutils, util-linux, and module-init-tools because they relate directly to kernel-building.