Tải bản đầy đủ (.pdf) (888 trang)

IT training linux bible 2009 edition

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (35.91 MB, 888 trang )

Spine: 1.776"

DVD and CD-ROM Included
Run or install 18 different Linux distributions
from the multi-boot DVD and CD-ROM!

DVD and CD-ROM Included

Christopher Negus

Get in on the Linux phenomenon! Play music and games,
publish on paper or on the Web, and communicate
over the Internet. This comprehensive book includes
step-by-step instructions and software for 18 different
Linux distributions. Whether you are an enterprising
do-it-yourselfer or an aspiring Linux professional, you
can start here on your path to software freedom.








Master Linux for desktops, servers, and workstations
Find, install, and use loads of free and open source software
Create your own cool apps with useful programming tools
Launch all your music, video, images, and documents in Linux
Browse, e-mail, or chat over the Internet from a Linux desktop
Set up your own e-mail and Web (LAMP) servers


Make safe connections with firewalls and other security tools

• To try out Linux, boot directly KNOPPIX, openSUSE, Ubuntu, Gentoo, BackTrack,
and other live Linux distributions
• To keep Linux permanently, install Fedora, Ubuntu, openSUSE, Debian GNU,
Damn Small Linux, Slackware Linux, and other distributions to your hard disk

www.wiley.com/go/linuxbible2009

Shelving Category:
COMPUTERS/
Operating Systems/Linux
Reader Level:
Beginning to Advanced

$59.99 USA
$65.99 Canada

DVD Includes
• Ubuntu Linux (live/install)
• Fedora Linux (install)
• openSUSE (live/install)
• KNOPPIX (live/install)
• Freespire (live/install)
• Gentoo Linux (live/install)
• Slackware® Linux (install)
• BackTrack (live)
• Mandriva One (live/install)
• Mepis (live/install)
• AntiX (live/install)

• Puppy Linux (live/install)
CD-ROM Includes
• Debian GNU/Linux (live/install)
• Damn Small Linux (live/install)
• SLAX (live)
• SystemRescueCd (live)
• INSERT (live)
• Coyote Linux (floppy firewall)
System Requirements:
• All software built for x86 computers
• See chapters on each distribution for
system requirements

®

A total of 18 different Linux distributions are included
on the DVD and CD-ROM.

What’s on the DVD
and CD-ROM?

Linux

Run the world’s most popular free
operating system on your own computer

2009 Edition

Linux
2009 Edition


Boot up to Ubuntu®, Fedora®,
KNOPPIX, Debian®,
openSUSE®, and 13
Other Distributions
Start up a Linux desktop
or server computer
Migrate easily from
Windows or Mac OS
®

Negus

®

Try tons of Linux apps,
then install to hard disk

The book you need to succeed!

®


73675ffirs.indd ii

11/25/08 6:49:03 PM


Linux Bible
®


2009 Edition

73675ffirs.indd i

11/25/08 6:49:03 PM


73675ffirs.indd ii

11/25/08 6:49:03 PM


Linux Bible
®

2009 Edition

Boot Up to Ubuntu , Fedora ,
KNOPPIX, Debian , SUSE , and
13 Other Distributions
®

®

®

®

Christopher Negus


73675ffirs.indd iii

11/25/08 6:49:03 PM


Linux® Bible 2009 Edition
Published by
Wiley Publishing, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256
www.wiley.com

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 at />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.

73675ffirs.indd iv

11/25/08 6:49:03 PM


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

73675ffirs.indd v

11/25/08 6:49:03 PM


73675ffirs.indd vi


11/25/08 6:49:03 PM


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 Toolbox 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 moving 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.

73675ffirs.indd vii

11/25/08 6:49:03 PM


Credits

73675ffirs.indd viii

Acquisitions Editor
Jenny Watson

Vice President and Executive Publisher
Joseph B. Wikert

Development Editor
Sara Shlaer

Project Coordinator, Cover

Lynsey Stanford

Technical Editor
Emmett Dulaney

Compositor
Chris Gillespie, Happenstance Type-O-Rama

Production Editor
Liz Britten

Proofreader
Kathryn Duggan

Copy Editor
Nancy Rapoport

Indexer
Jack Lewis

Editorial Manager
Mary Beth Wakefield

Media Development Project Manager
Laura Moss-Hollister

Production Manager
Tim Tate

Media Development Associate Producer

Shawn Patrick

Vice President and
Executive Group Publisher
Richard Swadley

Cover Image
Joyce Haughey
Cover Designer
Michael Trent

11/25/08 6:49:03 PM


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 thousands 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 challenging 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.


73675ffirs.indd ix

11/25/08 6:49:03 PM


73675ffirs.indd x

11/25/08 6:49:03 PM


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

xi

73675ffirs.indd xi

11/25/08 6:49:03 PM


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

xii

73675ffirs.indd xii

11/25/08 6:49:03 PM


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

xiii

73675ftoc.indd xiii

11/25/08 6:50:12 PM


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
Configuring 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
Configuring a GNOME Online Desktop.............................................................................71
Configuring Your Own Desktop.........................................................................................73
Configuring 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

xiv

73675ftoc.indd xiv

11/25/08 6:50:12 PM


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

xv

73675ftoc.indd xv

11/25/08 6:50:12 PM


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
Configuring Networking ........................................................................................235
Configuring Other Administrative Features ...........................................................235
Installing from the Linux Bible CD or DVD ......................................................................236
Summary ..........................................................................................................................236

xvi

73675ftoc.indd xvi

11/25/08 6:50:12 PM


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
Configuring 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, Configuration Files, and Log Files ......................294
Administrative Commands .....................................................................................294
Administrative Configuration Files.........................................................................295
Administrative Log Files .........................................................................................299

xvii

73675ftoc.indd xvii

11/25/08 6:50:12 PM


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
Configuring 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
Configuring Ethernet During Installation ..............................................................342
Configuring Ethernet from the Desktop .................................................................342
Using Network Configuration 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 Configuration 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-Specific Security Resources...................................................363

Finding General Security Resources .......................................................................364

xviii

73675ftoc.indd xviii

11/25/08 6:50:12 PM


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 Certificates 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 Configuration 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
Configuration Errors...............................................................................................422
Access Forbidden and Server Internal Errors.......................................................... 424

xix


73675ftoc.indd xix

11/25/08 6:50:12 PM


Contents

Securing Your Web Traffic with SSL/TLS .........................................................................425
Generating Your Keys ............................................................................................. 427
Configuring Apache to Support SSL/TLS ...............................................................428
Summary .......................................................................................................................... 429

Chapter 14: Running a Mail Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
Internet E-Mail’s Inner Workings ..................................................................................... 431
About the System and the Software Used ......................................................................... 433
Preparing Your System ..................................................................................................... 433
Configuring DNS for Direct Delivery ......................................................................434
Configuring for Retrieval from a Mail Host ............................................................ 435
Installing and Configuring the Mail Server Software ....................................................... 435
Installing Exim and Courier ................................................................................... 435
Installing ClamAV and SpamAssassin ....................................................................438
Testing and Troubleshooting ............................................................................................440
Checking Logs ........................................................................................................440
Common Errors (and How to Fix Them) ................................................................ 441
Configuring Mail Clients ..................................................................................................444
Configuring Fetchmail ...........................................................................................444
Configuring Web-Based Mail .................................................................................445
Securing Communications with SSL/TLS ........................................................................445
Summary ..........................................................................................................................446


Chapter 15: Running a Print Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
Common UNIX Printing Service .....................................................................................448
Setting Up Printers ...........................................................................................................449
Using Web-Based CUPS Administration ................................................................449
Using the Printer Configuration Window ...............................................................452
Working with CUPS Printing ...........................................................................................459
Configuring the CUPS Server (cupsd.conf) ............................................................460
Starting the CUPS Server ........................................................................................461
Configuring CUPS Printer Options Manually ........................................................462
Using Printing Commands ...............................................................................................463
Printing with lpr .....................................................................................................463
Listing Printer Status with lpc ................................................................................464
Removing Print Jobs with lprm ..............................................................................464
Configuring Print Servers.................................................................................................465
Configuring a Shared CUPS Printer .......................................................................465
Configuring a Shared Samba Printer ......................................................................467
Summary ..........................................................................................................................468

Chapter 16: Running a File Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469
Setting Up an NFS File Server .......................................................................................... 470
Getting NFS ............................................................................................................ 472
Sharing NFS File Systems ....................................................................................... 472
Using NFS File Systems .......................................................................................... 477
Unmounting NFS File Systems ...............................................................................482
Other Cool Things to Do with NFS ........................................................................483

xx

73675ftoc.indd xx


11/25/08 6:50:12 PM


Contents

Setting Up a Samba File Server .........................................................................................484
Getting and Installing Samba .................................................................................485
Configuring Samba with SWAT..............................................................................486
Working with Samba Files and Commands............................................................495
Using Samba Shared Directories .............................................................................498
Troubleshooting Your Samba Server .......................................................................499
Summary .......................................................................................................................... 501

Part V: Choosing and Installing Different Linux Distributions

503

Chapter 17: Running Ubuntu Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505
Overview of Ubuntu .........................................................................................................506
Ubuntu Releases .....................................................................................................506
Ubuntu Installer .....................................................................................................507
Ubuntu as a Desktop ..............................................................................................508
Ubuntu as a Server .................................................................................................508
Ubuntu Spin-Offs ................................................................................................... 510
Challenges Facing Ubuntu...................................................................................... 510
Installing Ubuntu ............................................................................................................. 512
Starting with Ubuntu ....................................................................................................... 516
Trying Out the Desktop .......................................................................................... 517
Adding More Software ............................................................................................ 518
Getting More Information about Ubuntu ......................................................................... 521

Summary .......................................................................................................................... 521

Chapter 18: Running Fedora and Red Hat Enterprise Linux . . . . . . . . . . . . . 523
Digging into Features .......................................................................................................525
Red Hat Installer (Anaconda) .................................................................................525
Custom Spins, Install Sets, and Live CDs ...............................................................526
RPM Package Management .....................................................................................526
Latest Desktop Technology ..................................................................................... 527
System Configuration Tools ....................................................................................528
Going Forward with Fedora .............................................................................................529
Growing Community Support for Fedora ...............................................................530
Joining Fedora Special Interest Groups ...................................................................530
Forums and Mailing Lists ....................................................................................... 531
Fedora Comes of Age ........................................................................................................ 531
Installing Fedora .............................................................................................................. 533
Choosing Computer Hardware ...............................................................................533
Choosing an Installation Method............................................................................534
Choosing to Install or Upgrade ............................................................................... 535
Beginning the Installation ...................................................................................... 537
Running the Fedora Firstboot .................................................................................545
Adding Cool Stuff to Your Fedora Desktop .............................................................545
Summary ..........................................................................................................................546

xxi

73675ftoc.indd xxi

11/25/08 6:50:12 PM



Contents

Chapter 19: Running Debian GNU/Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . 547
Inside Debian GNU/Linux ...............................................................................................548
Debian Packages .....................................................................................................548
Debian Package Management Tools ........................................................................549
Debian Releases ...................................................................................................... 551
Getting Help with Debian ................................................................................................ 551
Installing Debian GNU/Linux .......................................................................................... 552
Hardware Requirements and Installation Planning ................................................ 552
Running the Installer .............................................................................................. 553
Managing Your Debian System ......................................................................................... 557
Configuring Network Connections .........................................................................558
Package Management Using APT ............................................................................ 561
Package Management Using dpkg ...........................................................................564
Installing Package Sets (Tasks) with tasksel............................................................567
Alternatives, Diversions, and Stat Overrides...........................................................567
Managing Package Configuration with debconf .....................................................569
Summary ..........................................................................................................................569

Chapter 20: Running SUSE and openSUSE Linux . . . . . . . . . . . . . . . . . . . . . 571
Understanding SUSE Linux Enterprise and openSUSE ....................................................572
What’s in SUSE Distributions ...........................................................................................573
Installation and Configuration with YaST............................................................... 574
RPM Package Management ..................................................................................... 576
Automated Software Updates..................................................................................577
Managing Software with zypper ............................................................................ 578
Getting Support for SUSE Linux Enterprise and openSUSE ............................................. 578
Installing openSUSE ......................................................................................................... 579
Before You Begin ..................................................................................................... 579

Starting Installation ................................................................................................580
Starting with openSUSE ...................................................................................................584
Summary ..........................................................................................................................584

Chapter 21: Running KNOPPIX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585
KNOPPIX Features ...........................................................................................................586
Understanding KNOPPIX .................................................................................................586
Looking Inside KNOPPIX .......................................................................................586
What’s Cool About KNOPPIX .................................................................................588
Examining Challenges with KNOPPIX ...................................................................589
Seeing Where KNOPPIX Comes From....................................................................590
Exploring Uses for KNOPPIX ................................................................................. 591
Starting KNOPPIX ............................................................................................................592
Getting a Computer ................................................................................................592
Booting KNOPPIX ..................................................................................................593
Correcting Boot Problems.......................................................................................593

xxii

73675ftoc.indd xxii

11/25/08 6:50:12 PM


Contents

Using KNOPPIX ...............................................................................................................598
Getting on the Network ..........................................................................................599
Installing Software in KNOPPIX.............................................................................600
Saving Files in KNOPPIX........................................................................................601

Keeping Your KNOPPIX Configuration ..................................................................603
Restarting KNOPPIX ..............................................................................................604
Summary ..........................................................................................................................605

Chapter 22: Running Yellow Dog Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607
Understanding Yellow Dog Linux .....................................................................................608
Going Forward with Yellow Dog ......................................................................................609
Digging into Yellow Dog ................................................................................................... 610
Installing Yellow Dog Linux ............................................................................................. 611
Hardware Support .................................................................................................. 612
Installing Yellow Dog Linux on a PowerStation ...................................................... 613
Updating Yellow Dog Linux ............................................................................................. 614
Running Mac Applications with Mac-on-Linux................................................................ 616
Support Options ............................................................................................................... 616
Summary .......................................................................................................................... 617

Chapter 23: Running Gentoo Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619
Understanding Gentoo ..................................................................................................... 619
Gentoo’s Open Source Spirit ...................................................................................620
The Gentoo Community ......................................................................................... 621
Building, Tuning, and Tweaking Linux .................................................................. 621
Where Gentoo Is Used ............................................................................................622
What’s in Gentoo ..............................................................................................................623
Managing Software with Portage ............................................................................ 624
Finding Software Packages ..................................................................................... 624
New Gentoo Features ............................................................................................625
Installing Gentoo..............................................................................................................626
Getting Gentoo .......................................................................................................626
Starting Gentoo Installation from a Live CD........................................................... 627
Starting Gentoo Installation from a Minimal CD.................................................... 629

Getting Software with emerge.................................................................................638
Summary ..........................................................................................................................639

Chapter 24: Running Slackware Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
Getting into Slackware ..................................................................................................... 641
Characterizing the Slackware Community .......................................................................643
The Slackware Creator ............................................................................................643
Slackware Users ......................................................................................................645
Slackware Internet Sites ..........................................................................................645
Challenges of Using Slackware .........................................................................................646
Using Slackware as a Development Platform ....................................................................646

xxiii

73675ftoc.indd xxiii

11/25/08 6:50:13 PM


×