Home arrow Site Administration arrow Page 6 - Kernel, Cron, and User Administration, Part 2

The Linux Kernel tar File - Administration

Today, continue on your path to RHCE certification. Learn about creating a new kernel the easy way, kernel sources, recompiling a kernel, and the cron and at systems. Take notes, because there's a test at the end. This comes from chapter five of Red Hat Certified Engineer Linux Study Guide (Exam RH302), fourth edition, by Michael Jang. (McGraw-Hill/Osborne, 2004, ISBN: 0-07-225365-7).

TABLE OF CONTENTS:
  1. Kernel, Cron, and User Administration, Part 2
  2. Updating Your Boot Loader
  3. The Kernel Source Tree and Documentation
  4. The Kernel RPMs
  5. GUI Kernel Source Management
  6. The Linux Kernel tar File
  7. Understanding Kernel Configuration Options
  8. Compiling and Installing a Custom Kernel
  9. The cron and at Systems
  10. Setting Up cron for Users
  11. Certification Summary
  12. Self Test
  13. Lab Questions
  14. Self Test Answers
  15. Lab
By: McGraw-Hill/Osborne
Rating: starstarstarstarstar / 7
October 06, 2004

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Alternatively, you can download the newest kernel from the Linux kernel home page at www.kernel.org. The version numbers are discussed in the next section. Once you have downloaded the kernel source, you will need to properly install it. For our example, we will assume you downloaded linux-2.4.22.tar.gz into the /usr/src/ directory.

# cd /usr/src
# mkdir linux-2.4.22
# rm linux-2.4
# tar xzvf linux-2.4.22.tar.gz
# ln -s linux-2.4.22 linux-2.4

Here we manually created a new directory for the kernel, removed the old link, and then uncompressed the tar.gz file. Then you can link linux-2.4 to the new directory created when you uncompress the tar.gz file.

ON THE JOB!  Compressed tar files are shown in tar.gz format; they are also known as “tarballs.”

Recompiling a Kernel

Fortunately, references to recompiling the Linux kernel have been removed from the Red Hat exam requirements. However, RHCEs in the real world are expected to know how to perform high-level tasks such as optimizing and recompiling the Linux kernel.

In this section, we’ll start by looking at the kernel configuration file. Then we’ll proceed with the different tools available to edit the kernel configuration. Finally, I’ll show you the commands needed to compile your new configuration into the kernel, and show you the files this adds to the /boot directory and the settings it adds to the boot loader.

EXAM WATCH!  References to recompiling the Linux kernel have been removed from the Red Hat Exam Prep guide and associated Red Hat prep courses. However, good Linux administrators know how to recompile the Linux kernel.

The Kernel Configuration Scripts

After you’ve configured a kernel once, the configuration information is stored in a hidden file, /usr/src/linux-2.4/.config. It is structured as a listing of variables. Here are some entries from the .config file:

CONFIG_NETDEVICES=y
CONFIG_DUMMY=m
# CONFIG_SUNLANCE is not set

As you can see, there are three main types of variables in this file. The first command here compiles in direct support, the second entry compiles support as a module (the “m”), and the third is commented out, and is therefore not compiled into the kernel at all. You should never have to edit this file directly, as there are easier ways to configure your kernel.

Move to the directory with your kernel source files. If you’ve installed the RHEL 3 kernel-source RPM, you can use the /usr/src/linux-2.4 directory. If you’ve installed the latest kernel from www.kernel.org, it may be in the /usr/src/linux directory. Three tools can help you configure the kernel configuration file: make config, make menuconfig, and make xconfig.

Back Up Your Configuration

The default configuration for your current Linux kernel is stored in the /boot directory. For the default RHEL 3 system, it’s stored in the config-2.4.21-4.EL file. Back up this file on another location such as a rescue floppy so that you can restore your current kernel configuration if all else fails.

You can use your current configuration as a baseline; the Linux kernel configuration tools will start with these settings. To do so with the current kernel, run the following command:

# cp /boot/config-2.4.21-4.EL /usr/src/linux-2.4/.config

Alternatively, there are a number of standard configuration files in the /usr/src/linux-2.4 /configs directory. If you want to start with one of these files, use the config file that corresponds most closely to your hardware. You can set that as the starting point for your configuration by copying it to the /usr/src/linux-2.4/.config file.

ON THE JOB!  There is a default kernel configuration file in the /usr/src/linux-2.4/configs directory. It’s associated with your CPU hardware; for example, if you have an Athlon CPU, you’ll find it in a file named kernel-2.4.21-athlon.config. If your kernel version is different, the number changes accordingly.

make config

Once you’re in the directory with the kernel source files (/usr/src/linux-2.4), you can call a simple script to configure a new kernel with the following command:

# make config

This script will prompt you through your different options. Figure 5-11 shows an excerpt from the output for this script.

FIGURE 5-11  Questions from the make config utility

Make Config

Here the kernel variables are listed in parentheses and the possible answers are in brackets. The default answer is in capital letters. If you type in a ?, you will see a help page explaining this option. Since several hundred questions are associated with this script, most administrators use one of the other two scripts to manage their Linux kernels.

make menuconfig

A nicer way to create the .config file is to use the make menuconfig command. This requires the ncurses RPM package. This opens a text-based, menu-driven system that classifies and organizes the changes that you can make to a kernel. Figure 5-12 illustrates the main menu associated with this command.

The nice thing about menuconfig is that it works very nicely over a remote text connection from other Linux computers (or perhaps that is dangerous!). Also, options appear at the bottom of the menu to load or save the configuration file from a different location.

Figure 5-12  The make menuconfig configuration menu

make menuconfig

make xconfig

The other way to make changes to the kernel is to use the X Window System. You can generate a graphical menu system to configure your kernel by running the make xconfig command. Figure 5-13 shows the xconfig main menu. You can also use xconfig to load or save the configuration from the file of your choice.

While this menu may look slightly different in different Linux distributions, the principles and basic options remain fairly constant. Each of the Kernel Configuration Options discussed on the following pages are presented for completeness. It is important for a Linux administrator to have a detailed understanding of the hows and whys about reconfiguring and recompiling the kernel.

Figure 5-13  The make xconfig configuration menu

make xconfig

This is part one from the fifth chapter of Red Hat Certified Engineer Linux Study Guide (Exam RH302), fourth edition, by Michael Jang. (McGraw-Hill/Osborne, 2004, ISBN: 0-07-225365-7). Check it out at your favorite bookstore today. Buy this book now.



 
 
>>> More Site Administration Articles          >>> More By McGraw-Hill/Osborne
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

SITE ADMINISTRATION ARTICLES

- Coding: Not Just for Developers
- To Support or Not Support IE?
- Administration: Networking OSX and Win 7
- DotNetNuke Gets Social
- Integrating MailChimp with Joomla: Creating ...
- Integrating MailChimp with Joomla: List Mana...
- Integrating MailChimp with Joomla: Building ...
- Integrating MailChimp with Joomla
- More Top WordPress Plugins for Social Media
- Optimizing Security: SSH Public Key Authenti...
- Patches and Rejects in Software Configuratio...
- Configuring a CVS Server
- Managing Code and Teams for Cross-Platform S...
- Software Configuration Management
- Back Up a Joomla Site with Akeeba Backup

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: