Linux System Administration III Study Guide

Lab work for LPI 201

Adrian Thomasset

Andrew Meredith

Andi Marshall

Duncan Thomson

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with the Invariant Sections being History, Acknowledgements, with the Front-Cover Texts being released under the GFDL by LinuxIT.

Trademarks

Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries. Red Hat Linux® and Red Hat® Enterprise Linux® are registered trademarks of Red Hat, Inc. SUSE™ (SUSE is a trademark of SUSE LINUX Products GmbH, a Novell business) UNIX® is a registered trademark of the Open Group.


Table of Contents

Introduction
1. Acknowledgements
2. History
3. Audience
4. The LPI Certification Program
5. No Guarantee
6. Resources
7. Notations
1. The Linux Kernel
1.1. Kernel Components
1.1.1. Modules
1.1.2. Types of Kernel Images
1.1.3. Documentation
1.2. Compiling a Kernel
1.3. Patching a Kernel
1.3.1. Applying the Patch
1.3.2. Testing the Patch
1.3.3. Recovering the Old Source Tree
1.3.4. Building the New Kernel after a patch
1.4. Customising a Kernel
1.4.1. Loading Kernel modules
1.4.2. The /proc/ directory
1.4.3. Task
1.4.4. A quick test
2. System Startup
2.1. Customising the Boot Process
2.1.1. Overview of init
2.1.2. Runlevels
2.1.3. Starting Local scripts
2.2. System Recovery
2.2.1. Overriding the INIT stage
2.2.2. Errors at the end of the kernel stage
2.2.3. Misconfigured Bootloaders
2.2.4. Bootloader Kernel Parameters
2.2.5. Troubleshooting LILO
2.3. Customised initrd
2.3.1. The mkinitrd script
3. The Linux Filesystem
3.1. Operating the Linux Filesystem
3.1.1. Regular local filesystems
3.1.2. Swap Partions and SWAP files
3.2. Maintaining a Linux Filesystem
3.2.1. fsck
3.2.2. sync
3.2.3. hdparm
3.2.4. badblocks
3.2.5. mke2fs
3.2.6. dumpe2fs
3.2.7. debugfs
3.2.8. tune2fs
3.3. Configuring automount
4. Hardware and Software Configuration
4.1. Software RAID
4.1.1. RAID Levels
4.1.2. Spare Disks
4.1.3. Kernel and software components
4.1.4. Booting from a RAID root device (exercise)
4.2. LVM Configuration
4.2.1. Logical Volume Management (LVM)
4.2.2. Kernel and software components
4.2.3. Extending the Volume Group with a RAID 0 device
4.2.4. Booting from a logical volume root device
4.3. CD Burners and Linux
4.3.1. Hardware detection
4.3.2. Burning an IsoImage
4.3.3. ISO9660 Filesystem and burning CDs
4.4. Bootable CDROMs
4.4.1. Using disk emulation
4.4.2. Alternatives without disk emulation
4.4.3. Copying a Bootable CD
4.5. Configuring PCMCIA Devices
5. Samba and NFS
5.1. Samba Client Tools
5.1.1. nmblookup
5.1.2. smbpasswd
5.1.3. smbtar
5.1.4. smbclient
5.1.5. smbstatus
5.2. Configuring a SAMBA server
5.2.1. The Configuratiion Files
5.2.2. The smb.conf Sections
5.2.3. Main Options in [share] Sections
5.3. Examples
5.3.1. Shared Directories
5.3.2. Sharing Printers
5.3.3. Implementing WINS with Samba?
5.3.4. Samba server as a Domain Controller
5.4. Configuring an NFS server
5.4.1. The /etc/exports file
5.4.2. User Mappings
5.4.3. Anonuid and Anongid
5.4.4. Root Squashing
5.4.5. TCPwrappers
5.4.6. Using exportfs and nfsstat
5.5. Setting up an NFS Client
6. System Maintenance
6.1. System Logging
6.1.1. Stopping and Starting syslogd
6.1.2. Configuration File
6.1.3. Sending logs to a remote server
6.1.4. Configuring syslogd to accept remote logs
6.1.5. Name resolution
6.2. RPM Builds
6.2.1. Creating a Build Directoty
6.2.2. The rpmbuild command
6.2.3. The specfile options
6.2.4. Example: Copy fstab to /tmp/etc/fstab
6.3. Debian Rebuilds
6.3.1. Example: building a package foo
7. System Automation
7.1. Writing simple perl scripts (using modules)
7.2. Using the Perl taint module to secure data
7.3. Installing Perl modules (CPAN)
7.4. Check for process execution
7.5. Monitor Processes and generate alerts
7.5.1. Schedule scripts that parse log files and email them
7.5.2. Monitor changed files and generate email alert
7.5.3. Write a script that notifies administrators when somebody logs in or out
7.6. Using rsync
A. Example Perl Module: Speadsheet
B. GNU Free Documentation License
B.0. PREAMBLE
B.1. APPLICABILITY AND DEFINITIONS
B.2. VERBATIM COPYING
B.3. COPYING IN QUANTITY
B.4. MODIFICATIONS
B.5. COMBINING DOCUMENTS
B.6. COLLECTIONS OF DOCUMENTS
B.7. AGGREGATION WITH INDEPENDENT WORKS
B.8. TRANSLATION
B.9. TERMINATION
B.10. FUTURE REVISIONS OF THIS LICENSE
B.11. ADDENDUM: How to use this License for your documents
Index

List of Tables

1.1. Creating the .config file
1.2. Compiling the kernel
2.1. Debian mkinitrd options
3.1. /etc/fstab options
4.1. Main LVM tools
5.1. /etc/exports common options
5.2. exportfs options
5.3. nfsstat options
5.4. Mount options
6.1. Project Desciption
6.2. Predefined Macros and Section

List of Examples

2.1. Selecting httpd process for runlevel 3
2.2. Stopping httpd process for runlevel 3
3.1. Making a swap file of 10MB
3.2. Making a swap partition of 16MB