Synopses & Reviews
This unique and valuable collection of tips, tools, and scripts provides clear, concise, hands-on solutions that can be applied to the challenges facing anyone running a network of Linux servers from small networks to large data centers in the practical and popular problem-solution-discussion O'Reilly cookbook format.The Linux Cookbook covers everything you'd expect: backups, new users, and the like. But it also covers the non-obvious information that is often ignored in other books the time-sinks and headaches that are a real part of an administrator's job, such as: dealing with odd kinds of devices that Linux historically hasn't supported well, building multi-boot systems, and handling things like video and audio.The knowledge needed to install, deploy, and maintain Linux is not easily found, and no Linux distribution gets it just right. Scattered information can be found in a pile of man pages, texinfo files, and source code comments, but the best source of information is the experts themselves who built up a working knowledge of managing Linux systems. This cookbook's proven techniques distill years of hard-won experience into practical cut-and-paste solutions to everyday Linux dilemmas.Use just one recipe from this varied collection of real-world solutions, and the hours of tedious trial-and-error saved will more than pay for the cost of the book. But those who prefer to learn hands-on will find that this cookbook not only solves immediate problems quickly, it also cuts right to the chase pointing out potential pitfalls and illustrating tested practices that can be applied to a myriad of other situations.Whether you're responsible for a small Linux system, a huge corporate system, or a mixed Linux/Windows/MacOS network, you'll find valuable, to-the-point, practical recipes for dealing with Linux systems everyday. The Linux Cookbook is more than a time-saver; it's a sanity saver.
About the Author
Carla Schroder is a self-taught Linux and Windows sysadmin who laid hands on her first computer around her 37th birthday. Her first PC was a Macintosh LC II. Next came an IBM clone--a 386SX running MS-DOS 5 and Windows 3.1 with a 14-inch color display--which was adequate for many pleasant hours of Doom play. Then around 1997 she discovered Red Hat 5.0 and had a whole new world to explore.
Somewhere along the way she found herself doing freelance consulting for small businesses and home users, supporting both Linux and Windows users and integrating Linux and Windows on the LAN, primarily Linux servers and Windows clients. She is the author of the Linux Cookbook for O'Reilly, and writes Linux how-tos for several computer publications.
Carla is living proof that you're never too old to try something new; computers are a heck of a lot of fun; and anyone can learn to do anything. Visit tuxcomputing.com for more Carla stuff.
Table of Contents
Dedication; Preface; Audience; What Is Included/Omitted; Platforms; Conventions; Downloads and Feedback; Comments and Questions; Acknowledgments; Chapter 1: Finding Documentation; 1.1 Introduction; 1.2 Understanding man Pages; 1.3 Finding Appropriate man Pages; 1.4 Finding Lost man Pages; 1.5 Reading man Pages Without a man Viewer; 1.6 Configuring Your manpath; 1.7 Using info Pages; 1.8 Printing man Pages; 1.9 Printing info Pages; 1.10 Printing Selected man or info Pages; 1.11 Finding All of the Documentation for a Program; Chapter 2: Installing and Managing Software on RPM-Based Systems; 2.1 Introduction; 2.2 Installing RPMs; 2.3 Upgrading RPMs; 2.4 Removing RPMs; 2.5 Collecting Information on Installed RPMs; 2.6 Collecting Information from RPMs That Are Not Installed; 2.7 Finding Recently Installed RPMs; 2.8 Rebuilding the RPM Database; 2.9 Tracking Source-Built Libraries on an RPM-Based System; 2.10 Fixing RPM Installation Problems; 2.11 Installing Source RPMs; 2.12 Customizing Build Options in a Source RPM; 2.13 Installing Yum; 2.14 Configuring Yum; 2.15 Installing and Upgrading Packages with Yum; 2.16 Removing Packages with Yum; 2.17 Getting Information on Installed Packages with Yum; 2.18 Maintaining Yum; Chapter 3: Installing and Managing Software on Debian-Based Systems; 3.1 Introduction; 3.2 Getting Software for a Debian System; 3.3 Installing Debian Packages from CD-ROM; 3.4 Installing Packages on Debian-Based Systems; 3.5 Removing Packages from a Debian System; 3.6 Installing from Sources on a Debian System; 3.7 Upgrading Packages on Debian; 3.8 Upgrading a Debian System; 3.9 Upgrading to a Newer Debian Release; 3.10 Running a Mixed Debian System; 3.11 Finding Out What Is Installed on a Debian System; 3.12 Maintaining the Debian Package Cache; 3.13 Resolving Debian Dependency Conflicts; 3.14 Building a Local Debian Repository; 3.15 Selecting Package Mirrors for apt-proxy.conf; 3.16 Adding Your Existing Package Cache to apt-proxy.conf; Chapter 4: Installing Programs from Source Code; 4.1 Introduction; 4.2 Preparing Your System for Compiling Programs from Sources; 4.3 Generating a List of Files from a Source Install for Easy Uninstalls; 4.4 Installing Programs from Source Code; 4.5 Using CheckInstall to Create Packages from Sources; Chapter 5: Discovering Hardware from Outside the Box; 5.1 Introduction; 5.2 Detecting Hardware with lspci; 5.3 Using dmesg to Collect Hardware Information; 5.4 Getting Live Hardware Snapshots with /proc; 5.5 Viewing Drive Partitions with fdisk; 5.6 Calculating Hard Drive Capacity; Chapter 6: Editing Text Files with JOE and Vim; 6.1 Introduction; 6.2 Finding JOE Commands; 6.3 Customizing JOE; 6.4 Organizing JOE's Preferences in a Separate File; 6.5 Copying Between Two Files in JOE; 6.6 Searching and Replacing in JOE; 6.7 Selecting Text Vertically in JOE; 6.8 Finding and Opening Files in JOE; 6.9 Learning Vim Quickly; 6.10 Creating Autotext with Vim's Abbreviations; 6.11 Mapping Commands to Keystrokes; 6.12 Customizing Vim; 6.13 Navigating Quickly in Vim with Marks; 6.14 Picking Up Where You Left Off: Using Vim's Sessions; 6.15 Setting Your Default Editor; 6.16 Discovering Vim's Compile-Time Options; Chapter 7: Starting and Stopping Linux; 7.1 Introduction; 7.2 Changing Runlevels After Bootup; 7.3 Changing the Default Runlevel; 7.4 Starting and Stopping X; 7.5 Managing Debian's Runlevels; 7.6 Creating Both Text and Graphical Login Runlevels on Debian; 7.7 Managing Red Hat's Runlevels; 7.8 Manually Configuring Startup Services; 7.9 Manually Starting and Stopping Services; 7.10 Shutting Down or Rebooting Linux; 7.11 Disabling or Limiting Access to Ctrl-Alt-Delete; 7.12 Shutting Down Automatically; Chapter 8: Managing Users and Groups; 8.1 Introduction; 8.2 Sorting Human Users from System Users; 8.3 Finding a User's UID and GID; 8.4 Adding Users with useradd; 8.5 Adding Users with adduser; 8.6 Modifying User Accounts; 8.7 Deleting a User; 8.8 Killing User Processes the Easy, Fun Way; 8.9 Disabling Accounts; 8.10 Managing Passwords; 8.11 Adding Groups with groupadd; 8.12 Deleting Groups with groupdel; 8.13 Creating a System User; 8.14 Creating System Groups with addgroup; 8.15 Adding and Deleting Group Members; 8.16 Checking Password File Integrity; 8.17 Adding New Users in Batches; 8.18 Changing Masses of Passwords; 8.19 Adding Batches of Users to Groups; 8.20 Using su to Be Root Temporarily; 8.21 Granting Limited Rootly Powers with sudo; 8.22 Using Disk Quotas; Chapter 9: Managing Files and Partitions; 9.1 Introduction; 9.2 Setting File and Directory Permissions with chmod's Numeric Notation; 9.3 Doing Batch Operations with chmod; 9.4 Setting File and Directory Permissions with chmod's Symbolic Notation; 9.5 Setting File Ownership with chown; 9.6 Doing Batch Operations with chown; 9.7 Setting Up a Shared Directory with setgid and the Sticky Bit; 9.8 Setting Permissions Defaults with umask; 9.9 Mounting and Unmounting Removable Disks; 9.10 Configuring Filesystem Mounts with /etc/fstab; 9.11 Mounting and Unmounting Filesystems on Hard Drives; 9.12 Finding Device Names for mount and fstab; 9.13 Creating Files and Directories; 9.14 Deleting Files and Directories; 9.15 Copying, Moving, and Renaming Files and Directories; 9.16 Creating Linux Disk Partitions with fdisk; 9.17 Creating a Filesystem on a New Partition; Chapter 10: Patching, Customizing, and Upgrading Kernels; 10.1 Introduction; 10.2 Adding New Features to the 2.4 Kernel; 10.3 Slimming a Stock 2.4 Kernel; 10.4 Upgrading to the Latest Stable Version of the 2.4 Kernel; 10.5 Building the 2.6 Kernel; 10.6 Adding New Features to the 2.6 Kernel; 10.7 Adding a New Loadable Kernel Module; 10.8 Patching a Kernel; 10.9 Removing a Kernel Patch; 10.10 Creating an initrd Image; 10.11 Creating a Boot Disk on Debian; 10.12 Creating a Boot Disk on Red Hat; Chapter 11: CD and DVD Recording; 11.1 Introduction; 11.2 Finding the SCSI Address for CD and DVD Writers; 11.3 Enabling SCSI Emulation for IDE/Atapi CD and DVD Writers; 11.4 Making a Data CD for General Distribution; 11.5 Building File Trees on a Data CD; 11.6 Copying a CD or DVD; 11.7 Erasing a CD-RW; 11.8 Recording a Multisession Data CD; 11.9 Creating a Bootable CD; 11.10 Spanning a Large File over Several CDs; 11.11 Recording Data DVDs; 11.12 Recording an Audio CD for Standard CD Players; Chapter 12: Managing the Bootloader and Multi-Booting; 12.1 Introduction; 12.2 Migrating from LILO to GRUB; 12.3 Installing GRUB Without a Floppy Disk; 12.4 Installing GRUB with grub-install; 12.5 Preparing a System for Multibooting Linux; 12.6 Adding More Linuxes to a Multiboot System; 12.7 Discovering Boot Parameters from the GRUB Command Shell; 12.8 Configuring the Boot Partition; 12.9 Creating the GRUB Boot Menu; 12.10 Customizing menu.lst; 12.11 Adding Windows 95/98/ME to a Linux System; 12.12 Adding Windows NT/2000/XP to a Multiboot System; 12.13 Restoring GRUB to the MBR with a Knoppix CD; 12.14 Protecting System Files with a GRUB Password; 12.15 Locking Out Users from Individual GRUB Menu Entries; 12.16 Creating a GRUB Splash Image; 12.17 Booting Linux with LILO; 12.18 Multibooting Linuxes with LILO; 12.19 Multibooting Windows and Linux with LILO; 12.20 Creating a LILO Boot Diskette; 12.21 Password-Protecting LILO; 12.22 Backing Up the MBR; Chapter 13: System Rescue and Recovery with Knoppix; 13.1 Introduction; 13.2 Booting Knoppix; 13.3 Creating a Knoppix Boot Diskette; 13.4 Saving Your Knoppix Configuration on a USB Memory Stick; 13.5 Creating a Persistent, Encrypted Knoppix Home Directory; 13.6 Copying Files to Another Linux PC; 13.7 Copying Files to a Samba Share; 13.8 Copying Files to a CD-R/RW; 13.9 Editing Configuration Files from Knoppix; 13.10 Installing Software from Knoppix; 13.11 Repairing a Lost Root Password; 13.12 Installing Knoppix to a Hard Disk; 13.13 Virus-Scanning Windows PCs with Knoppix; Chapter 14: Printing with CUPS; 14.1 Introduction; 14.2 Installing a Printer on a Standalone Linux PC; 14.3 Serving Linux Clients; 14.4 Sharing a Printer Without Using Name Resolution; 14.5 Serving Windows Clients Without Samba; 14.6 Sharing Printers on a Mixed LAN with Samba; 14.7 Building a Dedicated CUPS Printer Server; 14.8 Distributed Printing with Classes; 14.9 Restricting Users from Printers and Classes; 14.10 Troubleshooting; Chapter 15: Configuring Video and Managing X Windows; 15.1 Introduction; 15.2 Using Both X Windows and Consoles; 15.3 Installing a New Video Adapter; 15.4 Editing XF86Config; 15.5 Enabling 3D Hardware Acceleration with XFree86/DRI; 15.6 Troubleshooting 3D Acceleration Problems; 15.7 Configuring a Multihead Display; 15.8 Choosing Different ServerLayouts at Startup; 15.9 Setting a Default ServerLayout; 15.10 Configuring startx; 15.11 Changing Your Login Display Manager; 15.12 Running Different Window Managers Simultaneously with Xnest; Chapter 16: Backup and Recovery; 16.1 Introduction; 16.2 Using rsync for Local File Transfers and Synchronization; 16.3 Making Secure Transfers with rsync and ssh; 16.4 Building an rsync Backup Server; 16.5 Securing rsync Modules; 16.6 Building an Anonymous Public rsync Server; 16.7 Launching the rsync Daemon at Startup; 16.8 Fine-Tuning File Selection; 16.9 Automating rsync over ssh Backups; 16.10 Limiting rsync's Bandwidth Requirements; 16.11 Customizing Filepaths in rsync; 16.12 Installing rsync on Windows Clients; 16.13 Creating a Message of the Day for rsync; 16.14 Creating a Bootable System Restore CD with Mondo Rescue; 16.15 Verifying the Mondo Backup; 16.16 Creating a Bootable System Restore DVD with Mondo Rescue; 16.17 Using Mondo Rescue to Clone Linux Systems; 16.18 Using the mindi-kernel for a "Sane" Backup; 16.19 Restoring a System from a Mondo Rescue Disk; 16.20 Restoring Selected Files from a Mondo Disk; Chapter 17: Remote Access; 17.1 Introduction; 17.2 Setting Up OpenSSH the First Time; 17.3 Generating New Host Keys; 17.4 Authenticating Via Public Keys; 17.5 Using Multiple Key Pairs; 17.6 Passwordless Logins with ssh-agent; 17.7 Better Passwordless Logins with keychain; 17.8 Passwordless Logins for cron Jobs; 17.9 Shutting Down ssh-agent Automatically at Logout; 17.10 Customizing the Bash Prompt for ssh; 17.11 Tunneling X over SSH; 17.12 Connecting from a Windows PC; 17.13 Setting File Permissions on ssh Files; Chapter 18: Version Control; 18.1 Introduction; 18.2 Building a Simple Local RCS Repository; 18.3 Retrieving Older File Revisions from RCS; 18.4 Comparing File Versions in RCS; 18.5 Managing System Configuration Files with RCS; 18.6 Using CVS for a Single-User Local Repository; 18.7 Adding New Files to a CVS Repository; 18.8 Deleting Files from a CVS Repository; 18.9 Creating a Shared CVS Repository; 18.10 Sharing a Single Repository Between Several Groups; 18.11 Accessing a Remote CVS Repository; 18.12 Updating Your Working Files in CVS; 18.13 Retrieving Specific Older Revisions from CVS; 18.14 Building an Anonymous Read-Only CVS Repository with Pserver; 18.15 Mirroring a CVS Repository; 18.16 Storing Binary Files in CVS; 18.17 Creating Release Snapshots with Tags; 18.18 Creating Stable and Development Branches for a Project; 18.19 Customizing Your CVS Environment; 18.20 Calculating Storage Size for a CVS Repository; Chapter 19: Keeping Time with NTP; 19.1 Introduction; 19.2 Building a Local Time Server; 19.3 Connecting to a Local Time Server; 19.4 Adding Access Controls; 19.5 Deciding Which NTP Pools to Use; 19.6 Connecting to a Time Server from an Intermittent Connection; 19.7 Setting Up Multiple Local Time Servers; 19.8 Using NTP Keys for Authentication; Chapter 20: Building a Postfix Mail Server; 20.1 Introduction; 20.2 Building a POP3 Mail Server; 20.3 Building a POP3 Mail Server on Debian; 20.4 Testing the SMTP/POP3 Mail Server; 20.5 Sending Internet Mail; 20.6 Receiving Internet Mail; 20.7 Installing Cyrus-SASL for SMTP Authorization; 20.8 Installing Cyrus-SASL on Debian; 20.9 Setting Up smtp-auth to Authenticate Users; 20.10 Using smtp-auth to Authenticate Postfix to Another Server; 20.11 Configuring a Fully Qualified Domain Name; 20.12 Building an IMAP Mail Server; 20.13 Connecting Your Users; 20.14 Sharing IMAP Folders; 20.15 Using Postfix's Virtual Mailbox Domains; 20.16 Creating a Mail List with couriermlm; 20.17 Administering a couriermlm List; 20.18 Squirreling Around with Webmail; 20.19 Table of SMTP Response Codes and SMTP Commands; Chapter 21: Managing Spam and Malware; 21.1 Introduction; 21.2 Basic Checklist: Preparing to Build Spam Malware Defenses; 21.3 Safely Testing New UBE Controls in Postfix; 21.4 Basic UBE Configurations for Postfix; 21.5 Creating Whitelists; 21.6 Using DNS Blackhole Lists; 21.7 Rejecting Messages with Attachments; 21.8 Setting Up Clam Anti-Virus on a Postfix Server; 21.9 Setting Up SpamAssassin on Postfix with Amavisd-new; 21.10 Setting Up SpamAssassin Without Amavisd-new; Chapter 22: Running an Apache Web Server; 22.1 Introduction; 22.2 Installing Apache 2.0 from Sources; 22.3 Adding New Modules After Installation; 22.4 Setting Apache File Permissions and Ownership; 22.5 Accessing the Apache User's Manual Locally; 22.6 Setting Up a Simple Public Web Server; 22.7 Redirecting URLs to a New Directory; 22.8 Giving Users Individual Web Directories; 22.9 Starting Apache at Boot; 22.10 Hosting Multiple Domains with Apache; 22.11 Using Individual Log Files for Virtual Hosts; 22.12 Keeping LAN Web Sites Off the Internet; 22.13 Password-Protecting Individual Directories; 22.14 Using robots.txt to Control Web Crawlers; 22.15 Blocking Obnoxious Visitors; 22.16 Making Custom Error Pages; 22.17 Customizing Apache's Default Error Pages; 22.18 Making Full-Length Directory Indexes; 22.19 Using Content Negotiation to Deliver Pages in Different Languages; 22.20 Using Favicons; 22.21 Viewing Apache Access Logs with Webalizer; Chapter 23: File and Printer Sharing, and Domain Authentication with Samba; 23.1 Introduction; 23.2 Building a Simple Anonymous Samba File Server for Windows; 23.3 Building a Windows/Linux Peer Network; 23.4 Enabling File Sharing on Windows PCs; 23.5 Adding Authentication to a Samba Server; 23.6 Batch-Converting System Users to Samba Users; 23.7 Managing Samba Logins from Windows 95/98/ME; 23.8 Dealing with Windows Encrypted Password Confusion; 23.9 Controlling Share Access with Access Control Lists; 23.10 Creating Public Shares for Users; 23.11 Accessing Users' Home Directories in Samba; 23.12 Building a Primary Domain Controller with Samba; 23.13 Connecting Windows 95/98/ME to a Samba Domain; 23.14 Connecting Windows NT/2000 Clients to a Samba Domain; 23.15 Connecting Windows XP Clients to a Samba Domain; 23.16 Enabling Roaming Profiles; 23.17 Connecting Linux Clients to a Samba File Server or Peer Network; 23.18 Connecting Linux Clients to Samba Workgroups with Command-Line Tools; 23.19 Connecting Linux Clients to a Samba Domain with GUI LAN Browsers; 23.20 Connecting Linux Clients to a Samba Domain with Command-Line Tools; 23.21 Keeping Samba and Linux Passwords in Sync; 23.22 Sharing Linux Printers with Windows; 23.23 Sharing Windows Printers with Linux; 23.24 Running Windows Applications on Linux with CrossOver Office; Chapter 24: Managing Name Resolution; 24.1 Introduction; 24.2 Enabling Local Name Resolution with hosts Files; 24.3 Setting Up a DHCP Server; 24.4 Configuring dhcp Clients; 24.5 Adding Static Hosts to dhcp; 24.6 Running a Public DNS Server; 24.7 Installing djbdns; 24.8 Moving tinydns's and dnscache's Logfiles; 24.9 Running a Local Caching Name Server with djbdns; 24.10 Configuring Linux and Windows Clients to Use Your Caching DNS Server; 24.11 Building a Public DNS Server with tinydns; 24.12 Building a Private tinydns Server; 24.13 Enabling Simple Load Balancing with tinydns; 24.14 Synchronizing with a Second tinydns Server; 24.15 Running a Local Caching Name Server with BIND; 24.16 Running a Private BIND DNS Server; 24.17 Checking Syntax; 24.18 Configuring a Public BIND DNS Server; 24.19 Building a BIND Secondary Server; 24.20 Simple Load Balancing with BIND; 24.21 Testing Your tinydns Server; 24.22 Testing and Querying DNS Servers with dig and dnstrace; Appendix A: Finding Linux Documentation; A.1 Linux Documentation on the Web; A.2 Books and Magazines; Appendix B: Online References; B.1 Hardware Web Sites; B.2 Usenet; Appendix C: Microsoft File Types; Appendix D: Init Script for CVSD; Colophon;