Debian GNU Linux Bible pdf pdf

  “Steve Hunger’s book is the most comprehensive and up-to-date guide to Debian GNU/Linux in print.” % —Branden Robinson, Debian Developer

  100% O N E H U N D R E D P E R C E N T

  C O M P R E H E N S I V E A U T H O R I T A T I V E W H A T Y O U N E E D

  O N E H U N D R E D P E R C E N T Master Linux system administration Discover the power of Debian’s package management system Build a network and set up Linux servers ® ®

ebian

ebian

  D D ®

  ® GNU/Linux GNU/Linux le BONUS CD-ROM

  4710-0 Cover 3/30/01 11:57 AM Page 2 “Steve Hunger’s book is the most comprehensive and If Debian GNU/Linux can do it, you can do it too . . . up-to-date guide to Debian GNU/Linux in print.” Whether you’re a Linux newcomer looking for foolproof installation tips or a Debian GNU/ veteran who wants 100%

  —Branden Robinson, Debian Developer 100% the scoop on the latest security enhancements, this authoritative guide delivers all the information you need to De

  C O M P R E H E N S I V E make the most of the Debian GNU/ “potato” release. From customizing a desktop system to troubleshooting a

  A U T H O R I T A T I V E W H A T Y O U N E E D network or setting up an e-commerce server, it’s the only reference you’ll ever need to become a Debian GNU/ Linux pro. bi Inside, you’ll find

  ▲ n Debian GNU/Linux ® Discover the power

  Master Linux system a complete coverage of administration

   G • Get crystal-clear instructions for fast, painless of Debian’s package installation management system N • Learn your way around the Linux shell, file Build a network and system, and X Window System set up Linux servers U Discover how easy it is to set up a LAN • in Debian and connect to the Internet

  ▲ Make the most of Linux desktop applications,

  /L games, and multimedia features in Master Linux administration, from automating • system tasks to locking in security u

  ® Find guidance on how to keep Debian current x and bug-free ebian

  ▲ ®

  • • Get the scoop on configuring servers, from

  D Apache and FTP to NIS and Sendmail HUNGER

  ® GNU/Linux w w w . h u n g r y m i n d s . c o m B ible

  Debian GNU/Linux ®

  Bible

  Debian GNU/Linux ®

  Bible Steve Hunger Hungry Minds, Inc.

  Indianapolis, IN ✦ Cleveland, OH ✦ New York, NY

  Debian GNU/Linux ® Bible Published by Hungry Minds, Inc.

  909 Third Avenue New York, NY 10022 www.hungryminds.com Copyright  2001 Hungry Minds, Inc. All rights reserved. No part of this book, including interior design, cover design, and icons, may be reproduced or transmitted in any form, by any means (electronic, photocopying, recording, or otherwise) without the prior written permission of the publisher. Library of Congress Catalog Card No.: 2001089113

  ISBN: 0-7645-4710-0 Printed in the United States of America 10 9 8 7 6 5 4 3 2 1

  1B/SW/QU/QR/IN Distributed in the United States by Hungry Minds, Inc. Distributed by CDG Books Canada Inc. for Canada; by Transworld Publishers Limited in the United Kingdom; by IDG Norge Books for Norway; by IDG Sweden Books for Sweden; by IDG Books Australia Publishing Corporation Pty. Ltd. for Australia and New Zealand; by TransQuest Publishers Pte Ltd. for Singapore, Malaysia, Thailand, Indonesia, and Hong Kong; by Gotop Information Inc. for Taiwan; by ICG Muse, Inc. for Japan; by Intersoft for South Africa; by Eyrolles for France; by International Thomson Publishing for Germany, Austria, and Switzerland; by Distribuidora Cuspide for Argentina; by LR International for Brazil; by Galileo Libros for Chile; by Ediciones ZETA S.C.R. Ltda. for Peru; by WS

  Computer Publishing Corporation, Inc., for the Philippines; by Contemporanea de Ediciones for Venezuela; by Express Computer Distributors for the Caribbean and West Indies; by Micronesia Media Distributor, Inc. for Micronesia; by Chips Computadoras S.A. de C.V. for Mexico; by Editorial Norma de Panama S.A. for Panama; by American Bookshops for Finland. For general information on Hungry Minds’ products and services please contact our Customer Care department within the U.S. at 800-762-2974, outside the U.S. at 317-572-3993 or fax 317-572-4002. For sales inquiries and reseller information, including discounts, premium and bulk quantity sales, and foreign-language translations, please contact our Customer Care department at 800-434-3422, fax 317-572-4002 or write to Hungry Minds, Inc., Attn: Customer Care Department, 10475 Crosspoint Boulevard, Indianapolis, IN 46256. For information on licensing foreign or domestic rights, please contact our Sub-Rights Customer Care department at 212-884-5000. For information on using Hungry Minds’ products and services in the classroom or for ordering examination copies, please contact our Educational Sales department at 800-434-2086 or fax 317-572-4005.

  For press review copies, author interviews, or other publicity information, please contact our Public Relations department at 650-653-7000 or fax 650-653-7500.

  For authorization to photocopy items for corporate, personal, or educational use, please contact Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, or fax 978-750-4470.

  

LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND AUTHOR HAVE USED THEIR

BEST EFFORTS IN PREPARING THIS BOOK. THE PUBLISHER AND AUTHOR MAKE NO

REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE

CONTENTS OF THIS BOOK AND SPECIFICALLY DISCLAIM ANY IMPLIED WARRANTIES OF

MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. THERE ARE NO WARRANTIES WHICH

EXTEND BEYOND THE DESCRIPTIONS CONTAINED IN THIS PARAGRAPH. NO WARRANTY MAY BE

CREATED OR EXTENDED BY SALES REPRESENTATIVES OR WRITTEN SALES MATERIALS. THE

ACCURACY AND COMPLETENESS OF THE INFORMATION PROVIDED HEREIN AND THE OPINIONS

STATED HEREIN ARE NOT GUARANTEED OR WARRANTED TO PRODUCE ANY PARTICULAR RESULTS,

AND THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY

  

INDIVIDUAL. NEITHER THE PUBLISHER NOR AUTHOR SHALL BE LIABLE FOR ANY LOSS OF PROFIT OR

ANY OTHER COMMERCIAL DAMAGES, INCLUDING BUT NOT LIMITED TO SPECIAL, INCIDENTAL,

CONSEQUENTIAL, OR OTHER DAMAGES.

  Trademarks: All brand names and product names used in this book are trade names, service marks, trademarks, or registered trademarks of their respective owners. All other trademarks are the property of

their respective owners. Hungry Minds, Inc., is not associated with any product or vendor mentioned in this

book. is a trademark of

  About the Author Steve Hunger has spent the last 10 years in the computer industry, the last four

  supporting and integrating multiple platforms for a Fortune 500 Company. Having been introduced to UNIX while attending Purdue University, he quickly latched onto Linux as the primary platform for his startup Web hosting and development busi- ness in 1996. He continues operating his Web business, consulting with local busi- nesses, and freelance writing. When not conquering the world with Linux, he has co-written and contributed to several books for Macmillan USA and Brady Games, including work on the line of Mandrake Linux products. His latest work has been for AOL Press called Powering Up the Internet.

  In his spare time he enjoys relaxing with his wife, riding bicycles, and tinkering with an R/C model that is evolving into something that looks amazing like a plane. He is also on the Board of Directors for the Central Indiana Linux Users Group (www.cinlug.org). Steve can be reached at steve@rhinoworld.com. Credits Acquisitions Editor

  Terri Varveris

  Quality Control Technicians

  Marisa Pearman

  Media Development Coordinator

  Travis Silvers

  Media Development Specialist

  Laura Moss

  Permissions Editor

  David Faust Susan Moritz Marianne Santy Charles Spencer

  Amy Adrian Sean Decker Gabriele McCann Kendra Span

  Project Editor

  Graphics and Production Specialists

  Dale White

  Project Coordinator

  Victoria Lee O’Malley Luann Rouff

  Copy Editors

  Steve Schafer

  Technical Editor

  Gus A. Miklos

  Proofreading and Indexing York Production Services, Inc.

  

This book is dedicated to my beloved wife, Sandy. Without her love, support, and

encouragement to carry me on days I needed it, this book would not have been

possible. And to my father, who also saw me through this book.

  Foreword

  n January 1993, while browsing USENET news one evening after work, I ran across a thread with a subject line that read, simply, “LINUX.” I’m not sure what

  I

  it was about the word “LINUX” that made me hit Enter, but I did, and within a few minutes, it was clear to me that I had to have it. Unfortunately, that’s about where I hit a brick wall. I had just enough information about Linux to whet my appetite, but there was precious little more of it to be found. Over the course of the next few weeks, I hunted down and pieced together the rest of what I needed to know: where to find it, how to download it, how to install it, and what I could do with it once I had installed it. It was a tedious process, because only scraps of information were available, and those scraps were scattered about all over the place — a bit on a USENET group here, a bit more on an FTP site there. And even when found and pieced together, the scraps did not form a complete picture — I had to fill in large gaps for myself. All in all, it was a tremendous learning experience, but it was also a tremendously frus- trating and time-consuming experience, and if presented with the same obstacles today, I likely would not have had the time or the inclination to overcome them. Fortunately, becoming a Linux user is much easier today than it was in 1993. The software itself has come a long way, and a wide range of books on the subject are available, from installation and use to programming to administration and manage- ment. These days, the local bookstore has all the information you need to get started and become productive as a Linux user. One subject that has not been covered as extensively as others, a subject near and dear to my heart, is Debian, a project I founded not long after discovering Linux. Debian has much to offer the Linux user — a huge selection of software, an open development process that leads to rapid bug fixes and improvements, an unparal- leled software management facility that allows software to be installed easily and systems to be upgraded non-disruptively, and much more — but it has long remained a daunting prospect to piece together the information you need to get there. Debian GNU/Linux Bible

  And, so, I am extremely pleased to see books such as my friend Steve Hunger’s

  Debian GNU/Linux Bible. Debian GNU/Linux Bible contains all the information you

  need to know to get the most out of Debian, from installing it to using its powerful package management system to install software and upgrade your system to setting up a Web server and other advanced topics. With Debian GNU/Linux Bible by your side, you will be well prepared to join the large and growing group of users that call Debian home. I hope this book serves you well. Ian Murdock Founder of Debian and Co-founder of Progeny Linux Systems, Inc.

  Preface

  s Linux becomes more and more popular, resources to learn and use Linux become more important. These resources help to guide, direct, and inform an

  A

  individual to make the best use of the tools available, just as a stack of boards, nails, and a hammer don’t make a house — it takes the skilled craftsmanship of a carpenter to turn the parts into a whole house. Debian GNU/Linux Bible gives you the skilled guidance to help you turn the individual parts into a system.

  Whom This Book Is For

  This book covers the many aspects of the Debian GNU/Linux system, from the ini- tial install of this reputable operating system to the more advanced functions like Web servers or file servers. You do not need to have any special programming expe- rience to use this book. You may just want to learn how to use Debian as a work- station environment. This book does assume some level of general computer knowledge, even though not specifically related to Linux or UNIX. Many people get introduced to Linux after becoming familiar with another operating system. You may be someone who wants to learn something new, someone who wants to know what all the buzz is about Linux, or someone who just likes the idea that the software and upgrades are free. Whatever the reason you are reading this book, I’m sure that you will find assis- tance in the pages of this book. You will find everything from installation to admin- istration to server setup. This book will give you the boost needed to set up a home or office network and to maintain that network of computers.

  How This Book Is Organized

  This book is organized in a progression of skill as well as function. The beginning of the book starts out with an overview of Linux. It then progresses to the concepts needed for average use. Then, it concludes with the concepts needed for more intense use.

  For those who are fairly new to Linux, this book will help them get their feet wet. Debian GNU/Linux Bible

  Debian GNU/Linux, you move into the intermediate areas of the book, namely the middle sections. Lastly, the experienced administrator who will from time to time need instruction on specific services can find this information in “Part III: Administering Linux.” Now that you have an idea of the overall layout of the book, let’s look over the book chapter by chapter. The following will describe the contents of the book in slightly more detail.

  Part I: Getting Started Part I provides the basic introduction to Debian GNU/Linux. The chapters in this

  part start with background on Linux in general and the beginnings of the Debian distribution; walk you through the important steps on getting Debian GNU/Linux installed on your system; cover the essential base set of commands used to navi- gate through the newly installed system; cover the differences between desktop managers, desktop environments, and window managers; explain the requirements and configuration of setting up a network and describe tools used to test, diagnose, and evaluate the network once installed; and help you connect your system to the Internet and explain some of the applications you’ll need for such things as e-mail, news, and Web browsing.

  Part II: Working with Debian Chapters in Part II explain how to install additional applications on the system,

  cover the features and functions of the popular Office-like application suites avail- able to Linux, describe the intermediate commands found on the system (useful to those interested in going on to the next step), provide examples of applications that appeal to the senses — sight and sound alike, and list the multitude of games avail- able for Linux (no computer user is complete with out at least trying some of the games).

  Part III: Administering Linux The chapters in Part II cover the concerns that administrators face when managing

  one system or many, deal with the programming environment found with Linux (including the most common environments, like Perl, Tk/Tcl, and C), explain the most amazing environment that makes Linux so powerful and how to mix the envi- ronment with the programming of scripts, detail the core part of the Linux system — the kernel, and explain how to modify and create new versions of the kernel specifically designed for your needs.

  Preface

  Part IV: Maintenance and Upgrade Chapters in this part direct you on keeping the system updated and current to pre-

  vent problems from creeping in, describe some of the hardware and how to make changes to the system to accommodate additions, and explain why backups are important.

  Part V: Linux Server In Part V, chapters detail how to lock down the security of a Linux system to pre-

  vent intrusion; cover how Debian can be used as the first line of defense to protect a home or office network; show you how to publish Web pages on the network or Internet; explain how to set up a server to allow the transfer of files from any num- ber of clients using the File Transfer Protocol; provide information on setting up a central Network Information Server to manage a medium-sized to large network or account; describe how to create a central point from which to share, store, and archive files in one place; and list the servers used to handle electronic mail, one of the most-used forms of communication among most medium-sized to large companies.

  Appendixes The book concludes with three appendixes.

  ✦ Appendix A, “What’s On the CD-ROM,” provides you with information on the contents of the CD-ROM that accompanies this book.

  ✦ Appendix B, “Linux Commands,” covers many of the commands found in the common areas on the Linux filesystem.

  ✦ Appendix C, “Debian Packages,” presents a list of commonly used Debian packages with a short description of each.

  System Requirements

  Nearly all software has some level of requirements when referring to hardware that it is run on. Debian GNU/Linux is no different. Even though Debian is available for different platforms, the one used in this book is the i386-based platform. This includes processors ranging from the Intel series (386, 486, Pentium class, and other variations), AMD, and any of the other “Intel clone” processors. Other proces- sor platforms will operate similarly, so this book can still operate as a reference even though they may not be specifically referred to. Debian GNU/Linux Bible

  Beyond the core processor, the other components will be supported to varying lev- els. For each of those, I will redirect you back to the manufacturers or to one of the many Web site where the information about using hardware with Linux is available. One such site is www.linuxdoc.com. At the minimum, your systems should include at least a i486 class processor with

  8MB of RAM, a 500MB hard disk and either a bootable floppy drive with CD-ROM drive or a bootable CD-ROM drive. However, this distribution of Debian GNU/Linux will work on systems with less. If you intend on using the i486 class processor as a workstation, I recommend a higher standard for better response.

  Conventions

  There are several conventions used within this book that will help you to get more out of it. The first is the use of special fonts or font styles to emphasize a special kind of text; the second is the use of icons to emphasize special information.

  ✦ There are some situations when I’ll ask you to type something. This informa- tion always appears in bold type like this: Type Hello World.

  ✦ Code normally appears on separate lines from the rest of the text. However, there are some special situations when small amounts of code appear right in the paragraph for explanation purposes. This code will appear in a monospaced font like this: Some Special Code. URLs for Web sites are also presented in monospaced font like this: http://www.microsoft.com.

  ✦ Definitions are always handy to have. I use italics to differentiate definitions from the rest of the text like this: A CPU is the central processing unit for your machine.

  ✦ In some code examples, I won’t have an exact value to provide so I’ll give you an idea of what you should type by using italics and monospaced font like this: Provide a Machine Name value for the Name field.

  The following icons identify useful and important asides from the main text.

  Note

  Notes help you to understand some principle or provide amplifying information. In many cases, a Note is used to emphasize a piece of critical information that you need.

  Caution Any time that you see a Caution, make sure that you take special care to read it.

  This information is vital. I always uses the Caution to designate information that will help you to avoid damage to your application, data, machine, or self. Never skip the Cautions in a chapter and always follow their advice.

  Preface Tip All of us like to know special bits of information that will make our job easier,

  more fun, or faster to perform. Tips help you to get the job done faster and more safely. In many cases, the information found in a Tip is drawn from experience, rather than from experimentation or from the documentation.

  Cross- There are times when information in another area of the book will help you to bet- Reference

  ter understand the current discussion. I always include the Cross-Reference icon to indicate additional material that you might need.

  Acknowledgments

  would first like to thank the Debian development community. Without their hard work, high standards, and volunteer efforts, this Linux distribution would not

  I

  have the reputation it does today. So these thanks goes out to the hundreds of those volunteers. I would also like to thanks the two contributors to this book, John Goerzen and Shawn Voss. John wrote the chapter on the available programming environments in Debian. Shawn wrote the chapter on the shell environments and shell scripts. I would also like to thank everyone who has worked to produce this book — specifically, Terri Varveris for her efforts in planning, scheduling, and the other details involved with getting a book like this to the shelves and Gus Miklos for all his work making sure that what I wrote down could actually be read and under- stood by others. I’d also like to thank Steve Schafer for his efforts editing the technical aspects of the book content. And a thanks go out to all the other involved at differing levels on this book. Thanks to all those who has had to listen to me get on my soap box about Linux over the years — especially my wife for her patience while I spent the hours chained to the computer working on some project or other.

  Contents at a Glance

  Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi

  

Part I: Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Chapter 1: Introduction to Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Chapter 2: Installing Debian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Chapter 3: First Steps as a Linux User . . . . . . . . . . . . . . . . . . . . . . . . . 41 Chapter 4: Choosing a GUI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 Chapter 5: Networking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Chapter 6: Setting Up for the Internet . . . . . . . . . . . . . . . . . . . . . . . . . 113 Part II: Working with Debian . . . . . . . . . . . . . . . . . . . . . . . 131 Chapter 7: Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 Chapter 8: Productivity Applications . . . . . . . . . . . . . . . . . . . . . . . . . 157 Chapter 9: Essential Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 Chapter 10: Multimedia . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 Chapter 11: Games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 Part III: Administering Linux . . . . . . . . . . . . . . . . . . . . . . . . 235 Chapter 12: System Administration . . . . . . . . . . . . . . . . . . . . . . . . . . 237 Chapter 13: Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 Chapter 14: Shells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 Chapter 15: Linux Kernel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313 Part IV: Maintenance and Upgrade . . . . . . . . . . . . . . . . . . . . 335 Chapter 16: Finding Updated Files . . . . . . . . . . . . . . . . . . . . . . . . . . . 337 Chapter 17: Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 Chapter 18: Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371 Debian GNU/Linux Bible

  Part V: Linux Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 Chapter 19: Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397 Chapter 20: Firewall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415 Chapter 21: Web Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431 Chapter 22: FTP Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463 Chapter 23: Network Information System . . . . . . . . . . . . . . . . . . . . . . 485 Chapter 24: File Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495 Chapter 25: Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517 Appendix A: What’s On the CD-ROM . . . . . . . . . . . . . . . . . . . . . . . . . 539 Appendix B: Linux Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543 Appendix C: Debian Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 625 GNU General Public License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 659 CD-ROM Installation Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . 664

  

Contents

Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi

  Part I: Getting Started

  1 Chapter 1: Introduction to Linux . . . . . . . . . . . . . . . . . . . . . . . 3

  Understanding the Role of the Operating System . . . . . . . . . . . . . . . . 3 History of GNU/Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Linux versus Other Operating Systems . . . . . . . . . . . . . . . . . . . . . . 6 The Word on Free Software and Open Source . . . . . . . . . . . . . . . . . . 8 What’s So Special about GNU/Linux? . . . . . . . . . . . . . . . . . . . . . . . 8 Understanding the Debian Distribution . . . . . . . . . . . . . . . . . . . . . 10

Chapter 2: Installing Debian . . . . . . . . . . . . . . . . . . . . . . . . 13 Preparing Your System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Basic Debian Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Booting off the CD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 The main menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Configuring the keyboard . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Partitioning a hard disk . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Initializing and activating a swap partition . . . . . . . . . . . . . . . . 18 Initializing a Linux partition . . . . . . . . . . . . . . . . . . . . . . . . 18 Initializing the operating system kernel and modules . . . . . . . . . 19 Configuring device driver modules . . . . . . . . . . . . . . . . . . . . 20 Configuring the network . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Installing the base system . . . . . . . . . . . . . . . . . . . . . . . . . 22 Configuring the base system . . . . . . . . . . . . . . . . . . . . . . . . 23 Booting Linux directly from the hard drive . . . . . . . . . . . . . . . 24 Making a boot floppy . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

  Debian GNU/Linux Bible

  Configuring the Debian system . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Apt configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

  Using the Debian Package-Management System . . . . . . . . . . . . . . . . 31 What are deb packages? . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Adding deb packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Changing the package archive source . . . . . . . . . . . . . . . . . . 35 Gnome-apt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

  Installing Non-Debian Software . . . . . . . . . . . . . . . . . . . . . . . . . . 37 RPM packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 tar packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

  Chapter 3: First Steps as a Linux User . . . . . . . . . . . . . . . . . . . 41 Logging In and Out of Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Basic Navigation with Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 Finding special file locations . . . . . . . . . . . . . . . . . . . . . . . . 43 Finding ready-reference documentation . . . . . . . . . . . . . . . . . 45 Maneuvering through the files . . . . . . . . . . . . . . . . . . . . . . . 48 Stopping the System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 Using the reboot, halt, and poweroff commands . . . . . . . . . . . . 56 Using the shutdown command . . . . . . . . . . . . . . . . . . . . . . . 57 Working with the Filesystem and Related Commands . . . . . . . . . . . . . 58 Mounting drives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Chapter 4: Choosing a GUI . . . . . . . . . . . . . . . . . . . . . . . . . 63 Linux’s Graphical User Interface . . . . . . . . . . . . . . . . . . . . . . . . . 63 Deciding on a Graphical Interface . . . . . . . . . . . . . . . . . . . . . . . . 65 Installing and Configuring the X Environment . . . . . . . . . . . . . . . . . 66 X system requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Installing fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Installing the Display Manager . . . . . . . . . . . . . . . . . . . . . . . 69 XF86Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 Starting the X server . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Starting X remotely . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Managing the X server . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Installing and Using Window Managers . . . . . . . . . . . . . . . . . . . . . 79 FVWM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

  Contents

  Installing and Using Desktop Environments . . . . . . . . . . . . . . . . . . 84 GNOME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 KDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

  Troubleshooting Your New Components . . . . . . . . . . . . . . . . . . . . 88

  Chapter 5: Networking . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Components of the Linux Network . . . . . . . . . . . . . . . . . . . . . . . . 91 TCP/IP Network Protocols . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 IP addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Network classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Ports and services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Netmasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Understanding Host Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 Understanding Domain Names and the DNS . . . . . . . . . . . . . . . . . . 97 Setting Up the Physical Network . . . . . . . . . . . . . . . . . . . . . . . . 100 Ethernet cards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 Hubs and switches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 Cables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 Setting Up the Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 Making Changes to the Network . . . . . . . . . . . . . . . . . . . . . . . . 104 Making manual changes . . . . . . . . . . . . . . . . . . . . . . . . . . 104 Adding IP addresses to one Ethernet card . . . . . . . . . . . . . . . 105 Troubleshooting the Network . . . . . . . . . . . . . . . . . . . . . . . . . . 105 Using dmesg to troubleshoot . . . . . . . . . . . . . . . . . . . . . . . 106 Using ifconfig to troubleshoot . . . . . . . . . . . . . . . . . . . . . . 106 Using ping to troubleshoot . . . . . . . . . . . . . . . . . . . . . . . . 108 Using traceroute to troubleshoot . . . . . . . . . . . . . . . . . . . . 109 Using route to troubleshoot . . . . . . . . . . . . . . . . . . . . . . . 110 Chapter 6: Setting Up for the Internet . . . . . . . . . . . . . . . . . . 113 Connecting to an ISP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 Using wvdial to connect . . . . . . . . . . . . . . . . . . . . . . . . . . 114 Using diald to connect . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 Web Browsers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 E-Mail Clients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 Balsa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 Debian GNU/Linux Bible

  mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 Mail utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122

  News Clients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 PAN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 Netscape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 tin newsreader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126

  FTP Clients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 Telnet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 Dial-in PPP Server Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

  Part II: Working with Debian 131 Chapter 7: Applications . . . . . . . . . . . . . . . . . . . . . . . . . . 133 Installing Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 Using the Windows Application with Linux . . . . . . . . . . . . . . . . . . 134 DOSEMU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 Wine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 VMware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 Plex86 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 Graphics Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Gimp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 ImageMagick . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 Browsers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 Lynx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 Mozilla . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 Opera . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 Netscape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 Chapter 8: Productivity Applications . . . . . . . . . . . . . . . . . . . 157 StarOffice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 The StarOffice desktop . . . . . . . . . . . . . . . . . . . . . . . . . . 160 Applixware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 Navigating Applixware . . . . . . . . . . . . . . . . . . . . . . . . . . . 167

  Contents

  Alternatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 Gnome Office . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 Publishing documents with text files . . . . . . . . . . . . . . . . . . 174 TeX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 Groff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

  File Converters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

  Chapter 9: Essential Tools . . . . . . . . . . . . . . . . . . . . . . . . . 179 Using Text Editors in Debian GNU . . . . . . . . . . . . . . . . . . . . . . . 179 Learning to use vi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 Learning to use Emacs . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 Using Commands and Programs . . . . . . . . . . . . . . . . . . . . . . . . 188

  alias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 grep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 find . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 locate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 cat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 top . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 The more program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 The less program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195

  Automating Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 The at command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 The batch command . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 The cron command . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 The anacron command . . . . . . . . . . . . . . . . . . . . . . . . . . 200

  Chapter 10: Multimedia . . . . . . . . . . . . . . . . . . . . . . . . . . 203 Listening to Audio Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 Audio file formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 Audio CDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 MP3 on Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 Recording CDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 Streaming audio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 Watching Videos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 MPEG videos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 DVD videos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 Debian GNU/Linux Bible

  Chapter 11: Games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 System Considerations for Gaming . . . . . . . . . . . . . . . . . . . . . . . 217 Graphical interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 Sound system requirements . . . . . . . . . . . . . . . . . . . . . . . 218 Other system demands . . . . . . . . . . . . . . . . . . . . . . . . . . 219 Playing Debian-Packaged Games . . . . . . . . . . . . . . . . . . . . . . . . 219 Adventure games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 Arcade games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 Board games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 Card games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Simulation games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 Strategy games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 Multi-player games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 GNOME games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 Playing Commercial Games . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 SimCity 3000 Unlimited . . . . . . . . . . . . . . . . . . . . . . . . . . 231 Unreal Tournament . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 Part III: Administering Linux 235 Chapter 12: System Administration . . . . . . . . . . . . . . . . . . . 237 The Roles of the System Administrator . . . . . . . . . . . . . . . . . . . . 237 The System Administrator and the Root Account . . . . . . . . . . . . . . 239 Using the su command . . . . . . . . . . . . . . . . . . . . . . . . . . 240 Using the sudo command . . . . . . . . . . . . . . . . . . . . . . . . . 241 Administering and Setting up Accounts . . . . . . . . . . . . . . . . . . . . 242 The passwd file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 The purpose of shadow passwords . . . . . . . . . . . . . . . . . . . 243 The group file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 Employing adduser to add a user account . . . . . . . . . . . . . . . 244 The new user template — skel . . . . . . . . . . . . . . . . . . . . . . 245 Using userdel to remove a user . . . . . . . . . . . . . . . . . . . . . . 246 Restricting access to the root account . . . . . . . . . . . . . . . . . 246 Setting File and Directory Permissions . . . . . . . . . . . . . . . . . . . . . 246 Access with chmod . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247

  Contents

  Using Quotas for Accounts . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 Installing quotas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 Using edquota . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 Quota reporting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253

  Using System Monitoring Tools . . . . . . . . . . . . . . . . . . . . . . . . . 255 Monitoring system log files . . . . . . . . . . . . . . . . . . . . . . . . 255 Disk monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 User monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 Automated monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . 263

  Chapter 13: Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 Working with Perl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 Finding documentation for Perl . . . . . . . . . . . . . . . . . . . . . 265 Using modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 Using Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 Using Kaffe and the Sun JDK . . . . . . . . . . . . . . . . . . . . . . . 273 Using gcj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273 Finding documentation for Java . . . . . . . . . . . . . . . . . . . . . 274 Using Java libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274 Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 Using Tcl/Tk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276 Finding documentation for Tcl/Tk . . . . . . . . . . . . . . . . . . . . 277 Adding Tcl/Tk libraries . . . . . . . . . . . . . . . . . . . . . . . . . . 277 Programming With Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 Finding documentation for Python . . . . . . . . . . . . . . . . . . . . 278 Installing Python libraries . . . . . . . . . . . . . . . . . . . . . . . . . 279 Using C/C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 Finding C/C++ documentation . . . . . . . . . . . . . . . . . . . . . . 284 Using C/C++ tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 Using C/C++ libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 Chapter 14: Shells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 What Is a Shell? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 Using the shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 The Command Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 Standard input and output . . . . . . . . . . . . . . . . . . . . . . . . 295 Debian GNU/Linux Bible

  Jobs and job control . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 Escaping — special characters . . . . . . . . . . . . . . . . . . . . . . 303 Shell variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303

  The Shell Variants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 Bourne shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 C shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 Korn shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 Special shell characters . . . . . . . . . . . . . . . . . . . . . . . . . . 310

  Shell Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311