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

RUNNING LINUX doc

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 (15.27 MB, 974 trang )

www.it-ebooks.info
www.it-ebooks.info
RUNNING
LINUX
www.it-ebooks.info
Other Linux resources from O’Reilly
Related titles
Linux Cookbook™
Linux Desktop Hacks™
Linux Desktop Pocket Guide
Linux in a Nutshell
Linux in a Windows World
Linux Multimedia Hacks™
Linux Network
Administrator’s Guide
Linux Pocket Guide
Linux Server Hacks™
Linux Server Security
LPI Linux Certification
in a Nutshell
OpenOffice.org Writer
SELinux
Version Control with
Subversion
Linux Books
Resource Center
linux.oreilly.com is a complete catalog of O’Reilly’s books on
Linux and Unix and related technologies, including sample
chapters and code examples.
ONLamp.com is the premier site for the open source web plat-
form: Linux, Apache, MySQL, and either Perl, Python, or PHP.


Conferences
O’Reilly brings diverse innovators together to nurture the ideas
that spark revolutionary industries. We specialize in document-
ing the latest tools and systems, translating the innovator’s
knowledge into useful skills for those in the trenches. Visit con-
ferences.oreilly.com for our upcoming events.
Safari Bookshelf (safari.oreilly.com) is the premier online refer-
ence library for programmers and IT professionals. Conduct
searches across more than 1,000 books. Subscribers can zero in
on answers to time-critical questions in a matter of seconds.
Read the books on your Bookshelf from cover to cover or sim-
ply flip to the page you need. Try it today for free.
www.it-ebooks.info
RUNNING
LINUX
FIFTH EDITION
Matthias Kalle Dalheimer
and Matt Welsh
Beijing

Cambridge

Farnham

Köln

Paris

Sebastopol


Taipei

Tokyo
www.it-ebooks.info
Running Linux, Fifth Edition
by Matthias Kalle Dalheimer and Matt Welsh
Copyright © 2006, 2002, 1999, 1996, 1995 O’Reilly Media, Inc. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions
are also available for most titles (safari.oreilly.com). For more information, contact our corporate/insti-
tutional sales department: (800) 998-9938 or
Editor:
Andy Oram
Production Editor:
Adam Witwer
Production Services:
Argosy Publishing
Cover Designer:
Edie Freedman
Interior Designer:
David Futato
Printing History:
May 1995: First Edition.
August 1996: Second Edition.
August 1999: Third Edition.
December 2002: Fourth Edition.
December 2005: Fifth Edition.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc. The Linux series designations, Running Linux, images of the American West, and

related trade dress are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a
trademark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and authors
assume no responsibility for errors or omissions, or for damages resulting from the use of the
information contained herein.
ISBN-10: 0-596-00760-4
ISBN-13: 978-0-596-00760-7
[M] [10/06]
www.it-ebooks.info
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
v
Table of Contents
Preface
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xi
Part I. Enjoying and Being Productive on Linux
1. Introduction to Linux
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3
About This Book 5
Who’s Using Linux? 6
System Features 8
About Linux’s Copyright 22
Open Source and the Philosophy of Linux 25
Sources of Linux Information 30
Getting Help 32
2. Preinstallation and Installation

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
Distributions of Linux 34
Preparing to Install Linux 37
Post-Installation Procedures 49
Running into Trouble 53
3. Desktop Environments
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
67
Why Use a Graphical Desktop? 67
The K Desktop Environment 68
KDE Applications 79
The GNOME Desktop Environment 88
GNOME Applications 94
www.it-ebooks.info
vi | Table of Contents
4. Basic Unix Commands and Concepts
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
102
Logging In 103
Setting a Password 104
Virtual Consoles 105
Popular Commands 105
Shells 110
Useful Keys and How to Get Them to Work 111
Typing Shortcuts 112
Filename Expansion 114
Saving Your Output 116
What Is a Command? 119
Putting a Command in the Background 120

Remote Logins and Command Execution 121
Manual Pages 123
Startup Files 125
Important Directories 127
Basic Text Editing 128
Advanced Shells and Shell Scripting 129
5. Web Browsers and Instant Messaging
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
135
The World Wide Web 135
Instant Messaging 142
6. Electronic Mail Clients
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
149
Using KMail 150
Using Mozilla Mail & News 156
Getting the Mail to Your Computer with fetchmail 157
OpenPGP Encryption with GnuPG 159
7. Games
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
167
Gaming 167
Quake III 168
Return to Castle Wolfenstein 173
Unreal Tournament 2004 177
Emulators 182
Frozen Bubble 188
Tux Racer 190
www.it-ebooks.info
Table of Contents | vii

8. Office Suites and Personal Productivity
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
194
Using OpenOffice 194
KOffice 240
Other Word Processors 248
Synching PDAs 250
Groupware 254
Managing Your Finances 260
9. Multimedia
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
277
Multimedia Concepts 278
Kernel and Driver Issues 283
Embedded and Other Multimedia Devices 290
Desktop Environments 290
Windows Compatibility 292
Multimedia Applications 292
Multimedia Toolkits and Development Environments 328
Solutions to Common Problems 330
References 332
Part II. System Administration
10. System Administration Basics
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
335
Maintaining the System 336
Managing Filesystems 340
Managing Swap Space 359
The /proc Filesystem 363
Device Files 366

Scheduling Recurring Jobs Using cron 369
Executing Jobs Once 374
Managing System Logs 375
Processes 378
Programs That Serve You 382
11. Managing Users, Groups, and Permissions
. . . . . . . . . . . . . . . . . . . . . . . . . . .
384
Managing User Accounts 384
File Ownership and Permissions 394
Changing the Owner, Group, and Permissions 397
www.it-ebooks.info
viii | Table of Contents
12. Installing, Updating, and Compiling Programs
. . . . . . . . . . . . . . . . . . . . . . .
401
Upgrading Software 401
General Upgrade Procedure 403
Automated and Bulk Upgrades 413
Upgrading Software Not Provided in Packages 420
Archive and Compression Utilities 429
13. Networking
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
440
Networking with TCP/IP 440
Dial-Up PPP 460
PPP over ISDN 468
ADSL 477
Cable Modems 478
Network Diagnostics Tools 479

14. Printing
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
484
Printing 484
Managing Print Services 492
15. File Sharing
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
522
Sharing Files with Windows Systems (Samba) 523
NFS and NIS Configuration 562
16. The X Window System
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
571
A History of X 571
X Concepts 572
Hardware Requirements 573
Installing X.org 575
Configuring X.org 576
Running X 584
Running into Trouble 584
X and 3D 586
17. System Start and Shutdown
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
590
Booting the System 590
System Startup and Initialization 598
Single-User Mode 604
Shutting Down the System 605
A Graphical Runlevel Editor: KSysV 606
www.it-ebooks.info

Table of Contents | ix
18. Configuring and Building the Kernel
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
608
Building a New Kernel 609
Loadable Device Drivers 621
Loading Modules Automatically 626
19. Text Editing
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
627
Editing Files Using vi 627
The (X)Emacs Editor 638
20. Text Processing
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
657
TeX and LaTeX 658
XML and DocBook 663
groff 668
Texinfo 672
Part III. Programming
21. Programming Tools
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
681
Programming with gcc 682
Makefiles 693
Debugging with gdb 704
Useful Utilities for C Programmers 721
Using Perl 743
Java 751
Python 754

Other Languages 760
Introduction to OpenGL Programming 762
Integrated Development Environments 766
22. Running a Web Server
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
768
Configuring Your Own Web Server 768
23. Transporting and Handling Email Messages
. . . . . . . . . . . . . . . . . . . . . . . . . .
776
The Postfix MTA 778
Procmail 787
Filtering Spam 794
www.it-ebooks.info
x | Table of Contents
24. Running an FTP Server
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
797
Introduction 797
Compiling and Installing 797
Running ProFTPD 800
Configuration 800
Part IV. Network Services
25. Running Web Applications with MySQL and PHP
. . . . . . . . . . . . . . . . . . . . . .
809
MySQL 811
PHP 819
The LAMP Server in Action 824
26. Running a Secure System

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
828
A Perspective on System Security 828
Initial Steps in Setting Up a Secure System 830
TCP Wrapper Configuration 834
Firewalls: Filtering IP Packets 837
SELinux 849
27. Backup and Recovery
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
850
Making Backups 850
What to Do in an Emergency 859
28. Heterogeneous Networking and Running Windows Programs
. . . . . . . . . .
865
Sharing Partitions 867
Emulation and Virtual Operating Systems 871
Remote Desktop Access to Windows Programs 887
FreeNX: Linux as a Remote Desktop Server 902
Appendix: Sources of Linux Information
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
907
Index
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
913
www.it-ebooks.info
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
xi
Preface

Technical knowledge is not enough. One must
transcend techniques so that the art becomes an artless
art, growing out of the unconscious.
—Daisetsu Suzuki (1870–1966)
This is a book about Linux, a free, open source operating system that’s changing the
world of computing. In this book, we show how you can completely change the way
you work with computers by exploring a powerful and free operating system. Linux
goes against the traditional computing mainstream, being developed by a loosely
organized group of thousands of volunteers across the Internet. Linux started as a
real underground movement—guerrilla hacking, if you will—and brings a lot of
excitement, discovery, and self-empowerment back into today’s corporate-
dominated computing culture. We invite you to dive in, enjoy yourself, and join the
throng of people who know what it means to tweak your dot clocks and rdev your
kernel image.
The Zen quote at the beginning of this preface summarizes our philosophy in this
book. We’re targeting readers who are inquisitive and creative enough to delve full-
tilt into the world of Linux, and who want to get at the heart of the system. Linux
represents a rebellion against commercial and proprietary operating systems, and
many of its users like living on the edge of the latest technological trends. Of course,
the casual reader can set up and run a Linux system (or hundreds of them!) without
much trouble, but the purpose of this book is to dig more deeply into the system—
to bring you completely into the Linux mentality, to reach Linux “enlightenment.”
Rather than gloss over messy details, we explain the concepts by which the system
actually works so that you can troubleshoot problems on your own. By sharing the
accumulated expertise of several Linux experts, we hope to give you enough confi-
dence to call yourself a true Linux Guru. (Your first koan: what is the sound of one
user hacking?)
You have in your hands the fifth edition of Running Linux, and by most accounts this
book is considered the classic text on installing, maintaining, and learning to use a
www.it-ebooks.info

This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
xii
|
Preface
Linux system. The first edition was published way back in 1996, and had its roots in
a free book called Linux Installation and Getting Started, which was written by Matt
Welsh and is still floating around the Internet. Since Matt conceived and wrote Run-
ning Linux, the book has gone through a lot of expansion and improvement to keep
up-to-date with the latest developments in the Linux world.
Kalle Dalheimer, a developer and consultant bringing a great deal of experience with
both Linux development and desktop applications, has become the lead author on
the past three editions. Other contributors over time have included Lar Kaufman
(material on printing and other first-edition material), Tom Adelstein (updates to the
introductory chapter and substantial material on VMWare, rdesktop, VNC, and
FreeNX), Aaron Weber (GNOME, Evolution, Red Carpet, and ZENworks), Sam
Hiser (OpenOffice), Jay Ts (Samba), John H. Terpstra (updates to Samba and NFS),
Jeff Tranter (multimedia, sources of Linux information), Kyle Rankin (games),
Breckin Loggins (GnuCash), Rod Smith (substantial printing material, including
CUPS), Kyle Dent (Postfix), Terry Dawson (material on security), Brian Vincent
(Wine and CodeWeaver), Chris Lawrence (Debian packaging), Vatafu Valerica
(LAMP chapter), Marc Mutz (material on public-key encryption and encypted file-
systems), Steffen Hansen (material on the GIMP, OpenGL, Postfix, and ProFTPd),
Till Adam (material on groupware solutions for Linux), Jesper Pedersen (material on
kimdaba and Procmail, updates to the Python section), Michel Boyer de la Giroday
(PHP), Ivan Ristic (updates to Apache and LAMP chapters), and Jeffrey Dunitz
(updates to the backup chapter).
As Linux attracts more and more development, becoming increasingly appealing in
new areas of use, the challenge for a book like this is to continue its mission with an
ever-increasing scope. This edition is much bigger than any of the previous ones, and

covers topics such as desktop tools that made only cursory appearances earlier. No
book can adequately capture everything there is to know about Linux, so we’ve tried
to ask at each turn what information is most valuable for a person exploring the sys-
tem and trying to get a firm basis for further self-education. Our approach has
worked remarkably well over the many editions, and we think this book will be of
use to you for a long time to come.
In the preface to the first edition, we said that “Linux has the potential to completely
change the face of the PC operating system world.” Looking back, it’s clear that our
prediction was right! Linux has erupted into the computing mainstream with an
amazing force: it has been covered by every major media channel, has helped usher
in the so-called Open Source Revolution, and is widely claimed as the most viable
competitor to Microsoft’s dominance in the operating systems market. Today, most
estimates place the number of Linux users worldwide at well over 300 million. Linux
has matured to the point where many people can dive in and start using Linux with-
out knowing most of the hairy details behind device drivers, XFree86 configuration
files, and bootloaders. Actually, a good Linux distribution these days is just as easy
to install as its commercial competitors such as Microsoft Windows. Still, we think
www.it-ebooks.info
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Preface
|
xiii
it’s best to give you some of the behind-the-scenes views, so you have an understand-
ing of the workings of the system, even if it’s not strictly necessary for casual Linux
use.
Organization of This Book
Each chapter of this book contains a big chunk of information. It takes you into a
world of material that could easily take up several books. But we move quickly
through the topics you need to know.

Part I of the book, “Enjoying and Being Productive on Linux,” introduces Linux and
brings you to the point where you can do all the standard activities people do on
other systems: emailing, web surfing, playing games, watching videos, and so on.
Chapter 1, Introduction to Linux
Tries to draw together many different threads. It explains why Linux came to be
and what it offers that continues to attract new users and developers.
Chapter 2, Preinstallation and Installation
Describes preliminary tasks that you may have to do before installation, such as
partitioning your disk, and guidance for initial Linux installation and configuration.
Chapter 3, Desktop Environments
Helps you get comfortable navigating the desktop and the most important tools,
including the Evolution utility for mail, calendar, and managing contacts.
Chapter 4, Basic Unix Commands and Concepts
Offers a system administrator’s introduction to Unix. It is intended to give you
enough tools to perform the basic tasks you’ll need to do throughout the book.
Basic commands are covered, along with some tips for administrators and some
concepts you should know.
Chapter 5, Web Browsers and Instant Messaging
Shows neat tricks and advanced uses for some of the popular and basic com-
puter activities: web browsing and instant messaging.
Chapter 6, Electronic Mail Clients
Introduces other mail clients, for people who want to try something besides Evo-
lution, and shows ways to secure email.
Chapter 7, Games
Explains the impressive array of games supported on Linux, both standalone and
client/server.
Chapter 8, Office Suites and Personal Productivity
Explains how you can be just as productive in your office work on Linux as on
the proprietary alternatives. The main topics are the OpenOffice office suite,
KOffice office suite, and the GnuCash financial application, along with an intro-

duction to groupware.
www.it-ebooks.info
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
xiv
|
Preface
Chapter 9, Multimedia
Discusses audio and video, covering concepts you’ll find useful, configuration
for systems where the tools don’t work automatically, and a few common appli-
cations. The GIMP is also introduced for image manipulation.
Part II of the book, “System Administration,” shows you how to set up your Linux
system and its environment for such tasks as printing and sharing files with other
systems; it also shows you how to take care of your system in other ways.
Chapter 10, System Administration Basics
Covers system administration topics such as filesystems and swap space that are
normally handled automatically during installation, but sometimes need user
intervention.
Chapter 11, Managing Users, Groups, and Permissions
Shows you the fundamental building blocks of security on Linux: managing
users and access rights (permissions).
Chapter 12, Installing, Updating, and Compiling Programs
Covers system updates, which are important both to get new features and appli-
cations and to fix security flaws.
Chapter 13, Networking
Is a basic introduction to networking, which is usually set up during installation
but is worth understanding at a deeper level. The chapter shows you how to
configure your system so that it can work on a local area network or communi-
cate with an Internet service provider using Point-to-Point Protocol (PPP). ISDN
and ADSL are also covered.

Chapter 14, Printing
Shows you how to get Linux to recognize printers and to manage document
printing.
Chapter 15, File Sharing
Covers file sharing, with a particular focus on Samba, which allows both file and
printer sharing with Windows systems.
Chapter 16, The X Window System
Shows you how to configure the X Window System, which underlies the desk-
tops introduced in Chapter 3. We show you how to overcome problems you
might encounter when your distribution installs the software and how to config-
ure it for the best performance on your video hardware.
Chapter 17, System Start and Shutdown
Covers system startup and shutdown. Topics include the GRUB bootloader,
which lets you choose between operating systems at startup time, and how to get
the right services going.
www.it-ebooks.info
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Preface
|
xv
Chapter 18, Configuring and Building the Kernel
Explains how to update the kernel and its modules, which may be necessary to
run new Linux features or get drivers installed for your hardware.
Part III of the book, “Programming,” starts exploring interesting advanced topics
that make Linux a powerful asset, such as programming.
Chapter 19, Text Editing
Offers in-depth tutorials on vi and Emacs, valuable text editors. Covers text pro-
cessing, an alternative to using word processors to format text documents.
Chapter 20, Text Processing

Describes tools for producing formatted documents from markup languages,
including XML and the older languages T
E
X, troff, and Texinfo.
Chapter 21, Programming Tools
Is a wide-ranging introduction to programming on Linux, introducing a number
of languages, as well as tools that you may find it useful to understand even if
you are not a programmer.
Part IV of the book, “Network Services,” introduces several services and other
advanced networking activities.
Chapter 22, Running a Web Server
Shows you how to set up and configure Apache, the most popular web server in
the world.
Chapter 23, Transporting and Handling Email Messages
Covers the easy-to-use Postfix mail server and some other useful mail tools, such
as SpamAssassin.
Chapter 24, Running an FTP Server
Shows a secure way to offer files for download.
Chapter 25, Running Web Applications with MySQL and PHP
Covers the M and P in the well-known acronym LAMP, introducing the basic
configuration and use of MySQL and PHP for use with Apache.
Chapter 26, Running a Secure System
Covers the ProFTPD web server, which is convenient for serving documents to
colleagues or the general public.
Chapter 27, Backup and Recovery
Basic techniques for the critical task of safeguarding your data.
Chapter 28, Heterogeneous Networking and Running Windows Programs
A wealth of ways to get the best out of two diffferent environments.
Appendix, Sources of Linux Information
Tells you about useful online documentation for Linux and other sources of

help.
www.it-ebooks.info
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
xvi
|
Preface
Conventions Used in This Book
The following is a list of the typographical conventions used in this book:
Italic
Is used for file and directory names, command names, command-line options,
email addresses and pathnames, usernames, hostnames, site names, and all new
terms.
Constant Width
Is used in examples to show the contents of files or the output from commands,
to indicate environment variables and keywords that appear in code, and for
Emacs commands.
Constant Width Bold
Is used in examples to show commands or other text that should be typed liter-
ally by the user.
Constant Width Italic
Is used to indicate variable options, keywords, or text that the user is to replace
with an actual value.
This icon designates a note, which is an important aside to the nearby
text.
This icon designates a warning relating to the nearby text.
Using Code Examples
This book is here to help you get your job done. In general, you may use the code in
this book in your programs and documentation. You do not need to contact us for
permission unless you’re reproducing a significant portion of the code. For example,

writing a program that uses several chunks of code from this book does not require
permission. Selling or distributing a CD-ROM of examples from O’Reilly books does
require permission. Answering a question by citing this book and quoting example
code does not require permission. Incorporating a significant amount of example
code from this book into your product’s documentation does require permission.
We appreciate, but do not require, attribution. An attribution usually includes the title,
author, publisher, and ISBN. For example: “Running Linux, Fifth Edition by Matthias
Kalle Dalheimer and Matt Welsh. Copyright 2006 O’Reilly Media, Inc., 0-596-00760-4.”
If you feel your use of code examples falls outside fair use or the permission given
above, feel free to contact us at
www.it-ebooks.info
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Preface
|
xvii
How to Contact Us
We have tested and verified the information in this book to the best of our ability,
but you may find that features have changed (or even that we have made mistakes!).
Please let us know about any errors you find, as well as your suggestions for future
editions, by writing to:
O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the U.S. or Canada)
707-829-0515 (international or local)
707-829-0104 (fax)
You can send us messages electronically. To be put on the mailing list or to request a
catalog, send email to:


To ask technical questions or to comment on the book, send email to:

We have a web site for the book, where we’ll list examples, errata, and any plans for
future editions. You can access this page at:
/>For more information about this book and others, see the O’Reilly web site:

Safari® Enabled
When you see a Safari® Enabled icon on the cover of your favorite tech-
nology book, that means the book is available online through the
O’Reilly Network Safari Bookshelf.
Safari offers a solution that’s better than e-books. It’s a virtual library that lets you
easily search thousands of top tech books, cut and paste code samples, download
chapters, and find quick answers when you need the most accurate, current informa-
tion. Try it for free at .
Acknowledgments
This book is the result of many people’s efforts, and as expected, it would be impos-
sible to list them all here. First of all, we would like to thank Andy Oram, who did an
excellent job of editing, writing, and whip-cracking to get this book into shape.
www.it-ebooks.info
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
xviii
|
Preface
Apart from being the overall editor, Andy contributed the Unix tutorial chapter and
the Gaim section as well as material for the X and Perl sections. It was Andy who
approached us about writing for O’Reilly in the first place, and he has demonstrated
the patience of a saint when waiting for our updates to trickle in.
Because this book has grown so much in size and scope, its topics have become too
diverse for one person, or even a small set of coauthors. Therefore, we have drawn in

experts in a number of subject areas, listed near the beginning of the preface, to write
substantial material.
We would also like to thank the following people for their work on the Linux operat-
ing system—without all of them, there wouldn’t be anything to write a book about:
Linus Torvalds, Richard Stallman, Donald Becker, Alan Cox, Remy Card, Eric Ray-
mond, Ted T’so, H. J. Lu, Miguel de Icaza, Ross Biro, Drew Eckhardt, Ed Carp, Eric
Youngdale, Fred van Kempen, Steven Tweedie, Patrick Volkerding, Dirk Hohndel,
Matthias Ettrich, and all of the other hackers, from the kernel grunts to the lowly
docos, too numerous to mention here.
Special thanks to the following people for their contributions to the Linux Documen-
tation Project, technical review of this book, or general friendliness and support: Phil
Hughes, Melinda McBride, Bill Hahn, Dan Irving, Michael Johnston, Joel Gold-
berger, Michael K. Johnson, Adam Richter, Roman Yanovsky, Jon Magid, Erik
Troan, Lars Wirzenius, Olaf Kirch, Greg Hankins, Alan Sondheim, Jon David, Anna
Clark, Adam Goodman, Lee Gomes, Rob Walker, Rob Malda, Jeff Bates, and Volker
Lendecke.
For the third edition, we thank Phil Hughes, Robert J. Chassell, Tony Cappellini,
Craig Small, Nat Makarevitch, Chris Davis, Chuck Toporek, Frederic HongFeng,
and David Pranata for wide-ranging comments and corrections. Particularly impres-
sive were the efforts put in by an entire team of Debian developers and users, orga-
nized for us by Ossama Othman and Julian T. J. Midgley. Julian set up a CVS
repository for comments, and the book was examined collectively by him, Chris
Lawrence, Robert J. Chassell, Kirk Hilliard, and Stephen Zander.
For the fourth edition, we thank David Collier-Brown, Oliver Flimm, Phil Hughes,
Chris Lawrence, Rich Payne, Craig Small, Jeff Tranter, and Aaron Weber for their
reviews.
For the fifth edition, we thank Ben Hyde, Cheridy Jollie, Chris Lawrence, Ellen
Siever, and Jeff Tranter.
Kalle would like to thank Valerica Vatafu from Buzau, Romania, for lots of help with
the chapter about LAMP. He would also like to thank his colleagues in his company

Klarälvdalens Datakonsult AB—Michel Boyer de la Giroday, Tanja Dalheimer, Stef-
fen Hansen, Jesper Pedersen, Lutz Rogowski, Karl-Heinz Zimmer, Tobias Larsson,
Romain Pokrzywka, David Faure, Marc Mutz, Tobias Larsson, and Till Adam—for
their constructive comments on drafts of the book as well as for being general “Linux
thought amplifiers.”
www.it-ebooks.info
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
PART I
I. Enjoying and Being
Productive on Linux
This part of the book introduces Linux and brings you to the point where you can do
all the standard activities people do on other systems: emailing, web surfing, playing
games, watching videos, and so on.
Chapter 2 is worth reading even if you plan to install Linux from an easy-to-use distri-
bution. Fundamental considerations, such as how much disk space to devote to differ-
ent parts of your system, indicate that some planning lies behind every installation.
The vast majority of Linux installations go well and make the features discussed in
this part of the book available to system users. If you have trouble, though, the more
advanced material in other parts of the book can help you, along with online docu-
mentation and more specialized texts.
www.it-ebooks.info
www.it-ebooks.info
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
3
Chapter 1
CHAPTER 1
Introduction to Linux
Welcome to Running Linux, Version 5! When we wrote the first edition of this book,

Linux had barely arrived on the scene. Our task seemed simple: help readers learn
the basics of a new operating system that required a pretty fixed and predictable set
of tasks. Few if any observers expected Linux would become a best-of-breed operat-
ing system, supported by the vast majority of hardware and software manufacturers
on the planet. Who would have known that Linux would grow from a small user
base of 30,000 people in 1995 to hundreds of millions only 10 years later? People use
Linux everywhere on the planet and in some cases in outer space and under the
ocean.
To the casual observer, Linux looks like a fairly simple personal computer desktop
built on the same chassis as any IBM PC. People use Linux to browse the Internet,
exchange email, listen to music, watch videos, and instant message their friends and
coworkers. Students and office workers create documents with word processors, per-
form numerous tasks with spreadsheet programs, and make slide presentations.
The same Linux operating system also drives sonar arrays in nuclear submarines,
indexes every document on the Internet, unifies large corporate data centers, runs
nearly 70% of all web sites in the world, records your television programs, works in
your cellular phone, and runs the switches that allow you to connect with your
friends and family anywhere on the globe. Linux runs systems on the international
space station as well as the shuttles that take astronauts there. It protects you from
spam and computer viruses on numerous routers and back-end systems.
You can benefit directly from installing Linux on a system at home, at school, or in
the office, and having all that power at your fingertips. Not only can you carry on
everyday surfing and office work, but you can also learn how to write database que-
ries, administer a web server, filter mail for spam and viruses, automate your envi-
ronment through scripting languages, access web services, and participate in the
myriad of other cutting-edge activities provided by modern computing.
www.it-ebooks.info
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
4

|
Chapter 1: Introduction to Linux
How does Linux do all those things? Linux distributions harvest vast amounts of
diverse technology, especially new and innovative developments in hardware. Devel-
opers have access to all the code that makes up the operating system. Although many
people consider Linux the largest cooperative software development project in
human history, Linux developers don’t need to even know each other. If someone
wants to write a software application, all he has to do is download the Linux code or
visit its documentation site. If you started counting people who have contributed to
the development of Linux and its associated projects, you would see hundreds of
thousands of individuals.
Linux and open source software developers come from many walks of life. Major
computer vendors such as IBM, HP, Novell, Red Hat, Sun, Dell, and others pay por-
tions of their staffs to work on Linux. Universities around the globe sponsor projects
and foundations that contribute to Linux. The U.S. Department of Defense, NASA,
and the National Security Agency have paid for numerous pieces of the Linux operat-
ing system. Developing countries such as China, Brazil, Malaysia, South Africa, and
Viet Nam, to mention a few, have added to the Linux base. Industrial giants such as
Germany, Australia, Japan, the United Kingdom, and others have also made their
presence felt. But in the very midst of those giants, many individuals such as you and
me have also contributed to Linux.
During the 1990s, Linux generated more excitement in the computer field than any
other development since the advent of microprocessor technology. Linux rejuve-
nated a dying technology sector following the fall of the dot-com boom in the spring
of 2001. Today, Linux has surpassed the expectations of informed observers world-
wide, including the authors of this book.
Early on, Linux inspired and captured the loyalty of its users. Technologists inter-
ested in the server side of the Internet needed to become familiar with the operating
systems that ran web sites, domain name services, and email and service providers.
Traditional software manufacturers priced their systems out of the range of those

wanting to gain webmaster-type skills. Many people viewed Linux as a godsend
because you could download it for free and gain the skills necessary to become a
webmaster or system administrator while working on relatively low-cost hardware.
Originally, people saw Linux as simply an operating system kernel, offering the basic
services of process scheduling, virtual memory, file management, and handling of
hardware peripherals such as hard drives, DVDs, printers, terminals, and so forth.
Other Internet operating systems belonged to the Unix family, which became avail-
able for commercial sale only after the breakup of AT&T and the Bell Operating
Systems.
To skirt the legal issues surrounding AT&T’s Unix, the Free Software Foundation
(FSF) created a plethora of applications that performed many of the functions of
basic Unix while using totally original FSF code instead of code produced by Bell
www.it-ebooks.info
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
About This Book
|
5
Labs. This collection of FSF software was called GNU. To become a complete oper-
ating system, however, FSF needed a kernel. Although their own efforts in that area
stalled, an operating system fitting the bill arose unexpectedly from efforts by a stu-
dent at the University of Helsinki in Finland: Linus Torvalds.
People now use the term “Linux” to refer to the complete system—the kernel along
with the many applications that it runs: a complete development and work environ-
ment including compilers, editors, graphical interfaces, text processors, games, and
more. FSF proponents ask that this broader collection of software be known as
“GNU/Linux.”
About This Book
This book provides an overview and guide to Linux as a desktop and a back-office
system. We present information on topics to satisfy novices and wizards alike. This

book should provide sufficient material for almost anyone to choose the type of
installation they want and get the most out of it. Instead of covering many of the vol-
atile technical details—those things that tend to change with Linux’s rapid develop-
ment—we give you the information that helps you over the bumps as you take your
first steps with popular distributions, as well as background you will need if you plan
to go onto more advanced Linux topics such as web services, federated identity man-
agement, high-performance computing, and so on.
We geared this book for those people who want to understand the power that Linux
can provide. Rather than provide minimal information, we help you see how the dif-
ferent parts of the Linux system work, so you can customize, configure, and trouble-
shoot the system on your own. Linux is not difficult to install and use. Many people
consider it easier and faster to set up than Microsoft Windows. However, as with any
commercial operating system, some black magic exists, and you will find this book
useful if you plan to go beyond desktop Linux and use web services or network man-
agement services.
In this book, we cover the following topics:
• The design and philosophy of the Linux operating system, and what it can do for
you.
• Information on what you need to run Linux, including suggestions on hardware
platforms and how to configure the operating system depending on its specified
role (e.g., desktop, web server, database and/or application server).
• How to obtain and install Linux. We cover the Red Hat, SUSE, and Debian dis-
tributions in more detail than others, but the information is useful in under-
standing just about any distribution.
• An introduction, for new users, to the original Linux/Unix system philosophy,
including the most important commands and concepts still in use.
www.it-ebooks.info

Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×