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

Linux Biblen 2008 Edition Boot Up to Ubuntu, Fedora, KNOPPIX, Debian, openSUSE, and 11 Other Distributions phần 1 ppt

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 (2.88 MB, 90 trang )

Linux
®
Bible
2008 Edition
Boot Up to Ubuntu
®
, Fedora
®
, KNOPPIX,
Debian
®
, openSUSE
®
, and 11 Other Distributions
Christopher Negus
Wiley Publishing, Inc.
30190ffirs.qxd:Layout 1 12/20/07 5:08 PM Page iii
30190ffirs.qxd:Layout 1 12/20/07 5:08 PM Page ii
Linux
®
Bible
2008 Edition
30190ffirs.qxd:Layout 1 12/20/07 5:08 PM Page i
30190ffirs.qxd:Layout 1 12/20/07 5:08 PM Page ii
Linux
®
Bible
2008 Edition
Boot Up to Ubuntu
®


, Fedora
®
, KNOPPIX,
Debian
®
, openSUSE
®
, and 11 Other Distributions
Christopher Negus
Wiley Publishing, Inc.
30190ffirs.qxd:Layout 1 12/20/07 5:08 PM Page iii
Linux® Bible 2008 Edition: Boot Up to Ubuntu®, Fedora®, KNOPPIX,
Debian®, openSUSE®, and 11 Other Distributions
Published by
Wiley Publishing, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256
www.wiley.com
Copyright © 2008 by Wiley Publishing, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 978-0-470-23019-0
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 Website 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 Website may provide or recommendations it may make. Further, readers should be aware that Internet
Websites 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, 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. Fedora is a registered trademark of Red Hat, Inc. Debian is a registered trademark
of Software in the Public Interest, Inc. openSUSE is a registered trademark of Novell, Inc. Ubuntu is a registered trademark
of Canonical Limited Company. 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.
30190ffirs.qxd:Layout 1 12/20/07 5:08 PM Page iv
As always, I dedicate this book to my wife, Sheree.
30190ffirs.qxd:Layout 1 12/20/07 5:08 PM Page v
30190ffirs.qxd:Layout 1 12/20/07 5:08 PM Page vi
About the Authors
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. In late 2007, Chris co-authored three books for the new Linux Toolbox series
for power users: Fedora Linux Toolbox, SUSE Linux Toolbox, and Ubuntu Linux Toolbox. For eight
years, he worked with the organization at AT&T that developed UNIX before moving to Utah to

contribute to Novell’s short-lived UnixWare project in the early 1990s. When not writing about
Linux, Chris enjoys playing soccer and just hanging out with his family.
Emmett Dulaney is the author of several books on operating systems, networking, and certification.
An assistant professor at Anderson University, he is also a columnist for CertCities and a frequent
contributor to a number of other magazines.
30190ffirs.qxd:Layout 1 12/20/07 5:08 PM Page vii
Credits
Acquisitions Editor
Jenny Watson
Development Editor
Sara Shlaer
Technical Editor
Emmett Dulaney
Copy Editor
Nancy Rapoport
Editorial Manager
Mary Beth Wakefield
Production Manager
Tim Tate
Vice President and
Executive Group Publisher
Richard Swadley
Vice President and Executive Publisher
Joseph B. Wikert
Project Coordinator, Cover
Lynsey Stanford
Media Associate Project Manager
Laura Atkinson
Media Assistant Producer
Josh Frank

Media Quality Control
Kit Malone
Compositor
Kate Kaminski, Happenstance Type-O-Rama
Proofreader
Kathryn Duggan
Indexer
Johnna VanHoose Dinse
30190ffirs.qxd:Layout 1 12/20/07 5:08 PM Page viii
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!
For Linux Bible 2008 Edition, Emmett Dulaney did most of the heavy lifting. Emmett’s thorough
technical edit of the entire book and updates to several critical sections made it possible for us to
bring the book to market on schedule.
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. Jaldhar Vyas updated
the Linspire chapter.
Thanks to the folks at Wiley for helping me press through the project. Jenny Watson did a wonder-
ful job putting together the personnel needed to complete this book, in the face of my having five
books scheduled to complete within a two-month period. Sara Shlaer did her usual great job keep-
ing the project moving under a very challenging schedule. 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.
ix
30190ffirs.qxd:Layout 1 12/20/07 5:08 PM Page ix

Introduction xxxiii
Part I: Linux First Steps
Chapter 1: Starting with Linux 3
Chapter 2: Running Commands from the Shell 35
Chapter 3: Getting into the Desktop 81
Part II: Running the Show
Chapter 4: Learning Basic Administration 131
Chapter 5: Getting on the Internet 179
Chapter 6: Securing Linux 203
Part III: Choosing and Installing a Linux Distribution
Chapter 7: Installing Linux 253
Chapter 8: Running Fedora and Red Hat Enterprise Linux 283
Chapter 9: Running Debian GNU/Linux 303
Chapter 10: Running SUSE and openSUSE Linux 327
Chapter 11: Running KNOPPIX 343
Chapter 12: Running Yellow Dog Linux 365
Chapter 13: Running Gentoo Linux 383
Chapter 14: Running Slackware Linux 403
Chapter 15: Running Linspire and Freespire 419
Chapter 16: Running Mandriva 435
Chapter 17: Running Ubuntu Linux 449
Chapter 18: Running a Linux Firewall/Router 467
Chapter 19: Running Bootable Linux Distributions 493
Part IV: Running Applications
Chapter 20: Playing Music and Video 513
Chapter 21: Working with Words and Images 549
Chapter 22: E-Mailing and Web Browsing 589
Chapter 23: Gaming with Linux 623
x
30190ffirs.qxd:Layout 1 12/20/07 5:08 PM Page x

Part V: Running Servers
Chapter 24: Running a Linux, Apache, MySQL, and PHP (LAMP) Server 649
Chapter 25: Running a Mail Server 671
Chapter 26: Running a Print Server 689
Chapter 27: Running a File Server 713
Part VI: Programming in Linux
Chapter 28: Programming Environments and Interfaces 749
Chapter 29: Programming Tools and Utilities 779
Appendix A: Media 809
Appendix B: Entering the Linux Community 819
Index 825
30190ffirs.qxd:Layout 1 12/20/07 5:51 PM Page xi
30190ffirs.qxd:Layout 1 12/20/07 5:08 PM Page xii
xiii
Introduction xxxiii
Part I: Linux First Steps
Chapter 1: Starting with Linux 3
Taking Your First Step 4
Starting Right Now 6
Understanding Linux 6
Exploring Linux History 8
From a Free-Flowing UNIX Culture at Bell Labs 9
To a Commercialized UNIX 11
BSD Arrives 11
UNIX Laboratory and Commercialization 11
To a GNU Free-Flowing (not) UNIX 13
BSD Loses Some Steam 14
Linus Builds the Missing Piece 14
What’s So Great About Linux? 15
Features in Linux 16

OSI Open Source Definition 17
Vibrant Communities 18
Major Software Projects 19
Linux in the Real World 20
Linux in Schools 20
Linux in Small Business 21
Linux in the Enterprise 22
Linux Myths, Legends, and FUD 23
Can You Stop Worrying About Viruses? 23
Will You Be Sued for Using Linux? 24
Microsoft Versus Linux 24
The SCO Lawsuits 25
Software Patents 26
Other Potentially Litigious Issues 27
Can Linux Really Run on Everything from Handhelds to Supercomputers? 27
Will Microsoft Crush Linux? 27
Are You on Your Own If You Use Linux? 29
Is Linux Only for Geeks? 29
30190ftoc.qxd:Layout 1 12/20/07 5:10 PM Page xiii
xiv
Contents
How Do Companies Make Money with Linux? 29
How Different Are Linux Distributions from One Another? 30
Is the Linux Mascot Really a Penguin? 31
Getting Started with Linux 32
Summary 33
Chapter 2: Running Commands from the Shell 35
Starting a Shell 36
Using the Shell Prompt 36
Using a Terminal Window 37

Using Virtual Terminals 38
Choosing Your Shell 38
Using bash (and Earlier sh) Shells 39
Using tcsh (and Earlier csh) Shells 39
Using ash 40
Using ksh 40
Using zsh 40
Exploring the Shell 40
Checking Your Login Session 41
Checking Directories and Permissions 41
Checking System Activity 43
Exiting the Shell 44
Using the Shell in Linux 45
Locating Commands 46
Rerunning Commands 48
Command-Line Editing 49
Command-Line Completion 51
Command-Line Recall 52
Connecting and Expanding Commands 54
Piping Commands 54
Sequential Commands 54
Background Commands 55
Expanding Commands 55
Expanding Arithmetic Expressions 56
Expanding Environment Variables 56
Creating Your Shell Environment 56
Configuring Your Shell 56
Setting Your Prompt 57
Adding Environment Variables 59
Adding Aliases 60

Using Shell Environment Variables 60
Common Shell Environment Variables 60
Setting Your Own Environment Variables 62
30190ftoc.qxd:Layout 1 12/20/07 5:10 PM Page xiv
Managing Background and Foreground Processes 63
Starting Background Processes 64
Using Foreground and Background Commands 64
Working with the Linux File System 65
Creating Files and Directories 68
Using Metacharacters and Operators 69
Using File-Matching Metacharacters 70
Using File-Redirection Metacharacters 71
Understanding File Permissions 71
Moving, Copying, and Deleting Files 74
Using the vi Text Editor 74
Starting with vi 76
Moving Around the File 78
Searching for Text 78
Using Numbers with Commands 79
Summary 79
Chapter 3: Getting into the Desktop 81
Understanding Your Desktop 81
Starting the Desktop 82
Boot to the Desktop 82
Boot to a Graphical Login 83
Boot to a Text Prompt 85
K Desktop Environment 85
Using the KDE Desktop 86
Managing Files with the Konqueror File Manager 90
Working with Files 91

Searching for Files 92
Creating New Files and Folders 93
Using Other Browser Features 95
Configuring Konqueror Options 95
Managing Windows 97
Using the Taskbar 97
Uncluttering the Desktop 99
Moving Windows 99
Resizing Windows 99
Pinning Windows on the Top or Bottom 99
Using Virtual Desktops 100
Configuring the Desktop 100
Changing the Display 101
Changing Panel Attributes 102
Adding Application Launchers and MIME Types 102
Adding Applications to the Panel 103
Adding Applications to the Desktop 103
xv
Contents
30190ftoc.qxd:Layout 1 12/20/07 5:10 PM Page xv
The GNOME Desktop 103
Using the Metacity Window Manager 105
Using the GNOME Panels 107
Using the Applications, Places, and System Menus 108
Adding an Applet 109
Adding Another Panel 109
Adding an Application Launcher 110
Adding a Drawer 111
Changing Panel Properties 111
Using the Nautilus File Manager 112

3D Effects with AIGLX 114
Changing GNOME Preferences 116
Exiting GNOME 117
Configuring a GNOME Online Desktop 118
Configuring Your Own Desktop 120
Configuring X 120
Creating a Working X Configuration File 121
Getting New X Drivers 122
Tuning Up Your X Configuration File 122
Choosing a Window Manager 124
Choosing Your Personal Window Manager 126
Getting More Information 126
Summary 127
Part II: Running the Show
Chapter 4: Learning Basic Administration 131
Graphical Administration Tools 132
Using Web-Based Administration 132
Open Source Projects Offering Web Administration 132
The Webmin Administration Tool 133
Graphical Administration with Different Distributions 133
Red Hat Config Tools 134
SUSE YaST Tools 136
Using the root Login 137
Becoming Root from the Shell (su Command) 138
Allowing Limited Administrative Access 139
Exploring Administrative Commands, Configuration Files, and Log Files 140
Administrative Commands 140
Administrative Configuration Files 141
Administrative Log Files 145
Using sudo and Other Administrative Logins 146

Administering Your Linux System 148
xvi
Contents
30190ftoc.qxd:Layout 1 12/20/07 5:10 PM Page xvi
Creating User Accounts 149
Adding Users with useradd 149
Setting User Defaults 152
Modifying Users with usermod 154
Deleting Users with userdel 155
Configuring Hardware 155
Managing Removable Hardware 156
Removable Media on a GNOME Desktop 157
Removable Media on a SUSE KDE Desktop 159
Working with Loadable Modules 160
Listing Loaded Modules 160
Loading Modules 161
Removing Modules 162
Managing File Systems and Disk Space 162
Mounting File Systems 165
Supported File Systems 165
Using the fstab File to Define Mountable File Systems 167
Using the mount Command to Mount File Systems 169
Using the umount Command 171
Using the mkfs Command to Create a File System 172
Adding a Hard Disk 173
Checking System Space 175
Displaying System Space with df 175
Checking Disk Usage with du 176
Finding Disk Consumption with find 176
Monitoring System Performance 177

Summary 178
Chapter 5: Getting on the Internet 179
Connecting to the Network 180
Connecting via Dial-Up Service 180
Connecting a Single Computer to Broadband 181
Connecting Multiple Computers to Broadband 182
Connecting Servers 184
Connecting Other Equipment 185
Using Ethernet Connections to the Internet 186
Configuring Ethernet During Installation 186
Configuring Ethernet from the Desktop 187
Using Network Configuration GUI in Fedora 188
Identifying Other Computers (Hosts and DNS) 190
Using the Network Settings GUI in Ubuntu 191
Understanding Your Internet Connection 193
Using Dial-Up Connections to the Internet 195
Getting Information 195
Setting Up Dial-Up PPP 196
xvii
Contents
30190ftoc.qxd:Layout 1 12/20/07 5:10 PM Page xvii
Creating a Dial-Up Connection with the Internet Configuration Wizard 197
Launching Your PPP Connection 199
Launching Your PPP Connection on Demand 199
Checking Your PPP Connection 200
Checking That Your Modem Was Detected 200
Connecting to the Internet with Wireless 201
Summary 202
Chapter 6: Securing Linux 203
Linux Security Checklist 204

Finding Distribution-Specific Security Resources 207
Finding General Security Resources 208
Using Linux Securely 209
Using Password Protection 209
Choosing Good Passwords 210
Using a Shadow Password File 211
Breaking Encrypted Passwords 212
Checking for the Shadow Password File 212
Using Log Files 213
The Role of syslogd 216
Redirecting Logs to a Loghost with syslogd 216
Understanding the messages Log File 217
Using Secure Shell Tools 218
Starting the ssh Service 218
Using the ssh, sftp, and scp Commands 219
Using ssh, scp, and sftp Without Passwords 220
Securing Linux Servers 222
Controlling Access to Services with TCP Wrappers 222
Understanding Attack Techniques 225
Protecting Against Denial of Service Attacks 226
Mailbombing 226
Spam Relaying 228
Smurf Amplification Attack 228
Protecting Against Distributed DOS Attacks 229
Protecting Against Intrusion Attacks 233
Evaluating Access to Network Services 233
Disabling Network Services 235
Securing Servers with SELinux 236
Protecting Web Servers with Certificates and Encryption 237
Symmetric Cryptography 237

Asymmetric Cryptography 238
Secure Sockets Layer 238
Using Linux Live CD Security Tools 247
Advantages of Security Live CDs 247
Using INSERT to Check for rootkits 247
Summary 248
xviii
Contents
30190ftoc.qxd:Layout 1 12/20/07 5:10 PM Page xviii
Part III: Choosing and Installing a Linux Distribution
Chapter 7: Installing Linux 253
Choosing a Linux Distribution 254
Linux at Work 254
Other Distributions 255
Getting Your Own Linux Distribution 255
Finding Another Linux Distribution 256
Understanding What You Need 256
Downloading the Distribution 257
Burning the Distribution to CD 258
Exploring Common Installation Topics 259
Knowing Your Computer Hardware 259
Upgrading or Installing from Scratch 261
Dual Booting with Windows or Just Linux? 261
Using Installation Boot Options 263
Partitioning Hard Drives 263
Partitioning with Disk Druid During Installation 264
Partitioning with fdisk 267
Tips for Creating Partitions 269
Using LILO or GRUB Boot Loaders 271
Booting Your Computer with GRUB 271

Booting with GRUB 272
Temporarily Changing Boot Options 272
Permanently Changing Boot Options 273
Adding a New GRUB Boot Image 275
Booting Your Computer with LILO 275
Changing Your Boot Loader 279
Configuring Networking 280
Configuring Other Administrative Features 281
Installing from the Linux Bible CD or DVD 281
Summary 282
Chapter 8: Running Fedora and Red Hat Enterprise Linux 283
Digging into Features 285
Red Hat Installer (Anaconda) 285
RPM Package Management 286
Kudzu Hardware Detection 286
Red Hat Desktop Look-and-Feel 287
System Configuration Tools 288
Going Forward with Fedora 288
Growing Community Support for Fedora 288
Forums and Mailing Lists 289
xix
Contents
30190ftoc.qxd:Layout 1 12/20/07 5:10 PM Page xix
Fedora Comes of Age 289
Installing Fedora 291
Choosing Computer Hardware 291
Choosing an Installation Method 292
Installing on Multiple Computers 293
Installation Guides 293
Choosing to Install or Upgrade 293

Beginning the Installation 294
Running the Fedora Setup Agent 301
Summary 302
Chapter 9: Running Debian GNU/Linux 303
Inside Debian GNU/Linux 304
Debian Packages 304
Debian Package Management Tools 305
Debian Releases 307
Getting Help with Debian 307
Installing Debian GNU/Linux 308
Hardware Requirements and Installation Planning 308
Workstations 309
Servers 309
Running the Installer 309
Managing Your Debian System 314
Configuring Network Connections 314
IP Networks: Ethernet and Wireless 315
Dial-Up PPP Connections 316
PPPoE Connections 317
Package Management Using APT 317
Managing the List of Package Repositories 318
Updating the APT Package Database 318
Finding and Installing Packages 319
Removing Packages 320
Upgrading Your System 320
Package Management Using dpkg 321
Installing and Removing Packages 321
Querying the Package Database 321
Examining a Package File 322
Installing Package Sets (Tasks) with Tasksel 323

Alternatives, Diversions, and Stat Overrides 323
Managing Package Configuration with debconf 325
Summary 325
xx
Contents
30190ftoc.qxd:Layout 1 12/20/07 5:10 PM Page xx
Chapter 10: Running SUSE and openSUSE Linux 327
Understanding SUSE and openSUSE 328
What’s in SUSE 329
Installation and Configuration with YaST 330
RPM Package Management 332
Automated Software Updates 334
Managing Software with zypper 334
Getting Support for SUSE and openSUSE 334
Installing openSUSE 335
Before You Begin 335
Starting Installation 336
Installation Settings 337
Configuration Settings 339
Starting with openSUSE 341
Summary 341
Chapter 11: Running KNOPPIX 343
KNOPPIX Features 343
Understanding KNOPPIX 344
KNOPPIX News 344
Looking Inside KNOPPIX 344
What’s Cool About KNOPPIX 346
Examining Challenges with KNOPPIX 347
Seeing Where KNOPPIX Comes From 348
Exploring Uses for KNOPPIX 349

Starting KNOPPIX 350
Getting a Computer 350
Booting KNOPPIX 351
Correcting Boot Problems 351
Customizing KNOPPIX 354
Special Features and Workarounds 355
Using KNOPPIX 356
Getting on the Network 357
Installing Software in KNOPPIX 358
Saving Files in KNOPPIX 359
Writing to Hard Disk 359
Creating a Persistent Home Directory 360
Keeping Your KNOPPIX Configuration 361
Restarting KNOPPIX 362
Summary 363
xxi
Contents
30190ftoc.qxd:Layout 1 12/20/07 5:10 PM Page xxi
Chapter 12: Running Yellow Dog Linux 365
Understanding Yellow Dog Linux 365
Going Forward with Yellow Dog 367
Digging into Yellow Dog 368
Installing Yellow Dog Linux 369
Hardware Support 370
Planning Your Installation 371
Installing Mac OS X and Yellow Dog Linux on One Hard Drive 372
Installing Mac OS 9 or Earlier and Yellow Dog Linux on One Hard Drive 372
Installing Mac OS 9 or Earlier, Mac OS X, and Yellow Dog Linux
on Multiple Hard Drives 373
Yellow Dog Linux 3.0.1 Special Considerations 373

Beginning the Installation 373
Rebooting Your Linux Mac 379
Updating Yellow Dog Linux 379
Running Mac Applications with Mac-on-Linux 381
Support Options 381
Summary 382
Chapter 13: Running Gentoo Linux 383
Understanding Gentoo 383
Gentoo’s Open Source Spirit 384
The Gentoo Community 385
Building, Tuning, and Tweaking Linux 385
Where Gentoo Is Used 386
What’s in Gentoo 387
Managing Software with Portage 388
Finding Software Packages 388
New Gentoo Features 389
Installing Gentoo 389
Getting Gentoo 389
Live CD Install 390
Minimal/Universal Install CD 390
Starting Gentoo Installation from a Live CD 391
Starting Gentoo Installation from a Minimal CD 393
Getting Software with emerge 401
Summary 402
Chapter 14: Running Slackware Linux 403
Getting into Slackware 403
Characterizing the Slackware Community 405
The Slackware Creator 405
xxii
Contents

30190ftoc.qxd:Layout 1 12/20/07 5:10 PM Page xxii

×