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

Ubuntu linux wiliam hagen

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 (44.51 MB, 931 trang )


01_038993 ffirs.qxp

11/30/06

6:51 PM

Page i

Ubuntu Linux
Bible
®

William von Hagen

®


01_038993 ffirs.qxp

11/30/06

6:51 PM

Page ii

Ubuntu® Linux® Bible
Published by
Wiley Publishing, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256


www.wiley.com

Copyright © 2007 by Wiley Publishing, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN-13: 978-0-470-03899-4
ISBN-10: 0-470-03899-3
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
1B/RU/RS/QW/IN
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 or to obtain technical support, please contact our Customer
Care Department within the U.S. at (800) 762-2974, outside the U.S. at (317) 572-3993 or fax (317) 572-4002.
Library of Congress Cataloging-in-Publication Data is available from the publisher.
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. Ubuntu
is a trademark of Canonical Limited. 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.


01_038993 ffirs.qxp

11/30/06

6:51 PM

Page iii

To Dorothy, for more than words can say . . .
Quidquid latine dictum sit, altum sonatur.


01_038993 ffirs.qxp

11/30/06

6:51 PM

Page iv


About the Author
William von Hagen (Bill) has been a Unix system administrator for over twenty years, and a Linux
fanatic since the early 1990s. He has worked as a Linux product manager, systems programmer, system
administrator, writer, application developer, drummer, and content manager. Bill has written or co-written
books on such topics as Linux Server Hacks, Linux Filesystems, SUSE Linux, Red Hat Linux, GCC,
SGML, Mac OS X, and Hacking the TiVo. He has also written numerous articles on Linux, embedded
computing, Mac OS X, Unix, and various Open Source topics. An avid computer collector specializing
in workstations, he owns more than 200 computer systems but is not compulsive at all. You can reach
him at


01_038993 ffirs.qxp

11/30/06

6:51 PM

Page v

Credits
Executive Editor
Carol Long

Project Coordinator
Erin Smith

Senior Development Editor
Tom Dinse
Copy Editor

Mildred Sanchez

Graphics and Production Specialists
Claudia Bell
Carrie A. Foster
Barbara Moore
Rashell Smith

Editorial Manager
Mary Beth Wakefield

Quality Control Technician
David Faust

Production Manager
Tim Tate

Proofreading and Indexing
Richard T. Evans, Techbooks

Vice President and Executive
Group Publisher
Richard Swadley

Anniversary Logo Design
Richard Pacifico

Vice President and Executive Publisher
Joseph B. Wikert



02_038993 ftoc.qxp

11/30/06

7:05 PM

Page vi

Acknowledgments ................................................................................................................................xxi
Introduction ......................................................................................................................................xxiii

Part I: Getting Started with Ubuntu Linux
Chapter 1: The Ubuntu Linux Project......................................................................................................3
Chapter 2: Installing Ubuntu ................................................................................................................21
Chapter 3: Installing Ubuntu on Special-Purpose Systems ....................................................................47

Part II: Ubuntu for Desktop Users
Chapter 4: Basic Linux System Concepts ..............................................................................................89
Chapter 5: Using the GNOME Desktop ..............................................................................................107
Chapter 6: Using Command-Line Tools ..............................................................................................149
Chapter 7: Working with Text Files on Ubuntu ..................................................................................181
Chapter 8: Reading and Sending Mail with Evolution..........................................................................211
Chapter 9: Surfing the Web with Firefox ............................................................................................241
Chapter 10: Creating and Publishing Documents ................................................................................265
Chapter 11: Other Office Software: Spreadsheets and Presentations ....................................................303
Chapter 12: Working with Graphics ....................................................................................................343
Chapter 13: Working with Multimedia ................................................................................................365
Chapter 14: Would You Like to Play a Game? ......................................................................................409
Chapter 15: Connecting to Other Systems ..........................................................................................437

Chapter 16: File Transfer and Sharing on Ubuntu................................................................................455
Chapter 17: Consumer Electronics and Ubuntu ..................................................................................477
Chapter 18: Software Development on Ubuntu ..................................................................................513

Part III: Ubuntu for System Administrators
Chapter 19: Understanding the Ubuntu Startup and Shutdown Processes ..........................................551
Chapter 20: Adding, Removing, and Updating Software......................................................................567
Chapter 21: Managing Users, Groups, Authentication, and Advanced Permissions..............................615
Chapter 22: Backing Up and Restoring Files........................................................................................647
Chapter 23: Adding Hardware and Attaching Peripherals ....................................................................677
Chapter 24: Network Configuration and Security................................................................................711
Chapter 25: Going Wireless ................................................................................................................735

vi


02_038993 ftoc.qxp

11/30/06

7:05 PM

Page vii

Part IV: Configuring Servers on Ubuntu
Chapter 26: Setting Up a Web Server ..................................................................................................753
Chapter 27: Setting Up a Mail Server ..................................................................................................767
Chapter 28: Setting Up a DHCP Server................................................................................................791
Chapter 29: Setting Up a DNS Server ..................................................................................................805
Chapter 30: Setting Up a Print Server ..................................................................................................823

Chapter 31: Setting Up an NFS Server ................................................................................................835
Chapter 32: Setting Up a Samba Server ..............................................................................................851
Index ..................................................................................................................................................871

vii


02_038993 ftoc.qxp

11/30/06

7:05 PM

Page viii


02_038993 ftoc.qxp

11/30/06

7:05 PM

Page ix

Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii

Part I: Getting Started with Ubuntu Linux
Chapter 1: The Ubuntu Linux Project . . . . . . . . . . . . . . . . . . . . . . 3
Background ..................................................................................................................................4

Why Use Linux?..................................................................................................................4
What Is a Linux Distribution? ............................................................................................5
Introducing Ubuntu Linux ............................................................................................................6
The Ubuntu Manifesto ........................................................................................................7
Ubuntu Linux Release Schedule ..........................................................................................8
Ubuntu Update and Maintenance Commitments ................................................................9
Ubuntu and the Debian Project ..........................................................................................9
Why Choose Ubuntu? ................................................................................................................10
Installation Requirements ............................................................................................................11
Supported System Types ..................................................................................................12
Hardware Requirements....................................................................................................12
Time Requirements ..........................................................................................................12
Ubuntu CDs................................................................................................................................13
Support for Ubuntu Linux ..........................................................................................................14
Community Support and Information ..............................................................................14
Documentation ................................................................................................................17
Commercial Support for Ubuntu Linux ............................................................................18
Getting More Information About Ubuntu ....................................................................................19
Summary ....................................................................................................................................20

Chapter 2: Installing Ubuntu . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Getting a 64-bit or PPC Desktop CD ..........................................................................................22
Booting the Desktop CD..............................................................................................................22
Installing Ubuntu Linux from the Desktop CD............................................................................24
Booting Ubuntu Linux ......................................................................................................33
Booting Ubuntu Linux on Dual-Boot Systems ..................................................................33
The First Time You Boot Ubuntu Linux ............................................................................34
Test-Driving Ubuntu Linux ........................................................................................................34
Exploring the Desktop CD’s Examples Folder ..................................................................34
Accessing Your Hard Drive from the Desktop CD..............................................................36

Using Desktop CD Persistence ..........................................................................................41
Copying Files to Other Machines Over a Network ............................................................43
Installing Windows Programs from the Desktop CD....................................................................43
Summary ....................................................................................................................................45

ix


02_038993 ftoc.qxp

11/30/06

7:05 PM

Page x

Contents

Chapter 3: Installing Ubuntu on Special-Purpose Systems . . . . . . . . . . 47
Overview of Dual-Boot Systems ..................................................................................................48
Your Computer’s Boot Process ..........................................................................................48
Configuring a System for Dual-Booting ............................................................................49
Repartitioning an Existing Disk ........................................................................................49
Getting a Different Install CD ......................................................................................................58
Booting from a Server or Alternate Install CD..............................................................................58
Install Options on the Server Install CD ......................................................................................59
Installing an Ubuntu Server ..............................................................................................60
Manually Specifying Your Partition Layout........................................................................73
Installing an Ubuntu LAMP Server....................................................................................81
Booting Your Server for the First Time ..............................................................................81

Install Options on the Alternate Install CD..................................................................................82
Installing an Ubuntu Desktop System in Text Mode..........................................................83
Installing Ubuntu Linux in OEM Mode ............................................................................84
Installing a Server from the Alternate Install CD................................................................85
Summary ....................................................................................................................................86

Part II: Ubuntu for Desktop Users
Chapter 4: Basic Linux System Concepts . . . . . . . . . . . . . . . . . . . . 89
Working with Files and Directories ............................................................................................89
Standard Linux Directories................................................................................................90
Other Common Directories on Linux Systems ..................................................................91
Introduction to Linux Filesystems ..............................................................................................92
Disks, Partitions, and Mount Points ..................................................................................92
Local Filesystems: Standard and Journaling ......................................................................93
Network Filesystems ........................................................................................................95
Working with Partitions and Filesystems ....................................................................................95
Mounting Filesystems ......................................................................................................96
Automatically Mounting Filesystems at Boot Time ............................................................98
Automatically Mounting Removable Media Filesystems ..................................................101
Understanding Linux Permissions ............................................................................................101
Basic Concepts: Users and Groups ..................................................................................102
File and Directory Permissions Under Linux ..................................................................103
Default Permissions When Creating Files and Directories ..............................................104
Performing Privileged Operations in Ubuntu ..................................................................104
Summary ..................................................................................................................................106

Chapter 5: Using the GNOME Desktop . . . . . . . . . . . . . . . . . . . . 107
What’s a Desktop? Graphical Environments for Linux ..............................................................107
Using the Mouse ......................................................................................................................110
GNOME Desktop Overview ......................................................................................................110

GNOME Application Windows ................................................................................................112
Menus in GNOME ....................................................................................................................113
Panel Menus ..................................................................................................................113
Context-Sensitive Menus ................................................................................................116
Customizing Menus ........................................................................................................117

x


02_038993 ftoc.qxp

11/30/06

7:05 PM

Page xi

Contents

Customizing Your Desktop........................................................................................................123
Customizing Mouse Behavior..........................................................................................123
Configuring Display Resolution ......................................................................................125
Customizing Panels ........................................................................................................127
Configuring the Screensaver............................................................................................132
Changing Desktop Backgrounds ....................................................................................133
Switching Themes ..........................................................................................................134
Assistive Technologies for Using GNOME ......................................................................136
GNOME Keyboard Shortcuts ....................................................................................................137
Introducing the Nautilus File Manager ......................................................................................138
Basic Operations in Nautilus ..........................................................................................139

Examples of Using Nautilus ............................................................................................140
Getting More Information About Nautilus ......................................................................143
Using a Window Manager ........................................................................................................143
Summary ..................................................................................................................................148

Chapter 6: Using Command-Line Tools . . . . . . . . . . . . . . . . . . . . 149
Why Use the Command Line? ..................................................................................................150
Executing Commands from the Command Line ........................................................................150
What’s a Shell? ..........................................................................................................................156
Getting to a Shell ......................................................................................................................158
Using the GNOME Terminal Application ........................................................................158
Using the X Window System Terminal Application ........................................................160
Popular Command-Line Commands ........................................................................................163
Moving Around in the Linux Filesystem ........................................................................163
Copying, Moving, Renaming, and Deleting Files and Directories ....................................164
Changing File and Directory Permissions........................................................................168
Finding Commands That Do Specific Things ..................................................................170
Working with the Bash Shell ....................................................................................................171
Using Command History ................................................................................................171
Using Command and Filename Completion....................................................................172
Using Wildcards..............................................................................................................173
Pipes and Input and Output Redirection ........................................................................174
Introducing Job Control..................................................................................................175
Exploring the Bash Configuration File ............................................................................176
Using Environment Variables ..........................................................................................177
Defining and Using Aliases ............................................................................................179
Summary ..................................................................................................................................179

Chapter 7: Working with Text Files on Ubuntu . . . . . . . . . . . . . . . . 181
Introduction to Linux Text Editors ............................................................................................182

Using vi ....................................................................................................................................183
Starting and Exiting vi ....................................................................................................184
Inserting Text in vi ..........................................................................................................185
Moving Around in vi ......................................................................................................186
Deleting and Changing Text in vi ....................................................................................187
Cutting, Copying, and Pasting in vi ................................................................................187
Searching for and Replacing Text in vi ............................................................................188
Undoing Changes in vi....................................................................................................190
Using Multiple Windows in vi ........................................................................................190
Customizing vim ............................................................................................................191

xi


02_038993 ftoc.qxp

11/30/06

7:05 PM

Page xii

Contents

Graphical Versions of vi ..................................................................................................193
More Information About vi and vim................................................................................193
Using emacs ..............................................................................................................................194
A Few Words About emacs Commands ..........................................................................197
Emacs Terminology ........................................................................................................198
Starting and Exiting emacs ..............................................................................................199

Moving Around in emacs ................................................................................................202
Cutting, Copying, and Pasting in emacs..........................................................................203
Searching for and Replacing Text in emacs......................................................................203
Working with Multiple Windows and Buffers in emacs ..................................................203
Customizing emacs ........................................................................................................204
Getting More Information About emacs ..........................................................................206
Using gedit................................................................................................................................206
Other Text Editors for Ubuntu ..................................................................................................208
Summary ..................................................................................................................................209

Chapter 8: Reading and Sending Mail with Evolution . . . . . . . . . . . . 211
Starting Evolution ....................................................................................................................212
Using the Evolution Setup Assistant ..........................................................................................213
Sending and Receiving Mail ......................................................................................................222
Sending Mail in Evolution ..............................................................................................225
Setting Evolution Preferences for Sending and Viewing Mail ..........................................227
Undeleting Mail Messages ..............................................................................................229
Creating and Using Mail Folders ....................................................................................230
Using Search Folders ......................................................................................................231
Filtering Incoming Mail ............................................................................................................234
Automatically Processing Incoming Mail ........................................................................234
Automatically Checking for Junk Mail ............................................................................237
Additional Sources of Information About Evolution ..................................................................238
Summary ..................................................................................................................................239

Chapter 9: Surfing the Web with Firefox . . . . . . . . . . . . . . . . . . . 241
A Quick History of Firefox ........................................................................................................241
Starting Firefox..........................................................................................................................242
The Firefox User Interface ........................................................................................................244
Standard Parts of a Firefox Window ................................................................................244

Using the Mouse in Firefox ............................................................................................245
Special and Not-So-Special Firefox Features....................................................................246
Configuring Firefox ..................................................................................................................248
Setting Your Home Page..................................................................................................248
Controlling Popups, JavaScript, and More ......................................................................249
Configuring Your Privacy Settings ..................................................................................250
Working with Bookmarks..........................................................................................................253
Creating Bookmarks in Firefox........................................................................................253
Managing Your Bookmarks ............................................................................................255
Creating Live Bookmarks ................................................................................................256
Enhancing Firefox ....................................................................................................................258
Adding Firefox Extensions ..............................................................................................258
Adding New Firefox Themes ..........................................................................................261
Summary ..................................................................................................................................263

xii


02_038993 ftoc.qxp

11/30/06

7:05 PM

Page xiii

Contents

Chapter 10: Creating and Publishing Documents . . . . . . . . . . . . . . 265
Using Document Markup Languages on Ubuntu ......................................................................266

Installing TeX on Your Ubuntu System............................................................................266
Using TeX Markup ..........................................................................................................267
Introducing LaTeX Markup ............................................................................................269
Formatting and Previewing DVI Files..............................................................................270
Using Graphical Tools to Work with TeX and LaTeX ......................................................271
More Information About TeX and LaTeX ........................................................................273
Word Processing with OpenOffice.org Writer ............................................................................274
Installing Files for Writer ..............................................................................................275
Taking a Quick Tour of Writer ........................................................................................276
Personalizing Writer........................................................................................................279
Using Wizards to Create Documents ..............................................................................280
Modifying Document Styles and Layout..........................................................................283
Creating and Using Templates ........................................................................................286
Importing Documents from Other Word Processors........................................................288
More Information About Writer ......................................................................................291
Desktop Publishing with Scribus ..............................................................................................291
Installing Scribus on Ubuntu ..........................................................................................292
Taking a Quick Scribus Tutorial ......................................................................................293
More Information About Scribus ....................................................................................301
Other Word Processors and Office Suites for Linux ..................................................................301
Summary ..................................................................................................................................302

Chapter 11: Other Office Software: Spreadsheets and Presentations . . . . 303
Introduction to Spreadsheets: A Quick Tutorial ........................................................................304
Using Gnumeric ........................................................................................................................314
Starting Gnumeric ..........................................................................................................315
Taking a Quick Tour of Gnumeric ..................................................................................315
Invoking Functions in Gnumeric ....................................................................................317
Specifying the Type of Data in a Cell ..............................................................................318
Importing Existing Spreadsheets ....................................................................................321

Using OpenOffice.org Calc........................................................................................................322
Installing Files for OpenOffice.org Calc ..........................................................................322
Starting Calc ..................................................................................................................323
Taking a Quick Tour of Calc............................................................................................324
Invoking Functions in Calc ............................................................................................326
Specifying the Type of Data in a Cell ..............................................................................326
Importing Existing Spreadsheets ....................................................................................328
Using OpenOffice.org Impress ..................................................................................................332
Installing Files for Impress ..............................................................................................332
Starting Impress ..............................................................................................................333
Taking a Quick Tour of Impress ......................................................................................336
Creating a Presentation ..................................................................................................339
Importing Existing Presentations ....................................................................................340
Summary ..................................................................................................................................341

xiii


02_038993 ftoc.qxp

11/30/06

7:05 PM

Page xiv

Contents

Chapter 12: Working with Graphics. . . . . . . . . . . . . . . . . . . . . . 343
Overview of Digital Graphics Terminology ................................................................................343

Using GIMP ..............................................................................................................................346
Starting GIMP ................................................................................................................347
A Quick Tour of GIMP ....................................................................................................348
Sample GIMP Tasks ........................................................................................................350
More Information About GIMP ......................................................................................356
Using OpenOffice.org Draw ......................................................................................................356
Installing OpenOffice.org Draw ......................................................................................357
Starting Draw..................................................................................................................358
A Quick Tour of Draw ....................................................................................................358
More Information About OpenOffice.org Draw ..............................................................360
Using Inkscape for Vector Graphics ..........................................................................................360
Installing Inkscape ..........................................................................................................361
Starting Inkscape ............................................................................................................362
A Quick Tour of Inkscape ..............................................................................................362
More Information About Inkscape ..................................................................................363
Summary ..................................................................................................................................364

Chapter 13: Working with Multimedia . . . . . . . . . . . . . . . . . . . . 365
Overview of Digital Audio and Video Terminology....................................................................365
Configuring Sound Devices, Levels, and System Sounds ..........................................................370
Testing and Customizing System Sounds ........................................................................370
Setting System Sound Levels ..........................................................................................372
Getting Detailed Information About Your Sound Hardware ............................................376
Setting CD and DVD Preferences ..................................................................................377
Installing the gstreamer Framework and Plug-ins ......................................................................379
Working with CDs ....................................................................................................................382
Playing CDs Using Sound Juicer ....................................................................................383
Ripping CDs Using Sound Juicer ....................................................................................384
Burning CDs Using Serpentine........................................................................................386
Working with Other Audio Sources ..........................................................................................388

Playing Audio Files and Internet Radio Using Rhythmbox ..............................................388
Converting Audio File Formats ......................................................................................394
Working with DVDs on Ubuntu ................................................................................................398
Playing DVDs..................................................................................................................398
Ripping DVDs ................................................................................................................400
Copying DVDs and Burning DVD Images Using k3b ......................................................400
Summary ..................................................................................................................................406

Chapter 14: Would You Like to Play a Game? . . . . . . . . . . . . . . . . 409
Default GNOME Games ............................................................................................................409
Card Games ....................................................................................................................410
Board Games ..................................................................................................................414
Video Games ..................................................................................................................419
Other Popular Games in the Ubuntu Repositories ....................................................................424
Billions and Billions of Versions of Chess ........................................................................424
Go ..................................................................................................................................429
Monopoly Clones............................................................................................................430
Scrabble Clones ..............................................................................................................434
Summary ..................................................................................................................................435

xiv


02_038993 ftoc.qxp

11/30/06

7:05 PM

Page xv


Contents

Chapter 15: Connecting to Other Systems . . . . . . . . . . . . . . . . . . 437
Establishing Secure Connections to Other Systems....................................................................437
Logging in to Remote Systems Using ssh ........................................................................438
Enabling the SSH Daemon on Your System ....................................................................439
Connecting to Other Systems Using VNC ................................................................................441
Getting VNC Client and Server Software for Your Other Platforms..................................441
Using vncviewer..............................................................................................................445
Connecting to Remote Windows Terminal Servers ....................................................................448
Using rdesktop for Terminal Server Connections ............................................................449
Using tsclient for Terminal Server Connections ..............................................................452
Using Other Remote Connection Software ................................................................................453
Summary ..................................................................................................................................454

Chapter 16: File Transfer and Sharing on Ubuntu . . . . . . . . . . . . . . 455
Transferring Files to Other Systems ..........................................................................................456
Using FTP ......................................................................................................................456
Accessing Shares on Remote Windows Systems ..............................................................463
Accessing NFS Directories from Linux Systems ..............................................................466
Peer-to-Peer File Sharing on Ubuntu ........................................................................................467
Installing and Using gtk-gnutella ....................................................................................468
Using BitTorrent on Ubuntu............................................................................................472
Summary ..................................................................................................................................476

Chapter 17: Consumer Electronics and Ubuntu . . . . . . . . . . . . . . . 477
Configuring Your System for Consumer Electronics Devices ....................................................478
Configuring Digital and Digital Video Camera Recognition ............................................478
Configuring iPod and Other Digital Audio Player Recognition ........................................479

Configuring PDA and Smart Phone Recognition ............................................................480
Configuring Flash Card and Other Digital Media Recognition ........................................481
Digital Cameras and Ubuntu ....................................................................................................482
PDAs, Smart Phones, and Ubuntu ............................................................................................485
Configuring and Synchronizing Palm OS Devices ..........................................................486
Synchronizing Data with Microsoft Windows Devices ....................................................491
iPods, Other Digital Audio Players, and Ubuntu........................................................................496
Working with an iPod from Ubuntu................................................................................497
Working with Other Digital Audio Players ......................................................................508
Reading CompactFlash and SD Cards........................................................................................509
Summary ..................................................................................................................................510

Chapter 18: Software Development on Ubuntu . . . . . . . . . . . . . . . 513
Installing and Using Development Software on Ubuntu ............................................................514
Installing GCC Compilers, make, and Friends ................................................................514
GCC Compiler Overview ................................................................................................516
Using GCC’s C Compiler ................................................................................................516
Creating Simple Makefiles ..............................................................................................517
Using an Integrated Development Environment ........................................................................519
Popular IDEs for Linux ..................................................................................................519
Installing Eclipse ............................................................................................................521
Using Eclipse for C Application Development ................................................................522
Getting More Information About Eclipse ........................................................................537

xv


02_038993 ftoc.qxp

11/30/06


7:05 PM

Page xvi

Contents

Source Code Control Software ..................................................................................................538
The Concurrent Versioning System (CVS) ......................................................................538
Installing and Using Subversion ......................................................................................539
Summary ..................................................................................................................................547

Part III: Ubuntu for System Administrators
Chapter 19: Understanding the Ubuntu Startup and Shutdown Processes . 551
Overview of the Ubuntu Linux Startup Process ........................................................................551
The Boot Monitor or BIOS ..............................................................................................552
The Boot Loader ............................................................................................................552
Loading the Kernel..........................................................................................................554
Loading and Using an Initial RAM Disk or RAM Filesystem ............................................555
The Init Process ..............................................................................................................557
Examining the Boot Process with Boot Chart ............................................................................558
Optimizing the Ubuntu Boot Process ......................................................................................560
The Ubuntu Linux Shutdown Process ......................................................................................564
Summary ..................................................................................................................................566

Chapter 20: Adding, Removing, and Updating Software. . . . . . . . . . . 567
Overview of Ubuntu Package Management Software ................................................................568
Ubuntu Repositories and Components ......................................................................................570
Enabling Additional Repository Components..................................................................571
Enabling Additional Repository Sources Using a Text Editor ..........................................572

Enabling Additional Repository Sources Using the Software Properties Tool ..................573
Problems Adding or Accessing Nonstandard Repositories ..............................................577
Mixing Ubuntu and Debian Repositories ........................................................................578
Exploring Your System Using dpkg and Friends........................................................................580
Listing the Packages that are Installed on Your System ....................................................581
Listing the Packages that are Available for Your System ..................................................582
Listing Information About a Package ..............................................................................585
Listing the Contents of a Package ....................................................................................586
Determining What Package Provides an Existing File......................................................587
Determining What Package Provides a Missing File ........................................................588
Using apt-get to Add and Remove Software ..............................................................................588
Upgrading Your System Using apt-get ............................................................................590
Smart System Upgrades Using apt-get ............................................................................590
Retrieving Package Source Code Using apt-get................................................................590
Satisfying Build Dependencies Using apt-get ..................................................................592
Using aptitude to Add and Remove Software ............................................................................592
Tips and Tricks for Using the aptitude User Interface ......................................................593
Using aptitude to Install Recommended Software ..........................................................595
Advantages of Using aptitude to Install and Remove Software ........................................596
Using Synaptic to Add and Remove Software ............................................................................597
Configuring Synaptic Preferences....................................................................................599
Searching for Software in Synaptic ..................................................................................601
Installing Packages in Synaptic........................................................................................603
Removing Packages in Synaptic ......................................................................................607

xvi


02_038993 ftoc.qxp


11/30/06

7:05 PM

Page xvii

Contents

Using the Ubuntu Update Manager ..........................................................................................609
Converting Packages from Other Package Formats....................................................................610
Keeping your System Lean, Mean, and Pristine ........................................................................613
Summary ..................................................................................................................................614

Chapter 21: Managing Users, Groups, Authentication,
and Advanced Permissions . . . . . . . . . . . . . . . . . . . . . . . . . . . 615
Creating and Managing Users and Groups ................................................................................616
Creating New Users ........................................................................................................617
Managing Existing Users ................................................................................................622
Creating New Groups ....................................................................................................624
Managing Existing Groups ..............................................................................................625
PAMs and the Linux Authentication Process..............................................................................626
PAM Configuration Files for Applications and Services ..................................................628
Example: PAMs Used by the Login Process ....................................................................629
Configuration Files for Various PAMs ..............................................................................632
What If PAM Configuration Files Are Missing?................................................................632
Customizing the sudo Command on Ubuntu Systems ..............................................................633
Using ACLs for Sophisticated File Sharing ................................................................................636
Overview of Linux ACLs ................................................................................................637
Installing ACL Commands on Ubuntu ............................................................................637
Activating Filesystem Support for ACLs ..........................................................................638

Working with ACLs from the Command Line ................................................................639
Working with ACLs Using Graphical Tools ....................................................................641
Summary ..................................................................................................................................645

Chapter 22: Backing Up and Restoring Files . . . . . . . . . . . . . . . . . 647
Backups 101..............................................................................................................................648
Why Do Backups? ..........................................................................................................648
Different Types of Backups ..............................................................................................649
Verifying and Testing Backups ........................................................................................652
Deciding What to Back Up..............................................................................................653
Backup Software for Linux ........................................................................................................653
Local Backup and Restore Software for Linux..................................................................654
Network-Oriented Backup Software for Linux ................................................................656
Backing Up Files to Local, Removable Media ............................................................................658
Archiving and Restoring Files Using tar ..........................................................................659
Making an Up-to-Date Copy of a Local Directory Using cp ............................................660
Making an Up-to-Date Copy of a Remote Directory Using rsync ....................................661
Installing and Using the backuppc Utility..................................................................................663
Installing backuppc ........................................................................................................664
Configuring backuppc ....................................................................................................665
Identifying Hosts to Back Up ..........................................................................................666
Defining a Backup Using rsyncd ....................................................................................667
Defining a Backup Using SMB ........................................................................................669
Starting Backups in backuppc ........................................................................................670
Restoring from Backups in backuppc ..............................................................................672
Summary ..................................................................................................................................676

xvii



02_038993 ftoc.qxp

11/30/06

7:05 PM

Page xviii

Contents

Chapter 23: Adding Hardware and Attaching Peripherals . . . . . . . . . . 677
Adding a Printer........................................................................................................................678
Using a Scanner ........................................................................................................................683
Using External Disks and CD/DVD Drives ................................................................................689
Configuring Automatic Device Detection ........................................................................689
Troubleshooting Automatic Device Detection..................................................................690
Adding Internal Disks and CD/DVD Drives ..............................................................................691
Adding EIDE/ATA Drives ................................................................................................692
Adding SATA Drives........................................................................................................693
Adding SCSI Drives ........................................................................................................693
Troubleshooting Boot Problems After Adding New Drives ..............................................694
Locating, Partitioning, and Formatting New Drives ........................................................696
Using PCMCIA Cards................................................................................................................704
Adding PCI Cards ....................................................................................................................705
Examining and Troubleshooting Devices Graphically ................................................................707
Summary ..................................................................................................................................709

Chapter 24: Network Configuration and Security . . . . . . . . . . . . . . 711
Networking 101 ........................................................................................................................712
Manually Configuring Your Network Hardware ........................................................................715

Manually Configuring Modem Connections ..............................................................................719
Defining and Using Multiple Network Configurations ..............................................................721
Network Testing with GNOME’s Network Tools ........................................................................723
Tips for Securing Your System ..................................................................................................726
Installing a Firewall ..................................................................................................................727
Overview of Linux Firewalling and Packet Filtering ........................................................728
Installing and Configuring a Firewall Using Lokkit ........................................................729
Summary ..................................................................................................................................734

Chapter 25: Going Wireless . . . . . . . . . . . . . . . . . . . . . . . . . . 735
Overview of Wireless Technologies............................................................................................735
Configuring Wireless Ethernet Interfaces ..................................................................................738
Command-Line Tools for Wireless Networking ........................................................................741
Installing and Using Windows Networking Drivers ..................................................................742
Installing NDIS Wrapper and Friends ............................................................................743
Installing Microsoft Windows Drivers ............................................................................744
NDIS Wrapper Tips and Tricks ......................................................................................747
Summary ..................................................................................................................................749

Part IV: Configuring Servers on Ubuntu
Chapter 26: Setting Up a Web Server . . . . . . . . . . . . . . . . . . . . . 753
World Wide Web 101................................................................................................................753
Introduction to Web Servers and Apache ..................................................................................755
Installing Apache ......................................................................................................................756
Installing Apache from the Command Line ....................................................................757
Installing Apache Using Synaptic ....................................................................................757

xviii



02_038993 ftoc.qxp

11/30/06

7:05 PM

Page xix

Contents

Apache 2 File Locations ............................................................................................................758
Configuring Apache ..................................................................................................................759
Troubleshooting ........................................................................................................................763
More Information ......................................................................................................................764
Summary ..................................................................................................................................765

Chapter 27: Setting Up a Mail Server . . . . . . . . . . . . . . . . . . . . . 767
Introduction to Mail Servers ......................................................................................................768
Popular Linux Mail Transfer Agents ................................................................................768
Why Run Your Own Mail Server?....................................................................................770
Installing Postfix and Friends ....................................................................................................771
Built-in Postfix Configuration Models ............................................................................772
Installing Postfix and Friends from the Command Line ..................................................772
Installing Postfix and Friends Using Synaptic..................................................................775
Configuring Postfix ..................................................................................................................777
Postfix Configuration Files ..............................................................................................778
Identifying Trusted Hosts and Domains ..........................................................................780
Rewriting Addresses in Outgoing Mail ............................................................................780
Accepting Mail for an Entire Domain ..............................................................................781
Activating Qpopper for POP/POP3 Support ..............................................................................781

Adding SPAM Filtering and Virus Scanning to Postfix ..............................................................782
Greylisting via postgrey ..................................................................................................783
Adding Postfix Parameters to Reject Bogus Mail ..............................................................784
Integrating MailScanner, SpamAssassin, and ClamAV with Postfix ..................................786
More Information ......................................................................................................................788
Summary ..................................................................................................................................788

Chapter 28: Setting Up a DHCP Server . . . . . . . . . . . . . . . . . . . . 791
Overview of DHCP....................................................................................................................792
Installing a DHCP Server ..........................................................................................................795
Managing a DHCP Server from the Command Line ..................................................................796
Creating DHCP Configuration Files Using a Text Editor..................................................796
Specifying Additional DHCP Server Configuration File Entries ......................................797
Managing a DHCP Server Graphically ......................................................................................798
Troubleshooting DHCP ............................................................................................................803
Summary ..................................................................................................................................803

Chapter 29: Setting Up a DNS Server . . . . . . . . . . . . . . . . . . . . . 805
Overview of DNS and BIND......................................................................................................806
Installing a DNS Server Using Synaptic ....................................................................................808
Overview of BIND Configuration Files ......................................................................................809
Creating DNS Zone and Reverse Lookup Files ..........................................................................811
Using Common Entries for Zone and Reverse Lookup Files: SOA and $TTL ..................811
Creating Zone Files ........................................................................................................813
Creating Reverse Lookup Files ........................................................................................815
Incorporating Zone and Reverse Lookup Files with BIND ..............................................816
Restarting and Testing Your Name Server ..................................................................................817
Troubleshooting DNS ................................................................................................................818
Getting More Information about DNS and BIND ......................................................................821
Summary ..................................................................................................................................821


xix


02_038993 ftoc.qxp

11/30/06

7:05 PM

Page xx

Contents

Chapter 30: Setting Up a Print Server . . . . . . . . . . . . . . . . . . . . . 823
Linux and Unix Printing History ..............................................................................................823
Enabling Remote Hosts to Access Your CUPS Print Server ........................................................824
Enabling Administrative Operations via the CUPS Web Interface ..............................................826
Integrating Windows Printing with an Ubuntu Print Server ......................................................826
Integrating Mac OS X Printing with an Ubuntu Print Server......................................................828
Troubleshooting Remote Printing ..............................................................................................831
Checking the CUPS Log Files..........................................................................................831
Accessing Controls for Portions of the CUPS Web Interface ............................................832
Handling Preformatted print Jobs ..................................................................................832
Getting More Information About CUPS ....................................................................................833
Summary ..................................................................................................................................833

Chapter 31: Setting Up an NFS Server . . . . . . . . . . . . . . . . . . . . 835
Overview of the Network File System........................................................................................836
Understanding how NFS Works......................................................................................837

Comparing Different Versions of NFS..............................................................................838
Installing an NFS Server and Related Packages ..........................................................................839
Using the Shared Folder Tool to Export Directories ..................................................................840
Verifying NFS Operations..........................................................................................................845
Manually Exporting Directories in /etc/exports..........................................................................847
Getting More Information About NFS and Related Software......................................................848
Summary ..................................................................................................................................849

Chapter 32: Setting Up a Samba Server . . . . . . . . . . . . . . . . . . . . 851
Overview of Microsoft Windows File Sharing............................................................................851
Introducing Samba ....................................................................................................................853
Installing the Samba Server and Friends....................................................................................853
Samba Server Configuration Essentials ......................................................................................854
Identifying Your Workgroup or Domain..........................................................................855
Configuring Samba Authentication ................................................................................856
Sharing Printers and Home Directories Using Samba ......................................................856
Verifying the Samba Configuration File ..........................................................................858
Testing Samba Availability and Services ..........................................................................859
Using the Shared Folder Tool to Share Directories ....................................................................861
Getting More Information About Samba ..................................................................................865
Summary ..................................................................................................................................865

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 871

xx


03_038993 flast.qxp

11/30/06


6:53 PM

Page xxi

N

othing I have ever written would have been possible without the love, support, and infinite
patience of Dorothy Fisher, my wife and best friend. Dorth believed in me on day one, removed
several thousand commas from my earliest writing, and has accepted “I can’t do that now—
come back in fifteen minutes or six hours” as an excuse more times than anyone should ever be expected
to. I am similarly lucky to have great friends like Jeff “Sunshine” Kaminski, Dr. Joe O’Lear, Jim Morgan,
and Kim Walter in my life. I heard once that a good friend will come and bail you out of jail, but a true
friend will be sitting in jail with you saying, “Man! That was fun!” Luckily, we haven’t had to test that,
but I’m sure we’d all look great in orange.
I would also like to thank Carol Long, Tom Dinse, Kit Kemper, and others at Wiley who enabled me to
do this book and supported me during its creation. All errors are mine alone, but this would be a much
weaker book without your contributions. I quite literally wouldn’t have been able to do it without you.
Finally, this book wouldn’t even exist without people like Linus Torvalds, Mark Shuttleworth, the Ubuntu
folks in general, the Debian Project, Richard Stallman, the FSF, and the millions of contributors to the cornucopia that is GNU/Linux.

xxi


03_038993 flast.qxp

11/30/06

6:53 PM


Page xxii


03_038993 flast.qxp

11/30/06

6:53 PM

Page xxiii

A

Linux distribution is basically the sum of the things that you need to run Linux on your computer. There are many different Linux distributions, each with their own target audience, set of
features, administrative tools, and fan club, the latter of which is more properly known as a user
community. Putting aside the downright fanatics, most of the members of the user community for any
Linux distribution are people who just happen to find themselves using a distribution for one reason or
another. These reasons range from what they’ve heard from friends, what CD or DVD came with a Linux
magazine that they bought, to what Linux book they happened to buy.
Ubuntu Linux is the most exciting Linux distribution in years. Ironically, while Ubuntu itself is indeed
new, it also comes with a respectable Linux pedigree. Ubuntu has direct roots in one of the oldest and
best-known Linux distributions available, the Debian GNU/Linux distribution. The folks who initially
created and supported Ubuntu, Canonical Ltd., started out as Debian fans who wanted a faster-moving,
more up-to-date distribution than Debian provided. So, in the spirit of Linux and the Open Source
movement, they made their own distribution, Ubuntu Linux, by incorporating the best of Debian, other
Linux distributions and open source applications, and added their own special sauce.
Ubuntu means “humanity to others.” For the people who use and bring you Ubuntu Linux, this is not
just a name with touchy-feely overtones. The special sauce in Ubuntu is a social and business commitment to Ubuntu users everywhere. Ubuntu releases occur regularly, every six months, and support and
updates for any Ubuntu release are available for a minimum of eighteen months after that. More about
that it in the first chapter, where you’ll read more about Ubuntu, its philosophy, its community, and why

the sum of those makes Ubuntu different than any other Linux distribution.
In a nutshell, Ubuntu is a Linux distribution for people. While reading this book, you’ll see that there
are plenty of excellent technical reasons for using Ubuntu, even if you’re a hard-core Linux propeller
head. However, that’s not the point of Ubuntu—Ubuntu is for people who want to use their computers
and need a solid software foundation for doing so. Whether your focus is on writing code or surfing the
Web, sending and receiving electronic mail, working with your digital photographs, watching DVDs, listening to music, and so on, Ubuntu offers the software that you need to do what you want to do.
Like any Linux distribution, you can freely download and install Ubuntu, but it gets even better. This
book includes a CD of the latest Ubuntu Desktop CD at the time this book was published, but new versions may be available by the time you buy the book. If you don’t have access to a CD burner, need a version of Ubuntu for a non-x86 system, or simply don’t have the time, the Ubuntu folks will send you CDs
that you can either use to install or test-drive Ubuntu on your current computer system. That’s more than
free—it’s revolutionary! Downloadable copies of Linux distributions are nothing new, but sending people
physical CDs if they need them shows that Ubuntu Linux is more than just another Linux distribution—
the Ubuntu folks are Linux devotees on a mission. And you and I are the lucky winners.

Who Should Read This Book
If you’re reading this in a bookstore and are unsure about which Linux distribution to get started
with, or whether to use Linux at all, this book is for you. Ubuntu is a complete, visually friendly, and

xxiii


03_038993 flast.qxp

11/30/06

6:53 PM

Page xxiv

Introduction


community-oriented distribution that makes it easy for you to get started using Linux. Ubuntu is designed
to be a distribution for users, but as you’ll see throughout this book, you can do anything that you want
with it, from running your desktop to running servers and network services for the enterprise, thanks to the
inherent power of Linux. Ubuntu comes with a tremendous selection of up-to-date software, and plenty
more is quickly downloaded and installed thanks to its easy-to-use administrative tools. Ubuntu is frequently updated, and there is no such thing as a Linux virus or “accidentally-installed spyware.” Linux is
inherently secure.
Ubuntu’s rich user community is a big win for new and existing Ubuntu users. There are places to ask questions and actually get answers. People seem to want to help. The Ubuntu forums and mailing lists are a live,
constant demonstration of the philosophical and social aspects of Ubuntu, which are discussed in Chapter 1.
In a nutshell, every Linux distribution has fans, devotees, forums, and mailing lists, but Ubuntu’s are the
most exciting, usable, and useful that I’ve ever seen in my years of using Linux. You can feel the excitement.
Ubuntu brings the promise of Internationalization alive—you can get versions of Ubuntu for many languages
and character sets, and more are actively on the way.
If you’re already using Ubuntu, this book should be equally useful to you because it explains how to use the
standard applications provided with Ubuntu, how to do common system configuration and system administration tasks, and so on. If you’re already using Ubuntu on your desktop and do more with it, this book
clearly explains how to install common servers for file-sharing, electronic mail handling, Web servers, and
much more.

How This Book Is Organized
Ubuntu Linux Bible is organized into four parts.

Part I: Getting Started with Ubuntu Linux
The first part of this book provides background information about Ubuntu Linux, including instructions on
installing it on your machine or simply taking it for a test drive from a Live CD. Chapter 1 introduces
Ubuntu, the Ubuntu philosophy, and explores the Ubuntu community and the various Web sites where you
can get information and assistance in using and configuring Ubuntu (if you need help NOW, rather than
simply reading this book). Chapter 1 also discusses some of the main reasons why Ubuntu is the right
Linux distribution to use, and compares its capabilities against several other popular Linux distributions.
Chapter 2 explains how to install Ubuntu as your only operating system or as an alternate operating system
on an existing computer system if you can’t live without whatever you’re already using. Chapter 3 explains
how to experiment with Ubuntu even if you don’t have a computer system or disk space to spare, thanks to

the freely downloadable Ubuntu Live distribution, which boots on any modern PC but doesn’t require any
changes to that system.

Part II: Ubuntu for Desktop Users
Part II explores the rich set of applications that are available for Ubuntu and explains how to use them to
accomplish the kinds of things that people use modern personal computers for—reading and sending e-mail;
surfing the Web; creating documents and spreadsheets; playing games; and playing and managing audio
CDs, online music files, and DVD movies. Chapters 4, 5, and 6 provide a basic discussion of Linux and Unix
fundamentals if you are curious about using a command line, give you an overview of the graphical user
interface provided by Ubuntu, and generally explain how things are organized on your Ubuntu system.

xxiv


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

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