Wiley Linux Bible 2009 Edition Boot Up Ubuntu Fedora KNOPPIX Debian OpenSUSE And More Jan 2009 ISBN 0470373679 pdf

Christopher Negus DVD and CD-ROM Included Run or install 18 different Linux distributions from the multi-boot DVD and CD-ROM! Boot up to Ubuntu

Lin u x 2009 Edition

  Start up a Linux desktop or server computer Migrate easily from Windows ® or Mac OS ® Try tons of Linux apps, then install to hard disk

  

®,

Fedora ® , KNOPPIX, Debian ® , openSUSE ® , and 13 Other Distributions Linux ® 2009 Edition

  Linux

  ®

  Bible 2009 Edition

  Linux

®

  Bible

2009 Edition

  Boot Up to Ubuntu

  ®

  , Fedora

  ®

  , KNOPPIX, Debian

  ®

  , SUSE

  ®

  , and

  

Christopher Negus

  Linux® Bible 2009 Edition Published by Wiley Publishing, Inc.

  10475 Crosspoint Boulevard Indianapolis, IN 46256 Copyright © 2009 by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada

  ISBN: 978-0-470-37367-5 Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 Library of Congress Cataloging-in-Publication Data is available from the publisher.

No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means,

electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108

of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization

through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA

01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Legal

Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4355,

or online a Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with

respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including

without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional

services. If professional assistance is required, the services of a competent professional person should be sought. Neither

the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is

referred to in this work as a citation and/or a potential source of further information does not mean that the author or

the publisher endorses the information the organization or Web site may provide or recommendations it may make.

Further, readers should be aware that Internet Web sites listed in this work may have changed or disappeared between

when this work was written and when it is read.

For general information on our other products and services please contact our Customer Care Department within the

United States at (800) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.

  

Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Wrox Programmer to Programmer, and related trade dress

are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other

countries, and may not be used without written permission. Linux is a registered trademark of Linus Torvalds. All other

trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book.

  

Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available

in electronic books.

  As always, I dedicate this book to my wife, Sheree.

  About the Author Chris Negus has written or co-written dozens of books on Linux and UNIX, including Red

Hat Linux Bible (all editions), Fedora and Red Hat Enterprise Linux Bible, Linux Troubleshooting

Bible, Linux Toys, and Linux Toys II. Last year, Chris co-authored four books for the new Tool-

  box series for power users: Fedora Linux Toolbox, SUSE Linux Toolbox, Ubuntu Linux Toolbox, and BSD UNIX Toolbox. For eight years, Chris worked with the organization at AT&T that developed UNIX before mov- ing to Utah to help contribute to Novell’s UnixWare project in the early 1990s. When not writing about Linux, Chris enjoys playing soccer and just hanging out with his family. Credits Acquisitions Editor

  Jenny Watson

  Project Coordinator, Cover

  Cover Designer

  Joyce Haughey

  Cover Image

  Shawn Patrick

  Media Development Associate Producer

  Laura Moss-Hollister

  Media Development Project Manager

  Jack Lewis

  Indexer

  Kathryn Duggan

  Proofreader

  Chris Gillespie, Happenstance Type-O-Rama

  Compositor

  Lynsey Stanford

  Joseph B. Wikert

  Development Editor

  Vice President and Executive Publisher

  Richard Swadley

  Vice President and Executive Group Publisher

  Tim Tate

  Production Manager

  Mary Beth Wakefi eld

  Editorial Manager

  Nancy Rapoport

  Copy Editor

  Liz Britten

  Production Editor

  Emmett Dulaney

  Technical Editor

  Sara Shlaer

  Michael Trent

Acknowledgments

  I consider anyone who has contributed to the free and open source software community to be a contributor to the book you are holding. The backbone of any Linux distribution is formed by the organizations that produce the distributions, the major projects included in Linux, and the thou- sands of people who give their time and code to support Linux. So, thanks to you all! I’d like to acknowledge several contributors for their participation in previous editions. Wayne Tucker wrote and then updated the chapters on Debian, LAMP servers, and mail servers. Bill von Hagen contributed updates to the SUSE, Yellow Dog, and Ubuntu chapters. Emmett Dulaney served as technical editor to this edition. Thanks to the folks at Wiley for helping me press through the project. Jenny Watson helped me schedule the project so I could do the major rewrite needed to get all the latest Linux innovations in the book. Sara Shlaer did her usual great job keeping the project moving under a very challeng- ing schedule. Liz Britten shepherded the book through the production process. Thanks to Margot Maley Hutchison and Maureen Maloney from Waterside Productions for contracting the book for me with Wiley.

  And finally, special thanks to my wife, Sheree. There’s no way I could do the work I do without the solid support I get on the home front. I love you, and thanks for taking such good care of Seth, Caleb, and me.

  Introduction .............................................................................................................................xxvii

  

Part I: Getting off the Ground with Linux . . . . . . . . . . . . . . . . . . 1

Chapter 1: Starting with Linux ......................................................................................................3 Chapter 2: Linux Projects, Activities, and Careers .......................................................................15 Part II: Running a Linux Desktop . . . . . . . . . . . . . . . . . . . . . . . . 33 Chapter 3: Getting into the Desktop ............................................................................................ 35 Chapter 4: Playing Music and Video ............................................................................................ 81 Chapter 5: Working with Words and Images ............................................................................. 117 Chapter 6: E-Mailing and Web Browsing ................................................................................... 147 Chapter 7: Gaming with Linux .................................................................................................. 179 Part III: Learning System Administration Skills . . . . . . . . . . . . . 205 Chapter 8: Installing Linux ........................................................................................................207 Chapter 9: Running Commands from the Shell .........................................................................237 Chapter 10: Learning Basic Administration ...............................................................................285 Chapter 11: Getting on the Internet ........................................................................................... 335 Chapter 12: Securing Linux ....................................................................................................... 359 Part IV: Setting Up Linux Servers . . . . . . . . . . . . . . . . . . . . . . . 407 Chapter 13: Running a Linux, Apache, MySQL, and PHP (LAMP) Server .................................409 Chapter 14: Running a Mail Server ............................................................................................ 431 Chapter 15: Running a Print Server ...........................................................................................447 Chapter 16: Running a File Server .............................................................................................469 Part V: Choosing and Installing Different Linux Distributions . . 503 Chapter 17: Running Ubuntu Linux ...........................................................................................505 Chapter 18: Running Fedora and Red Hat Enterprise Linux ......................................................523 Chapter 19: Running Debian GNU/Linux ..................................................................................547 Chapter 20: Running SUSE and openSUSE Linux .....................................................................571 Chapter 21: Running KNOPPIX .................................................................................................585 Chapter 22: Running Yellow Dog Linux .....................................................................................607 Chapter 23: Running Gentoo Linux ........................................................................................... 619 Chapter 24: Running Slackware Linux ....................................................................................... 641

  Contents at a Glance

  Chapter 25: Running Freespire and Xandros ............................................................................. 657 Chapter 26: Running Mandriva..................................................................................................667 Chapter 27: Running a Linux Firewall/Router ........................................................................... 681 Chapter 28: Running Bootable Linux Distributions ................................................................... 707 Part VI: Programming in Linux . . . . . . . . . . . . . . . . . . . . . . . . . 727 Chapter 29: Programming Environments and Interfaces ...........................................................729 Chapter 30: Programming Tools and Utilities ............................................................................759 Appendix A: Media ....................................................................................................................789 Appendix B: Linux History and Background..............................................................................799 Index .......................................................................................................................................... 819

  

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvii

  Part I: Getting off the Ground with Linux

  1 Chapter 1: Starting with Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

  Taking Your First Step ..........................................................................................................4 What Comes in Linux Systems? ..................................................................................4 What Do You Need to Get Started? .............................................................................5 Starting Right Now .....................................................................................................6

  Understanding Linux ......................................................................................................... 10 What’s So Great About Linux? ............................................................................................13 Summary ............................................................................................................................ 14

  

Chapter 2: Linux Projects, Activities, and Careers . . . . . . . . . . . . . . . . . . . . . 15

Making Things with Linux ................................................................................................. 16 Linux in Outer Space ................................................................................................ 16 Linux in Gadgets ...................................................................................................... 17 Linux in Projects .......................................................................................................19 Getting Involved with Linux .............................................................................................. 21 Joining a Linux User Group ...................................................................................... 21 Joining Linux Communities .....................................................................................22 Companies and Groups Supporting Linux ...............................................................22 Keeping Up with Linux ......................................................................................................23 Major Linux Projects ................................................................................................. 24 Exploring Linux Distributions ..................................................................................25 Linux in the Real World ..................................................................................................... 27 Linux in Schools ....................................................................................................... 27 Linux in Small Business ............................................................................................28 Linux in the Enterprise .............................................................................................29 Becoming a Linux Professional ...........................................................................................30 Summary ............................................................................................................................ 31

Contents

  Part II: Running a Linux Desktop

  33 Chapter 3: Getting into the Desktop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

  Understanding Your Desktop ............................................................................................. 35 Starting the Desktop ...........................................................................................................36

  Boot to the Desktop ..................................................................................................36 Boot to a Graphical Login .........................................................................................37 Boot to a Text Prompt ...............................................................................................39

  K Desktop Environment .....................................................................................................39 Using the KDE Desktop ............................................................................................40 Managing Files with the Dolphin and Konqueror .....................................................44 Using the Dolphin File Manager ...............................................................................44 Using the Konqueror Web Browser/File Manager .....................................................49 Managing the KDE Desktop .....................................................................................52 Confi guring the Desktop ..........................................................................................54

  The GNOME Desktop ........................................................................................................56 Using the Metacity Window Manager .......................................................................58 Using the GNOME Panels .........................................................................................60 Using the Nautilus File Manager ...............................................................................64

  3D Effects with AIGLX .............................................................................................67 Changing GNOME Preferences ................................................................................69 Exiting GNOME ....................................................................................................... 70

  Confi guring a GNOME Online Desktop.............................................................................71 Confi guring Your Own Desktop .........................................................................................73

  Confi guring X ...........................................................................................................73 Choosing a Window Manager ...................................................................................77 Choosing Your Personal Window Manager ...............................................................79

  Getting More Information ..................................................................................................79 Summary ............................................................................................................................80

  Chapter 4: Playing Music and Video. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 Playing Digital Media and Obeying the Law ......................................................................82 Copyright Protection Issues ......................................................................................82 Exploring Codecs .....................................................................................................84 Playing Music .....................................................................................................................85 Using Sound Systems in Linux .................................................................................86 Adjusting Sound with PulseAudio ............................................................................86 Setting Up Audio Cards ............................................................................................88 Choosing an Audio CD Player ..................................................................................89 Using MIDI Audio Players.........................................................................................96 Performing Audio File Conversion and Compression ...............................................96 Recording and Ripping Music ............................................................................................99 Creating an Audio CD with cdrecord .....................................................................100 Ripping CDs with Grip ........................................................................................... 101 Creating CD Labels with cdlabelgen ....................................................................... 103

Contents

  Working with TV, Video, and Digital Imaging .................................................................104 Watching TV with tvtime .......................................................................................104 Video Conferencing with Ekiga ..............................................................................106

  Watching Movies and Video .............................................................................................108 Watching Video with xine ......................................................................................108 Using Totem Movie Player ...................................................................................... 112

  Using a Digital Camera .................................................................................................... 113 Displaying Images in gThumb ................................................................................ 113 Using Your Camera as a Storage Device .................................................................. 114

  Summary .......................................................................................................................... 115

  Chapter 5: Working with Words and Images . . . . . . . . . . . . . . . . . . . . . . . . 117 Desktop Publishing in Linux ............................................................................................ 117 Using Text Editors and Notepads ............................................................................ 118 Using Word Processors ........................................................................................... 119 Transitioning Documents from Windows ............................................................... 124 Converting Documents ...........................................................................................126 Building Structured Documents .............................................................................128 Doing Page Layout with Scribus .............................................................................132 Working with Graphics ....................................................................................................134 Manipulating Images with GIMP ............................................................................134 Creating Vector Graphic Images with Inkscape ......................................................136 Acquiring Screen Captures .....................................................................................138 Viewing Images ......................................................................................................139 Displaying PDF and PostScript Documents ..................................................................... 141 Using the ghostscript and gv Commands ............................................................... 141 Using Adobe Reader ............................................................................................... 141 Using Scanners with SANE .............................................................................................. 143 Web Publishing ................................................................................................................ 144 Summary .......................................................................................................................... 145 Chapter 6: E-Mailing and Web Browsing . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 Using E-Mail ..................................................................................................................... 147 Choosing an E-Mail Client...................................................................................... 147 Getting Here from Windows ................................................................................... 149 Getting Started with E-Mail ....................................................................................150 Tuning Up E-Mail ................................................................................................... 151 Reading E-Mail with Thunderbird ..........................................................................152 Managing E-Mail in Evolution ................................................................................158 Reading E-Mail with SeaMonkey Mail .................................................................... 162 Working with Text-Based E-Mail Readers .............................................................. 162 Choosing a Web Browser ..................................................................................................164 Exploring the SeaMonkey Suite ........................................................................................ 165 Using Firefox .................................................................................................................... 166 Setting Up Firefox ...................................................................................................168 Securing Firefox...................................................................................................... 172

Contents

  Tips for Using Firefox ............................................................................................. 173 Using Firefox Controls ............................................................................................ 174 Improving Firefox Browsing ................................................................................... 175 Doing Cool Things with Firefox ............................................................................. 176

  Using Text-Based Web Browsers ....................................................................................... 177 Summary .......................................................................................................................... 178

  Chapter 7: Gaming with Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 Jumping into Linux Gaming ............................................................................................. 179 Overview of Linux Gaming .............................................................................................. 181 Basic Linux Gaming Information ..................................................................................... 182 Choosing Gaming Hardware for Linux ............................................................................184 Running Open Source Linux Games ................................................................................ 185 GNOME Games ......................................................................................................186 KDE Games ............................................................................................................ 187 Games in Fedora .....................................................................................................188 Commercial Linux Games ................................................................................................ 195 Getting Started with Commercial Games in Linux ................................................. 195 Playing Commercial Linux Games ........................................................................196

  id Software Games .................................................................................................. 197 Playing TransGaming and Cedega Games ..............................................................198 Loki Software Game Demos ....................................................................................200

  Summary ..........................................................................................................................204

  Part III: Learning System Administration Skills 205 Chapter 8: Installing Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 Choosing a Linux Distribution .........................................................................................208 Linux at Work .........................................................................................................208 Other Distributions ................................................................................................209 Getting Your Own Linux Distribution ..............................................................................209 Finding Another Linux Distribution ....................................................................... 210 Understanding What You Need .............................................................................. 210 Downloading the Distribution ................................................................................ 211 Burning the Distribution to CD .............................................................................. 212 Exploring Common Installation Topics ............................................................................ 213 Knowing Your Computer Hardware ....................................................................... 213 Upgrading or Installing from Scratch ..................................................................... 215 Dual Booting with Windows or Just Linux? ........................................................... 215 Using Installation Boot Options ............................................................................. 217 Partitioning Hard Drives......................................................................................... 217 Using LILO or GRUB Boot Loaders .........................................................................225 Confi guring Networking ........................................................................................235 Confi guring Other Administrative Features ...........................................................235 Installing from the Linux Bible CD or DVD ......................................................................236 Summary ..........................................................................................................................236

  Contents

  Chapter 9: Running Commands from the Shell . . . . . . . . . . . . . . . . . . . . . . 237 Starting a Shell .................................................................................................................238 Using the Shell Prompt ...........................................................................................238 Using a Terminal Window ......................................................................................239 Using Virtual Terminals .........................................................................................240 Choosing Your Shell .........................................................................................................240 Using bash (and Earlier sh) Shells ........................................................................... 241 Using tcsh (and Earlier csh) Shells .......................................................................... 241 Using ash ................................................................................................................ 242 Using ksh ................................................................................................................ 242 Using zsh ................................................................................................................ 242 Exploring the Shell ........................................................................................................... 242 Checking Your Login Session ................................................................................. 242 Checking Directories and Permissions ................................................................... 243 Checking System Activity ....................................................................................... 245 Exiting the Shell .....................................................................................................246 Using the Shell in Linux ................................................................................................... 247 Locating Commands .............................................................................................. 248 Rerunning Commands ...........................................................................................250 Connecting and Expanding Commands .................................................................256 Creating Your Shell Environment .....................................................................................259 Confi guring Your Shell ...........................................................................................259 Using Shell Environment Variables .........................................................................263 Managing Background and Foreground Processes .................................................266 Working with the Linux File System ................................................................................268 Creating Files and Directories ................................................................................ 270 Moving, Copying, and Deleting Files ...................................................................... 278 Using the vi Text Editor .................................................................................................... 278 Starting with vi ....................................................................................................... 279 Moving Around the File ..........................................................................................282 Searching for Text ...................................................................................................282 Using Numbers with Commands ...........................................................................283 Summary ..........................................................................................................................283 Chapter 10: Learning Basic Administration . . . . . . . . . . . . . . . . . . . . . . . . . 285 Graphical Administration Tools .......................................................................................286 Using Web-Based Administration ...........................................................................286 Graphical Administration with Different Distributions ..........................................287 Using the root Login ......................................................................................................... 291 Becoming Root from the Shell (su Command) ........................................................292 Allowing Limited Administrative Access ................................................................293 Exploring Administrative Commands, Confi guration Files, and Log Files ......................294 Administrative Commands .....................................................................................294 Administrative Confi guration Files.........................................................................295 Administrative Log Files .........................................................................................299

Contents

  Using sudo and Other Administrative Logins .................................................................300 Administering Your Linux System ....................................................................................303 Creating User Accounts ....................................................................................................303

  Adding Users with useradd ....................................................................................303 Setting User Defaults ..............................................................................................307 Modifying Users with usermod ..............................................................................309 Deleting Users with userdel .................................................................................... 310

  Confi guring Hardware ..................................................................................................... 310 Managing Removable Hardware ............................................................................. 311 Working with Loadable Modules ............................................................................ 314

  Managing File Systems and Disk Space ............................................................................ 317 Mounting File Systems ............................................................................................ 319 Using the mkfs Command to Create a File System .................................................326 Adding a Hard Disk ................................................................................................ 327 Checking System Space ..........................................................................................330

  Monitoring System Performance ....................................................................................... 332 Summary .......................................................................................................................... 333

  Chapter 11: Getting on the Internet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335 Connecting to the Network ..............................................................................................336 Connecting via Dial-Up Service .............................................................................336 Connecting a Single Computer to Broadband ......................................................... 337 Connecting Multiple Computers to Broadband ......................................................338 Connecting Servers .................................................................................................339 Connecting Other Equipment ................................................................................ 341 Using Ethernet Connections to the Internet .....................................................................342 Confi guring Ethernet During Installation ..............................................................342 Confi guring Ethernet from the Desktop .................................................................342 Using Network Confi guration GUI in Fedora .........................................................344 Identifying Other Computers (Hosts and DNS) ......................................................345 Using the Network Settings GUI in Ubuntu ...........................................................347 Understanding Your Internet Connection ...............................................................348 Using Dial-Up Connections to the Internet ...................................................................... 351 Getting Information ................................................................................................ 351 Setting Up Dial-Up PPP .......................................................................................... 352 Creating a Dial-Up Connection with the Internet Confi guration Wizard ............... 353 Launching Your PPP Connection ............................................................................ 355 Launching Your PPP Connection on Demand......................................................... 355 Checking Your PPP Connection .............................................................................. 356 Checking That Your Modem Was Detected ............................................................ 356 Connecting to the Internet with Wireless ......................................................................... 357 Summary ..........................................................................................................................358 Chapter 12: Securing Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 Linux Security Checklist ..................................................................................................360 Finding Distribution-Specifi c Security Resources ...................................................363 Finding General Security Resources .......................................................................364

Contents

  Using Linux Securely .......................................................................................................365 Using Password Protection .....................................................................................365 Choosing Good Passwords .....................................................................................365 Using a Shadow Password File ................................................................................367

  Using Log Files .................................................................................................................369 The Role of syslogd .................................................................................................372 Redirecting Logs to a Loghost with syslogd ............................................................372 Understanding the messages Log File ..................................................................... 374

  Using Secure Shell Tools ................................................................................................... 374 Starting the SSH Service ......................................................................................... 375 Using the ssh, sftp, and scp Commands ................................................................. 375 Using ssh, scp, and sftp without Passwords ............................................................377

  Securing Linux Servers..................................................................................................... 378 Controlling Access to Services with TCP Wrappers................................................ 378 Understanding Attack Techniques .......................................................................... 381 Protecting Against Denial-of-Service Attacks .........................................................382 Protecting Against Distributed DoS Attacks ...........................................................385 Protecting Against Intrusion Attacks ......................................................................389 Securing Servers with SELinux ..............................................................................392 Protecting Web Servers with Certifi cates and Encryption .....................................393

  Using Linux Live CD Security Tools .................................................................................403 Advantages of Security Live CDs ............................................................................403 Using INSERT to Check for Rootkits ......................................................................403

  Summary ..........................................................................................................................405

  Part IV: Setting Up Linux Servers 407 Chapter 13: Running a Linux, Apache, MySQL, and PHP (LAMP) Server . . . 409 Components of a LAMP Server ......................................................................................... 410 Apache .................................................................................................................... 410 MySQL .................................................................................................................... 410 PHP......................................................................................................................... 411 Setting Up Your LAMP Server .......................................................................................... 411 Installing Apache .................................................................................................... 412 Installing PHP......................................................................................................... 412 Installing MySQL .................................................................................................... 414 Operating Your LAMP Server ........................................................................................... 414 Editing Your Apache Confi guration Files ................................................................ 415 Adding a Virtual Host to Apache ............................................................................ 417 User Content and the userdir Setting ...................................................................... 418 Installing a Web Application: Coppermine Photo Gallery ...................................... 419 Troubleshooting ...............................................................................................................422 Confi guration Errors...............................................................................................422 Access Forbidden and Server Internal Errors .......................................................... 424

Contents

  Securing Your Web Traffi c with SSL/TLS ......................................................................... 425 Generating Your Keys ............................................................................................. 427 Confi guring Apache to Support SSL/TLS ...............................................................428

  Summary .......................................................................................................................... 429