Companies ranging from IBM to Novell are dramatically expanding Linux training and development. Certification will be a key part of this trend, and support is growing for an industry-wide Linux certification program. Most companies want a vendor-neutral certification initiative, and the Linux Professional Institute (LPI) is the leading effort in this direction. As more corporations adopt Linux as the networking backbone for their IT systems, the demand for certified technicians will become even greater.LPI Linux Certification in a Nutshell prepares system administrators for the basic LPI General Linux 101 exam and the more advanced 102 exam, and includes information on objectives and test suggestions. It also provides readers who aren't planning to take the exam with an excellent understanding of the targeted Linux concepts and functions.The book is divided into two parts, one for each of the LPI exams. Each part features a summary of the exam, a Highlighter's Index, labs, suggested exercises, and practice exams to help you pass the LPI exams with flying colors.Part I covers the General Linux 101 Exam:
- GNU and Unix commands
- Devices, Linux filesystems, and the filesystem hierarchy standard
- Boot, initialization, shutdown and run levels
- Administrative tasks
- Linux installation and package management
- The Linux kernel
- Text editing, processing, and printing
- Shells, scripting, programming, and compiling
- Networking fundamentals
- Network services
About the Author
Jeff Dean is an engineering and IT professional currently writing a Linux certification handbook for O'Reilly and Associates. He can be reached at email@example.com.
Read an Excerpt
Chapter 4: Linux Installation and Package Management (Topic 2.2)
Many resources describe Linux installation.1 Despite its title, however, this section's Topic and Objectives do not provide an overview for the installation of any particular Linux distribution. Rather, they focus on four installation topics and two packaging tools as required for LPI Exam 102:
- Objective 1: Design a Hard Disk Layout
- The layout and partitioning of disks is a fundamental concept for almost all computer platforms. Unlike other operating systems though, Linux uses multiple partitions in a unified filesystem. This Objective covers this filesystem layout. Weight: 2.
- Objective 2: Install a Boot Manager
- Booting Linux is a process started by a boot manager. This Objective covers the use of LILO. Weight: 2.
- Objective 3: Make and Install Programs from Source
- The unique advantages of open source software allow the distribution of programs in source code form. This Objective covers compiling and installing programs from source code. (Objectives 5 and 6 deal with binary package management.) Weight: 2.
- Objective 4: Manage Shared Libraries
- One of the efficiencies of modern operating systems is the concept of shared libraries of system software. This Objective provides an overview of shared libraries and their configuration. Weight: 3.
- Objective 5: Use Debian Package Management.
- This topic covers the management of Debian Linux binary packages. Weight: 5.
- Objective 6: Use Red Hat Package Manager (RPM)
- This topic covers the management of RPM binary packages. Weight: 8.
Design a Hard Disk Layout
Part of the installation process for Linux is the design of the hard disk partitioning scheme. If you're used to systems that reside on a single partition, this step may seem to complicate installation. However, there are advantages to splitting the filesystem into multiple partitions, potentially on multiple disks. Details about disks, partitions, and Linux filesystem top-level directories are provided in . This Topic covers considerations for implementing Linux disk layouts.
A variety of factors influence the choice of a disk layout plan for Linux, including:
- The amount of disk space
- The size of the system
- What the system will be used for
- How and where backups will be performed
Limited disk space
Except for read-only filesystems (such as CD-ROMs or a shared /usr partition), most Linux filesystems should have some free space available. Filesystems holding user data should be maintained with a generous amount of free space to accommodate user activity. Unfortunately, if there are many filesystems and all of them contain free space, a significant portion of disk space could be considered wasted. This presents a tradeoff between the number of filesystems in use and the availability of free disk space. Finding the right configuration depends on system requirements and available disk resources.
When disk space is limited, it is desirable to reduce the number of filesystems, thereby combining free space into a single contiguous pool. For example, installing Linux on a PC with only 1 GB of available disk space might best be implemented using only a few partitions:
- 50 MB. A small /boot filesystem in the first partition ensures that all kernels are below the 1024-cylinder limit.
- 100 MB.
- 850 MB. A large root partition holds everything on the system that's not in /boot.
The /boot partition could be combined with the root partition as long as the entire root partition fits within the 1024-cylinder limit (see ").
On older systems with smaller hard drives, Linux is often installed by spreading the directory tree across multiple physical disks. This is no different in practice than using multiple partitions on a single disk and often encourages the reuse of older hardware. An additional disk might be dedicated to /home in order to allow a larger work area for the users' home directories.
On larger platforms, functional issues such as backup strategies and required filesystem sizes can dictate disk layout. For example, suppose a file server is to be constructed serving 100 GB of executable datafiles to end-users via NFS. Such as system will have enough resources to compartmentalize various parts of the directory tree into separate filesystems and might look like this:
- 50 MB. Keep kernels under the 1024-cylinder limit.
- 100 MB.
- 100 MB.
- 1 GB. All of the executables in /usr are shared to workstations via read-only NFS.
- 500 MB. By placing log files in their own partition, they won't threaten system stability if the filesystem is full.
- 100 MB. By placing temporary files in their own partition, they won't threaten system stability if the filesystem is full.
- 98 GB. This is the big filesystem, offered to users for their home directories.
On production servers, much of the system is often placed on redundant media, such as mirrored disks. Large filesystems, such as /home, may be stored on some form of disk array using a hardware controller.
The role of the system also can dictate disk layout. In a traditional Unix-style network with NFS file servers, most of the workstations won't necessarily need all of their own executable files. In the days when disk space was at a premium, this represented a significant savings in disk space. While space on workstation disks isn't the problem it once was, keeping executables on a server still eliminates the administrative headache of distributing updates to workstations.
Some backup schemes use disk partitions as the basic unit of system backup. In such a scenario, each of the filesystems listed in /etc/fstab is backed up separately, and they are arranged so that each filesystem fits within the size of the backup media. For this reason, the available backup device capabilities can play a role in determining the ultimate size of partitions.
When you install Linux, you're asked to configure a swap, or virtual memory, partition. This special disk space is used to temporarily store portions of main memory containing programs or program data that is not needed constantly, allowing more processes to execute concurrently. An old rule of thumb for Linux is to set the size of the system's swap space to be equal to the amount of physical RAM in the machine. For example, if your system has 64 MB of RAM, it would be reasonable to set your swap size to at least 64 MB. Another rule of thumb that predates Linux says swap space should equal three times the main memory size. These are just guidelines, of course, because a system's utilization of virtual memory depends on what the system does and the number and size of processes it runs. Using the size of main memory, or thereabouts, is a good starting point.
Spreading swap space across multiple disk drives can allow better swap performance because multiple accesses can occur concurrently when multiple devices are used. For even better performance, place those disks on separate controllers, increasing bandwidth. For example, you could place half of your planned swap space on each of two IDE disks in your system. Those disks could be attached to the two separate IDE interfaces.
Here are some guidelines for partitioning a Linux system:
- Keep the root filesystem ( / ) small by distributing larger portions of the directory tree to other partitions. A small root filesystem is less likely to be corrupted than a large one.
- Separate a small /boot partition below cylinder 1024 for kernels.
- Separate /var. Make certain it is big enough to handle your logs and their rotation scheme, but not so large that disk space is wasted when the rotation is filled.
- Separate /tmp. Its size depends on the demands of the applications you run. It should be large enough to handle temporary files for all of your users simultaneously.
- Separate /usr and make it big enough to accommodate kernel building. Making it standalone allows you to share it read-only via NFS.
- Separate /home for machines with multiple users. For production use, put it on a disk array subsystem.
- Set swap space around the same size as the main memory. If possible, try to split the swap space across multiple disks and controllers.
TIP: Since a disk layout is the product of both system requirements and available resources, no single example can represent the best configuration. Factors to remember include placing the kernel below cylinder 1024, ways to effectively utilize multiple disks, sizing of partitions to hold various directories such as /var and /usr, the importance of the root filesystem, and swap space size. Also remember the trick of splitting swap space across multiple physical disks to increase virtual memory performance.
While it is possible to boot Linux from a floppy disk, most Linux installations boot from the computer's hard disk.2 This is a two-step process that begins after the system BIOS is initialized and ready to run an operating system. Starting Linux consists of the following two basic phases:
- Run lilo from the boot disk
- It is Linux loader's (LILO's) job to find the selected kernel and get it loaded into memory, including any user-supplied options.
- Launch the Linux kernel and start processes
- LILO starts the loaded kernel. LILO's job at this point is complete and the hardware is placed under the control of the running kernel, which sets up shop and begins running processes.
The Linux Loader (LILO) is a small utility designed to load the Linux kernel (or the boot sector of another operating system) into memory and start it. A program that performs this function is commonly called a boot loader. While other boot loaders exist, LILO is the most popular and is installed as the default boot loader on most Linux distributions. LILO consists of two parts...
Table of Contents
The Linux Professional Institute;
Audience for This Book;
Conventions Used in This Book;
How to Contact Us;
General Linux Exam 101;
Chapter 1: Exam 101 Overview;
Chapter 2: Exam 101 Study Guide;
2.1 Exam Preparation;
Chapter 3: GNU and Unix Commands (Topic 1.3);
3.1 Objective 1: Work Effectively on the Unix Command Line;
3.2 Objective 2: Process Text Streams Using Text-Processing Filters;
3.3 Objective 3: Perform Basic File Management;
3.4 Objective 4: Use Unix Streams, Pipes,and Redirects;
3.5 Objective 5: Create, Monitor, and Kill Processes;
3.6 Objective 6: Modify Process Execution Priorities;
3.7 Objective 7: Making Use of Regular Expressions;
Chapter 4: Devices, Linux Filesystems, and the Filesystem Hierarchy Standard (Topic 2.4);
4.1 Objective 1: Create Partitions and Filesystems;
4.2 Objective 2: Maintain the Integrity of Filesystems;
4.3 Objective 3: Control Filesystem Mounting and Unmounting;
4.4 Objective 4: Set and View Disk Quotas;
4.5 Objective 5: Use File Permissions to Control Access to Files;
4.6 Objective 6: Manage File Ownership;
4.7 Objective 7: Create and Change Hard and Symbolic Links;
4.8 Objective 8: Find System Files and Place Files in the Correct Location;
Chapter 5: Boot, Initialization, Shutdown, and Runlevels (Topic 2.6);
5.1 Objective 1: Boot the System;
5.2 Objective 2: Change Runlevels and Shutdown or Reboot the System;
Chapter 6: Documentation (Topic 1.8);
6.1 Objective 1: Use and Manage Local System Documentation;
6.2 Objective 2: Find Linux Documentation on the Internet;
6.3 Objective 3: Write System Documentation;
6.4 Objective 4: Provide User Support;
Chapter 7: Administrative Tasks (Topic 2.11);
7.1 Objective 1: Manage Users and Group Accounts;
7.2 Objective 2: Tune the User Environment;
7.3 Objective 3: Configure and Use System Log Files;
7.4 Objective 4: Automate System Administration Tasks;
7.5 Objective 5: Maintain an Effective Data Backup Strategy;
Chapter 8: Exam 101 Review Questions and Exercises;
8.1 GNU and Unix Commands (Topic 1.3);
8.2 Devices, Linux Filesystems, and the Filesystem Hierarchy Standard (Topic 2.4);
8.3 Boot, Initialization, Shutdown, and Runlevels (Topic 2.6);
8.4 Documentation (Topic 1.8);
8.5 Administrative Tasks (Topic 2.11);
Chapter 9: Exam 101 Practice Test;
Chapter 10: Exam 101 Highlighter’s Index;
10.1 GNU and Unix Commands (Topic 1.3);
10.2 Devices, Linux Filesystems, and the Filesystem Hierarchy Standard (Topic 2.4);
10.3 Boot, Initialization, Shutdown, and Runlevels (Topic 2.6);
10.4 Documentation (Topic 1.8);
10.5 Administrative Tasks (Topic 2.11);
General Linux Exam 102;
Chapter 11: Exam 102 Overview;
Chapter 12: Exam 102 Study Guide;
12.1 Exam Preparation;
Chapter 13: Hardware and Architecture (Topic 1.1);
13.1 Objective 1: Configure Fundamental System Hardware;
13.2 Objective 2: Set Up SCSI and NIC Devices;
13.3 Objective 3: Configure Modems and Sound Cards;
Chapter 14: Linux Installation and Package Management (Topic 2.2);
14.1 Objective 1: Design a Hard Disk Layout;
14.2 Objective 2: Install a Boot Manager;
14.3 Objective 3: Make and Install Programs from Source;
14.4 Objective 4: Manage Shared Libraries;
14.5 Objective 5: Use Debian Package Management;
14.6 Objective 6: Use Red Hat Package Manager (RPM);
Chapter 15: Kernel (Topic 1.5);
15.1 Objective 1: Manage Kernel Modules at Runtime;
15.2 Objective 2: Reconfigure, Build, and Install a Custom Kernel and Modules;
Chapter 16: Text-Editing, Processing, and Printing (Topic 1.7);
16.1 Objective 1: Perform Basic File Editing Operations Using vi;
16.2 Objective 2: Manage Printers and Print Queues;
16.3 Objective 3: Print Files;
16.4 Objective 4: Install and Configure Local and Remote Printers;
Chapter 17: Shells, Scripting, Programming, and Compiling (Topic 1.9);
17.1 Objective 1: Customize and Use the Shell Environment;
17.2 Objective 2: Customize or Write Simple Scripts;
Chapter 18: X (Topic 2.10);
18.1 An Overview of X;
18.2 Objective 1: Install and Configure XFree86;
18.3 Objective 2: Set Up xdm;
18.4 Objective 3: Identify and Terminate Runaway X Applications;
18.5 Objective 4: Install and Customize a Window Manager Environment;
Chapter 19: Networking Fundamentals (Topic 1.12);
19.1 Objective 1: Fundamentals of TCP/IP;
19.2 Objective 3: TCP/IP Troubleshooting and Configuration;
19.3 Objective 4: Configure and Use PPP;
Chapter 20: Networking Services (Topic 1.13);
20.1 Objective 1: Configure and Manage inetd and Related Services;
20.2 Objective 2: Operate and Perform Basic Configuration of sendmail;
20.3 Objective 3: Operate and Perform Basic Configuration of Apache;
20.4 Objective 4: Properly Manage the NFS, SMB, and NMB Daemons;
20.5 Objective 5: Set Up and Configure Basic DNS Services;
Chapter 21: Security (Topic 1.14);
21.1 Objective 1: Perform Security Administration Tasks;
21.2 Objective 2: Set Up Host Security;
21.3 Objective 3: Set Up User-Level Security;
Chapter 22: Exam 102 Review Questions and Exercises;
22.1 Hardware and Architecture ( Topic 1.1);
22.2 Linux Installation and Package Management ( Topic 2.2);
22.3 Kernel ( Topic 1.5);
22.4 Text Editing, Processing, and Printing ( Topic 1.7);
22.5 Shells, Scripting, Programming, and Compiling (Topic 1.9);
22.6 X (Topic 2.10);
22.7 Networking Fundamentals (Topic 1.12);
22.8 Networking Services (Topic 1.13);
22.9 Security (Topic 1.14);
Chapter 23: Exam 102 Practice Test;
Chapter 24: Exam 102 Highlighter’s Index;
24.1 Hardware and Architecture;
24.2 Linux Installation and Package Management;
24.4 Text-Editing, Processing, and Printing;
24.5 Shells, Scripting, Programming, and Compiling;
24.7 Networking Fundamentals;
24.8 Networking Services;
Chapter 25: Glossary;