Flylib.com

Books Software

 
 
 

In Conclusion


In Conclusion

One of the distinguishing characteristics of a Linux Enterprise Cluster is that it is built using packet routing and manipulation techniques. As I'll describe in Part III, Linux machines become cluster load balancers or cluster nodes because they have special techniques for handling packets. In this chapter I've provided you with a brief overview of the foundation you need for understanding the sophisticated cluster packet-handling techniques that will be introduced in Part III.



Chapter 3: Compiling the Kernel

Overview

In this chapter I'll describe how to compile a Linux kernel. For many system administrators not familiar with Linux, this may sound like a risky thing to do on a server that will be used in production, but once you have done it a few times you'll understand one of the reasons why Linux is so powerful: you have complete control over the operating system.

I could say a lot more about the benefits of having the source code of your operating system, but we'll save that for later. For now, we'll focus on what you need to be able to put your own Linux kernel into production.

To install a Linux kernel you need to do five things:

  1. Get the source code.

  2. Set the options you want.

  3. Compile the code.

  4. Install the object code.

  5. Configure the boot loader.



What You Will Need

Before you compile the kernel, you'll need to install the gcc compiler and its dependencies. (This software is not included with this book because your distribution should already contain it.) Here is a list of packages that are required to compile the kernel (this list is taken from the Red Hat distribution):

  • binutils

  • cpp

  • gcc (check the README file included with the kernel source code to find out which version of the gcc compiler is required [1] ).

  • glibc-debug

  • glibc- devel

  • glibc-kernelheaders

  • modutils (for kernel versions in the 2.4 series) or module-init- utils (for kernel versions in the 2.6 series)

If you use a text-based terminal, you will also need to have the ncurses package installed so that the make menuconfig command will work. Two RPM packages are required for this on Red Hat systems:

  • ncurses

  • ncurses-devel

Once you've installed these packages, you're ready to begin. (If you have dependency problems when installing these package, see Appendix D for some tips.)

[1] Each kernel release should only be compiled with the version of gcc specified in the README file.



Step 1: Get the Source Code

You'll have to decide whether to use the "stock" version of the Linux source code or the kernel source code included with your distribution. Here are a few of the pros and cons of each method.

Using the Stock Kernel

Pros of using the stock kernel:

  • You can apply your own patches to customize the kernel. [2]

  • It is supported by the entire kernel-development community.

  • It allows more control over which patches are applied to your system.

  • You can decide which kernel version you want to use.

Con of using the stock kernel: It may invalidate support from your distribution vendor.

Using the Kernel Supplied with Your Distribution

Pros of using the distribution kernel:

  • It is usually supported by your distribution vendor (though the vendor may not support it if you recompile it with changes).

  • It is known to compile.

  • It is already running on your system.

  • It is easy to install.

  • It has been tested by your distribution vendor and is likely to contain bug fixes that are not yet a part of the stock version of the kernel.

Cons of using the distribution kernel:

  • You may not be able to apply kernel patches.

  • It may have bugs introduced by your distribution vendor that are not found in the stock version of the kernel, and you may depend on your distribution vendor to fix them.

Decide Which Kernel Version to Use

If you use the kernel source code supplied by your vendor, you won't have many decisions to make when it comes to picking a kernel version to use; your distribution vendor will do that for you. However, if you decide to use the stock version of the kernel, you'll have to do a little more research to determine which kernel version to use.

You can use the following command to see which kernel version you are currently running:

#

uname

-a

Note 

If you decide to download your own kernel, select an even-numbered one (2.2, 2.4, 2.6, and so on). Even-numbered kernels are considered the stable ones.

Here are sample commands to copy the kernel source code from the CD-ROM included with this book onto your system's hard drive:

#mount /mnt/cdrom #cd /mnt/

cdrom

/chapter3 #cp linux-*.tar.gz /usr/src #cd /usr/src #tar xzvf kernel-*

Note 

Leave the CD-ROM mounted until you complete the next step.

Now you need to create a symbolic link so that your kernel source code will appear to be in the /usr/src/linux directory. But first you must remove the existing symbolic link. The commands to complete this step look like this:

#rm /usr/src/linux #ln -s /usr/src/linux-<version> /usr/src/linux #cd /usr/src/linux

Note 

The preceding rm command above will not remove /usr/src/linux if it is a directory instead of a file. (If /usr/src/linux is a directory on your system, move it instead with the mv command.)

{% if main.adsdop %}{% include 'adsenceinline.tpl' %}{% endif %}

You should now have your shell's current working directory set to the top level directory of the kernel source tree, and you're ready to go on to the next step.

[2] For example, you can apply the hidden loopback interface kernel patch that we'll use to build the real servers inside the cluster in Part III of this book.