Preface xxxvii Chapter 1: Welcome to Linux 1The GNU-Linux Connection 2The Linux 2.6 Kernel 5The Heritage of Linux: UNIX 5What Is So Good About Linux? 6Overview of Linux 10Additional Features of Linux 14Conventions Used in This Book 16Chapter Summary 19Exercises 19 Part I: Installing Fedora and Red Hat Enterprise Linux 21 Chapter 2: Installation Overview 23The Desktop Live CD and the Install DVD 24Planning the Installation 24The Installation Process 39The Medium: Where Is the Source Data? 40Downloading a CD/DVD (FEDORA) 41Checking and Burning the CD/DVD 45Rescue Selection of the Install DVD 46Gathering Information About the System 46Finding the Installation Manual 47More Information 48Chapter Summary 48Exercises 49Advanced Exercises 49 Chapter 3: Step-by-Step Installation 51Running a Fedora Live Session 52Installing Fedora/RHEL 55Installation Tasks 68The X Window System 84Chapter Summary 85Exercises 85Advanced Exercises 86 Part II: Getting Started with Fedora and Red Hat Enterprise Linux 87 Chapter 4: Introduction to Fedora and Red Hat Enterprise Linux 89Curbing Your Power (Superuser/root Privileges) 90A Tour of the Fedora/RHEL Desktop 90Getting the Most Out of the Desktop 109Updating, Installing, and Removing Software Packages 122Where to Find Documentation 124More About Logging In 132Working from the Command Line 138Controlling Windows: Advanced Operations 141Chapter Summary 143Exercises 144Advanced Exercises 145 Chapter 5: The Linux Utilities 147Special Characters 148Basic Utilities 149Working with Files 151| (Pipe): Communicates Between Processes 158Four More Utilities 159Compressing and Archiving Files 161Locating Commands 166Obtaining User and System Information 168Communicating with Other Users 172Email 174Tutorial: Creating and Editing a File Using vim 174Chapter Summary 181Exercises 184Advanced Exercises 185 Chapter 6: The Linux Filesystem 187The Hierarchical Filesystem 188Directory Files and Ordinary Files 188Pathnames 193Directory Commands 195Working with Directories 200Access Permissions 202ACLs: Access Control Lists 207Links 212Chapter Summary 218Exercises 220Advanced Exercises 222 Chapter 7: The Shell 223The Command Line 224Standard Input and Standard Output 230Running a Program in the Background 241Filename Generation/Pathname Expansion 243Builtins 247Chapter Summary 248Utilities and Builtins Introduced in This Chapter 249Exercises 249Advanced Exercises 251 Part III: Digging into Fedora and Red Hat Enterprise Linux 253 Chapter 8: Linux GUIs: X and GNOME 255X Window System 256The Nautilus File Browser Window 264The Nautilus Spatial View 270GNOME Utilities 272Chapter Summary 276Exercises 277Advanced Exercises 277 Chapter 9: The Bourne Again Shell 279Background 280Shell Basics 281Parameters and Variables 299Special Characters 313Processes 314History 316Aliases 332Functions 335Controlling bash Features and Options 338Processing the Command Line 342Chapter Summary 351Exercises 353Advanced Exercises 355 Chapter 10: Networking and the Internet 357Types of Networks and How They Work 359Communicate Over a Network 374Network Utilities 376Distributed Computing 383Usenet 392WWW: World Wide Web 395Chapter Summary 397Exercises 398Advanced Exercises 399 Part IV: System Administration 401 Chapter 11: System Administration: Core Concepts 403System Administrator and Superuser 405Rescue Mode 411SELinux 414The Upstart Event-Based init Daemon (FEDORA) 417System Operation 424System Administration Utilities 436Setting Up a Server 441nsswitch.conf: Which Service to Look at First 455PAM 458Chapter Summary 464Exercises 464Advanced Exercises 465 Chapter 12: Files, Directories, and Filesystems 467Important Files and Directories 468File Types 480Filesystems 485Chapter Summary 495Exercises 495Advanced Exercises 496 Chapter 13: Downloading and Installing Software 497yum: Keeps the System Up-to-Date 498Adding and Removing Software Packages 505BitTorrent 507rpm: Red Hat Package Manager 510Installing Non-rpm Software 513Keeping Software Up-to-Date 515wget: Downloads Files Noninteractively 517Chapter Summary 518Exercises 518Advanced Exercises 518 Chapter 14: Printing with CUPS 519Introduction 520JumpStart I: Configuring a Local Printer 521system-config-printer: Configuring a Printer 522JumpStart II: Setting Up a Local or Remote Printer Using the CUPS Web Interface 527Traditional UNIX Printing 530Configuring Printers 532Printing from Windows 538Printing to Windows 540Chapter Summary 540Exercises 541Advanced Exercises 541 Chapter 15: Rebuilding the Linux Kernel 543Preparing the Source Code 544Read the Documentation 546Configuring and Compiling the Linux Kernel 547Installing the Kernel and Associated Files 550Rebooting the System 550Boot Loader 551dmesg: Displays Kernel Messages 553Chapter Summary 553Exercises 554Advanced Exercises 554 Chapter 16: Administration Tasks 555Configuring User and Group Accounts 556Backing Up Files 558Scheduling Tasks 565System Reports 566parted: Reports on and Partitions a Hard Disk 568Keeping Users Informed 572Creating Problems 572Solving Problems 574MySQL 584Chapter Summary 592Exercises 593Advanced Exercises 593 Chapter 17: Configuring and Monitoring a LAN 595Setting Up the Hardware 596Configuring the Systems 598NetworkManager: Configures Network Connections 599The Network Configuration Window (system-config-network) 601iwconfig: Configures a Wireless NIC 605Setting Up Servers 606Introduction to Cacti 607More Information 617Chapter Summary 617Exercises 618Advanced Exercises 618 Part V: Using Clients and Setting Up Servers 619 Chapter 18: OpenSSH: Secure Network Communication 621Introduction 622About OpenSSH 622OpenSSH Clients 625sshd: OpenSSH Server 633Troubleshooting 637Tunneling/Port Forwarding 638Chapter Summary 641Exercises 641Advanced Exercises 642 Chapter 19: FTP: Transferring Files Across a Network 643Introduction 644More Information 645FTP Client 645FTP Server (vsftpd) 654Chapter Summary 666Exercises 667Advanced Exercises 667 Chapter 20: sendmail: Setting Up Mail Clients, Servers, and More 669Introduction 670JumpStart I: Configuring sendmail on a Client 672JumpStart II: Configuring sendmail on a Server 673How sendmail Works 674Configuring sendmail 677Additional Email Tools 682Authenticated Relaying 689Alternatives to sendmail 691Chapter Summary 692Exercises 692Advanced Exercises 693 Chapter 21: NIS and LDAP 695Introduction to NIS 696How NIS Works 696Setting Up an NIS Client 699Setting Up an NIS Server 703LDAP 710Setting Up an LDAP Server 713Chapter Summary 723Exercises 724Advanced Exercises 724 Chapter 22: NFS: Sharing Filesystems 727Introduction 728More Information 730Setting Up an NFS Client 730Setting Up an NFS Server 736automount: Automatically Mounts Directory Hierarchies 744Chapter Summary 746Exercises 746Advanced Exercises 747 Chapter 23: Samba: Integrating Linux and Windows 749Introduction 750About Samba 751JumpStart: Configuring a Samba Server Using system-config-samba 753swat: Configures a Samba Server 755Manually Configuring a Samba Server 759Accessing Linux Shares from Windows 765Accessing Windows Shares from Linux 766Troubleshooting 768Chapter Summary 770Exercises 771Advanced Exercises 771 Chapter 24: DNS/BIND: Tracking Domain Names and Addresses 773Introduction to DNS 774About DNS 785JumpStart I: Setting Up a DNS Cache 787JumpStart II: Setting Up a Domain Using system-config-bind 789Setting Up BIND 793Troubleshooting 805A Full-Functioned Nameserver 807A Slave Server 810A Split Horizon Server 811Chapter Summary 816Exercises 816Advanced Exercises 817 Chapter 25: iptables: Setting Up a Firewall 819How iptables Works 820About iptables 822JumpStart: Building a Firewall Using system-config-firewall 824Anatomy of an iptables Command 825Building a Set of Rules 826system-config-firewall: Generates a Set of Rules 833Sharing an Internet Connection Using NAT 835Chapter Summary 839Exercises 839Advanced Exercises 839 Chapter 26: Apache (httpd): Setting Up a Web Server 841Introduction 842About Apache 842JumpStart I: Getting Apache Up and Running 844JumpStart II: Setting Up Apache Using system-config-httpd 846Filesystem Layout 848Configuration Directives 850The Fedora/RHEL httpd.conf File 870Redirects 873Multiviews 874Server-Generated Directory Listings (Indexing) 874Virtual Hosts 874Troubleshooting 875Modules 876webalizer: Analyzes Web Traffic 881MRTG: Monitors Traffic Loads 882Error Codes 882Chapter Summary 883Exercises 884Advanced Exercises 884 Part VI: Programming Tools 885 Chapter 27: Programming the Bourne Again Shell 887Control Structures 888File Descriptors 921Parameters and Variables 924Builtin Commands 936Expressions 950Shell Programs 958Chapter Summary 968Exercises 970Advanced Exercises 972 Chapter 28: The Perl Scripting Language 975Introduction to Perl 976Variables 983Control Structures 991Working with Files 1000Sort 1003Subroutines 1005Regular Expressions 1007CPAN Modules 1013Examples 1015Chapter Summary 1019Exercises 1019Advanced Exercises 1020 Part VII: Appendixes 1021 Appendix A: Regular Expressions 1023Characters 1024Delimiters 1024Simple Strings 1024Special Characters 1024Rules 1027Bracketing Expressions 1028The Replacement String 1028Extended Regular Expressions 1029Appendix Summary 1031 Appendix B: Help 1033Solving a Problem 1034Finding Linux-Related Information 1035Specifying a Terminal 1040 Appendix C: Security 1043Encryption 1044File Security 1049Email Security 1049Network Security 1050Host Security 1053Security Resources 1058Appendix Summary 1061 Appendix D: The Free Software Definition 1063 Glossary 1067Index 1117
Mark G. Sobell is President of Sobell Associates Inc., a consulting firm that specializes in UNIX/Linux training, support, and custom software development. He has more than twenty-five years of experience working with UNIX and Linux systems and is the author of many best-selling books, including A Practical Guide to Linux (R) Commands, Editors, and Shell Programming, Second Edition, and A Practical Guide to Ubuntu Linux (R), Second Edition, both from Prentice Hall, and A Practical Guide to the UNIX System from Addison-Wesley.
"I have found this book to be a very useful classroom text, as well as a great Linux resource. It teaches Linux using a ground-up approach that gives students the chance to progress with their skills and grow into the Linux world. I have often pointed to this book when asked to recommend a solid Linux reference." - Eric Hartwell, Chair, School of Information Technology, ITT Technical InstitutePraise for Previous Editions of A Practical Guide to Fedora (TM) and Red Hat (R) Enterprise Linux (R) "Since I'm in an educational environment, I found the content of Sobell's book to be right on target and very helpful for anyone managing Linux in the enterprise. His style of writing is very clear. He builds up to the chapter exercises, which I find to be relevant to real-world scenarios a user or admin would encounter. An IT/IS student would find this book a valuable complement to their education. The vast amount of information is extremely well balanced and Sobell manages to present the content without complicated asides and meandering prose. This is a `must have' for anyone managing Linux systems in a networked environment or anyone running a Linux server. I would also highly recommend it to an experienced computer user who is moving to the Linux platform."-Mary Norbury, IT Director, Barbara Davis Center, University of Colorado at Denver, from a review posted on slashdot.org "I had the chance to use your UNIX books when I when was in college years ago at Cal Poly, San Luis Obispo, CA. I have to say that your books are among the best! They're quality books that teach the theoretical aspects and applications of the operating system."-Benton Chan, IS Engineer "The book has more than lived up to my expectations from the many reviews I read, even though it targets FC2. I have found something very rare with your book: It doesn't read like the standard technical text, it reads more like a story. It's a pleasure to read and hard to put down. Did I say that?! :-)"-David Hopkins, Business Process Architect "Thanks for your work and for the book you wrote. There are really few books that can help people to become more efficient administrators of different workstations. We hope (in Russia) that you will continue bringing us a new level of understanding of Linux/UNIX systems."-Anton Petukhov "Mark Sobell has written a book as approachable as it is authoritative."-Jeffrey Bianchine, Advocate, Author, Journalist "Excellent reference book, well suited for the sysadmin of a Linux cluster, or the owner of a PC contemplating installing a recent stable Linux. Don't be put off by the daunting heft of the book. Sobell has striven to be as inclusive as possible, in trying to anticipate your system administration needs."-Wes Boudville, Inventor "A Practical Guide to Red Hat (R) Linux (R) is a brilliant book. Thank you, Mark Sobell."-C. Pozrikidis, University of California at San Diego "This book presents the best overview of the Linux operating system that I have found. . . . [It] should be very helpful and understandable no matter what the reader's background: traditional UNIX user, new Linux devotee, or even Windows user. Each topic is presented in a clear, complete fashion and very few assumptions are made about what the reader knows. . . . The book is extremely useful as a reference, as it contains a 70-page glossary of terms and is very well indexed. It is organized in such a way that the reader can focus on simple tasks without having to wade through more advanced topics until they are ready."-Cam Marshall, Marshall Information Service LLC, Member of Front Range UNIX, Users Group [FRUUG], Boulder, Colorado "Conclusively, this is THE book to get if you are a new Linux user and you just got into RH/Fedora world. There's no other book that discusses so many different topics and in such depth."-Eugenia Loli-Queru, Editor in Chief, OSNews.com Praise for Other Books by Mark G. Sobell "This book is a very useful tool for anyone who wants to `look under the hood' so to speak, and really start putting the power of Linux to work. What I find particularly frustrating about man pages is that they never include examples. Sobell, on the other hand, outlines very clearly what the command does and then gives several common, easy-tounderstand examples that make it a breeze to start shell programming on one's own. As with Sobell's other works, this is simple, straightforward, and easy to read. It's a great book and will stay on the shelf at easy arm's reach for a long time."-Ray Bartlett, Travel Writer "Overall I found this book to be quite excellent, and it has earned a spot on the very front of my bookshelf. It covers the real `guts' of Linux-the command line and its utilities-and does so very well. Its strongest points are the outstanding use of examples, and the Command Reference section. Highly recommended for Linux users of all skill levels. Well done to Mark Sobell and Prentice Hall for this outstanding book!"-Dan Clough, Electronics Engineer and Slackware Linux User "Totally unlike most Linux books, this book avoids discussing everything via GUI and jumps right into making the power of the command line your friend."-Bjorn Tipling, Software Engineer, ask.com "This book is the best distro-agnostic, foundational Linux reference I've ever seen, out of dozens of Linux-related books I've read. Finding this book was a real stroke of luck. If you want to really understand how to get things done at the command line, where the power and flexibility of free UNIX-like OSes really live, this book is among the best tools you'll find toward that end."-Chad Perrin, Writer, TechRepublic "I currently own one of your books, A Practical Guide to Linux (R). I believe this book is one of the most comprehensive and, as the title says, practical guides to Linux I have ever read. I consider myself a novice and I come back to this book over and over again."-Albert J. Nguyen "Thank you for writing a book to help me get away from Windows XP and to never touch Windows Vista. The book is great; I am learning a lot of new concepts and commands. Linux is definitely getting easier to use."-James Moritz "I am so impressed by how Mark Sobell can approach a complex topic in such an understandable manner. His command examples are especially useful in providing a novice (or even an advanced) administrator with a cookbook on how to accomplish real-world tasks on Linux. He is truly an inspired technical writer!"-George Vish II, Senior Education Consultant, Hewlett-Packard Company "Overall, I think it's a great, comprehensive Ubuntu book that'll be a valuable resource for people of all technical levels."-John Dong, Ubuntu Forum Council Member, Backports Team Leader "The JumpStart sections really offer a quick way to get things up and running, allowing you to dig into the details of the book later."-Scott Mann, Aztek Networks "I would so love to be able to use this book to teach a class about not just Ubuntu or Linux but about computers in general. It is thorough and well written with good illustrations that explain important conceptsfor computer usage."-Nathan Eckenrode, New York Local Community Team "Ubuntu is gaining popularity at the rate alcohol did during Prohibition, and it's great to see a well-known author write a book on the latest and greatest version. Not only does it contain Ubuntu-specific information, but it also touches on general computer-related topics, which will help the average computer user to better understand what's going on in the background. Great work, Mark!"-Daniel R. Arfsten, Pro/ENGINEER Drafter/Designer "I read a lot of Linux technical information every day, but I'm rarely impressed by tech books. I usually prefer online information sources instead. Mark Sobell's books are a notable exception. They're clearly written, technically accurate, comprehensive, and actually enjoyable to read."-Matthew Miller, Senior Systems Analyst/Administrator, BU Linux Project, Boston University Office, of Information Technology "This is well written, clear, comprehensive information for the Linux user of any type, whether trying Ubuntu on for the first time and wanting to know a little about it, or using the book as a very good reference when doing something more complicated like setting up a server. This book's value goes well beyond its purchase price and it'll make a great addition to the Linux section of your bookshelf."-Linc Fessenden, Host of The LinuxLink TechShow, tllts.org "The author has done a very good job at clarifying such a detail-oriented operating system. I have extensive Unix and Windows experience and this text does an excellent job at bridging the gaps between Linux, Windows, and Unix. I highly recommend this book to both `newbs' and experienced users. Great job!"-Mark Polczynski, Information Technology Consultant "When I first started working with Linux just a short 10 years or so ago, it was a little more difficult than now to get going. . . . Now, someone new to the community has a vast array of resources available on the web, or if they are inclined to begin with Ubuntu, they can literally find almost every single thing they will need in the single volume of Mark Sobell's A Practical Guide to Ubuntu Linux (R). "I'm sure this sounds a bit like hyperbole. Everything a person would need to know? Obviously not everything, but this book, weighing in at just under 1200 pages, covers so much so thoroughly that there won't be much left out. From install to admin, networking, security, shell scripting, package management, and a host of other topics, it is all there. GUI and command line tools are covered. There is not really any wasted space or fluff, just a huge amount of information. There are screen shots when appropriate but they do not take up an inordinate amount of space. This book is information-dense."-JR Peck, Editor, GeekBook.org "I have been wanting to make the jump to Linux but did not have the guts to do so-until I saw your familiarly titled A Practical Guide to Red Hat (R) Linux (R) at the bookstore. I picked up a copy and am eagerly looking forward to regaining my freedom."-Carmine Stoffo, Machine and Process Designer, to pharmaceutical industry "I am currently reading A Practical Guide to Red Hat (R) Linux (R) and am finally understanding the true power of the command line. I am new to Linux and your book is a treasure."-Juan Gonzalez "Overall, A Practical Guide to Ubuntu Linux (R) by Mark G. Sobell provides all of the information a beginner to intermediate user of Linux would need to be productive. The inclusion of the Live DVD of the Gutsy Gibbon release of Ubuntu makes it easy for the user to test-drive Linux without affecting his installed OS. I have no doubts that you will consider this book money well spent."-Ray Lodato, Slashdot contributor, www.slashdot.org