Tài liệu Ubuntu Unleashed - Pdf 84


Ubuntu
UNLEASHED
800 East 96th Street, Indianapolis, Indiana 46240 USA
Andrew Hudson
Paul Hudson
2008 Edition
Ubuntu Unleashed 2008 Edition
Copyright © 2009 by Sams Publishing
All rights reserved. No part of this book shall be reproduced, stored in a retrieval
system, or transmitted by any means, electronic, mechanical, photocopying, recording,
or otherwise, without written permission from the publisher. No patent liability is
assumed with respect to the use of the information contained herein. Although every
precaution has been taken in the preparation of this book, the publisher and author
assume no responsibility for errors or omissions. Nor is any liability assumed for
damages resulting from the use of the information contained herein.
ISBN-13: 978-0-672-32993-7
ISBN-10: 0-672-32993-X
Library of Congress Cataloging-in-Publication Data:
Hudson, Andrew, 1978-
Ubuntu unleashed 2008 edition : covering 8.04 and 8.10 / Andrew
Hudson, Paul Hudson. -- 4th ed.
p. cm.
Includes index.
ISBN 978-0-672-32993-7 (pbk. w/dvd)
1. Ubuntu (Electronic resource) 2. Linux. 3. Operating systems
(Computers) I. Hudson, Paul, 1979- II. Title.
QA76.76.O63H81666 2008
005.4'32--dc22
2008021150
Printed in the United States of America

Paula Lowell
Indexer
Tim Wright
Proofreader
Leslie Joseph
Technical Editor
Dallas Releford
Publishing
Coordinator
Vanessa Evans
Multimedia Developer
Dan Scherf
Cover and Interior
Designer
Gary Adair
Composition
Mark Shirar
Contents at a Glance
Introduction 1
Part I Installation and Configuration
1 Installing Ubuntu..........................................................................................11
2 Post-Installation Configuration....................................................................25
3 Working with Gnome...................................................................................51
4 Command Line Quickstart ...........................................................................79
Part II Desktop Ubuntu
5 On the Internet...........................................................................................113
6 Productivity Applications ...........................................................................133
7 Multimedia Applications ............................................................................153
8 Printing with Ubuntu .................................................................................185
9 Games..........................................................................................................197

C Ubuntu and Linux Internet Resources .......................................................759
Index ............................................................................................................???
Table of Contents
Introduction 1
Part I Installation and Configuration
1 Installing Ubuntu 11
Before You Begin the Installation.................................................................11
Researching Your Hardware Specifications .........................................12
Installation Options.............................................................................12
Planning Partition Strategies ...............................................................12
The Boot Loader ..................................................................................13
Installing from CD or DVD .................................................................13
Step-by-Step Installation...............................................................................13
Starting the Install ...............................................................................14
First Update..........................................................................................20
Wubi—The Easy Installer for Windows ..............................................22
Shutting Down ....................................................................................24
Reference .......................................................................................................24
2 Post-Installation Configuration 25
Troubleshooting Post-Installation Configuration Problems ........................26
The sudo command ......................................................................................27
First Update...................................................................................................28
Configuring Software Repositories ...............................................................30
Installing Graphics Drivers ...........................................................................33
Changing Ubuntu’s Look and Feel...............................................................34
Changing the Desktop Background ....................................................34
Changing Colors..................................................................................35
Modifying System Fonts......................................................................36
Changing How Menus Look ...............................................................36
Visual Effects........................................................................................37

KDE—The Other Environment.....................................................................77
XFce...............................................................................................................78
Reference .......................................................................................................78
4 Command Line Quickstart 79
What Is the Command Line? .......................................................................79
Navigating Through the File System...................................................83
Managing Files with the Shell.............................................................85
Working with Compressed Files..........................................................86
Use Essential Commands from the /bin and /sbin Directories ..........87
Use and Edit Files in the /etc Directory ..............................................87
Protect the Contents of User Directories—/home ..............................87
Use the Contents of the /proc Directory to Interact
with the Kernel..................................................................................87
Work with Shared Data in the /usr Directory.....................................89
Temporary File Storage in the /tmp Directory....................................89
Access Variable Data Files in the /var Directory .................................89
Logging In to and Working with Linux .......................................................90
Text-based Console Login....................................................................90
Logging Out .........................................................................................90
Ubuntu Unleashed 2008 Edition
vi
Logging In and Out from a Remote Computer ..................................91
Using Environment Variables..............................................................92
Using the Text Editors ..................................................................................95
Working with vi...................................................................................96
Working with emacs ............................................................................97
Working with Permissions ............................................................................99
Assigning Permissions .......................................................................100
Directory Permissions........................................................................101
Understanding Set User ID and Set Group ID Permissions..............103

Contents
vii
Ubuntu Unleashed 2008 Edition
viii
Office Suites for Ubuntu .............................................................................144
Working with Gnome Office.............................................................146
Working with KOffice........................................................................149
Productivity Applications Written for Microsoft Windows.......................150
Reference .....................................................................................................152
7 Multimedia Applications 153
Sound and Music ........................................................................................153
Sound Cards.......................................................................................154
Adjusting Volume ..............................................................................155
Sound Formats ...................................................................................156
Listening to Music .............................................................................157
Graphics Manipulation...............................................................................163
The GNU Image Manipulation Program...........................................163
Using Scanners in Ubuntu ................................................................164
Working with Graphics Formats .......................................................166
Capturing Screen Images...................................................................168
Using Digital Cameras with Ubuntu ..........................................................168
Handheld Digital Cameras ................................................................168
Using F-Spot.......................................................................................169
Burning CDs and DVDs in Ubuntu............................................................170
Creating CDs and DVDs with Ubuntu’s Graphical Clients..............172
Creating CDs from the Command Line ...........................................174
Creating DVDs from the Command Line.........................................176
Viewing Video.............................................................................................178
TV and Video Hardware ....................................................................178
Video Formats....................................................................................180

User IDs and Group IDs ....................................................................212
File Permissions .................................................................................212
Managing Groups .......................................................................................213
Group Management Tools.................................................................214
Managing Users...........................................................................................216
User Management Tools ....................................................................216
Adding New Users .............................................................................218
Monitoring User Activity on the System ..........................................219
Managing Passwords ...................................................................................220
System Password Policy .....................................................................220
The Password File ..............................................................................220
Shadow Passwords .............................................................................221
Managing Password Security for Users..............................................223
Changing Passwords in a Batch ........................................................224
Granting System Administrator Privileges to Regular Users......................224
Temporarily Changing User Identity with the su Command ..........225
Granting Root Privileges on Occasion—The sudo Command .........227
Disk Quotas.................................................................................................229
Implementing Quotas .......................................................................230
Manually Configuring Quotas ..........................................................230
Reference .....................................................................................................232
Ubuntu Unleashed 2008 Edition
x
11 Automating Tasks 233
Running Services at Bootup........................................................................234
Beginning the Boot Loading Process..........................................................234
Loading the Linux Kernel..................................................................235
System Services and Runlevels ..........................................................236
Runlevel Definitions..........................................................................236
Booting into the Default Runlevel ....................................................237

Embedded Spaces ............................................................................264
Using Single Quotes to Maintain Unexpanded Variables ................265
Using the Backslash as an Escape Character.....................................266
Using the Backtick to Replace a String with Output ........................266
Comparison of Expressions in pdksh and bash................................267
Comparing Expressions with tcsh.....................................................272
The for Statement ..............................................................................276
The while Statement..........................................................................277
The until Statement...........................................................................279
The repeat Statement (tcsh) ..............................................................280
The select Statement (pdksh) ............................................................280
The shift Statement ...........................................................................281
The if Statement ................................................................................281
The case Statement ............................................................................283
The break and exit Statements..........................................................285
Using Functions in Shell Scripts........................................................285
Reference .....................................................................................................287
12 System-Monitoring Tools 289
Console-Based Monitoring .........................................................................289
Using the kill Command to Control Processes.................................291
Using Priority Scheduling and Control.............................................292
Displaying Free and Used Memory with free ...................................294
Disk Space ..........................................................................................295
Disk Quotas........................................................................................296
Graphical Process and System Management Tools ....................................296
KDE Process- and System-Monitoring Tools ..............................................298
Reference .....................................................................................................299
13 Backing Up 301
Choosing a Backup Strategy .......................................................................301
Why Data Loss Occurs.......................................................................302

Networking with TCP/IP.............................................................................328
TCP/IP Addressing .............................................................................329
Using IP Masquerading in Ubuntu ...................................................331
Ports ...................................................................................................332
Network Organization ................................................................................333
Subnetting..........................................................................................333
Subnet Masks .....................................................................................334
Broadcast, Unicast, and Multicast Addressing ..................................334
Hardware Devices for Networking..............................................................335
Network Interface Cards....................................................................335
Network Cable ...................................................................................337
Hubs and Switches.............................................................................338
Routers and Bridges ...........................................................................339
Initializing New Network Hardware..................................................339
Using Network Configuration Tools...........................................................342
Command-Line Network Interface Configuration ...........................342
Network Configuration Files .............................................................347
Using Graphical Configuration Tools ...............................................349
Dynamic Host Configuration Protocol ......................................................351
How DHCP Works .............................................................................351
Activating DHCP at Installation and Boot Time ..............................352
DHCP Software Installation and Configuration ...............................353
Using DHCP to Configure Network Hosts........................................354
Other Uses for DHCP.........................................................................357
Wireless Networking ...................................................................................357
Support for Wireless Networking in Ubuntu ....................................357
Advantages of Wireless Networking..................................................358
Choosing from Among Available Wireless Protocols .......................359
Ubuntu Unleashed 2008 Edition
xii

Starting the smbd Daemon ...............................................................390
Mounting Samba Shares....................................................................391
Configuring Samba Using SWAT.......................................................392
Network and Remote Printing with Ubuntu..............................................397
Creating Network Printers ..........................................................................397
Enabling Network Printing on a LAN ...............................................397
Session Message Block Printing.........................................................398
Using the Common UNIX Printing System GUI .......................................399
Creating a CUPS Printer Entry ..........................................................400
Contents
xiii
Avoiding Printer Support Problems............................................................403
All-in-One (Print/Fax/Scan) Devices .................................................403
Using USB and Legacy Printers .........................................................403
Reference .....................................................................................................405
17 Apache Web Server Management 407
About the Apache Web Server ....................................................................407
Installing the Apache Server.......................................................................409
Installing with APT............................................................................409
Building the Source Yourself .............................................................410
Starting and Stopping Apache ....................................................................413
Starting the Apache Server Manually................................................413
Using /etc/init.d/apache2..................................................................414
Runtime Server Configuration Settings......................................................416
Runtime Configuration Directives ....................................................416
Editing apache2.conf.........................................................................417
Apache Multiprocessing Modules .....................................................419
Using .htaccess Configuration Files ..................................................420
File System Authentication and Access Control ........................................422
Restricting Access with allow and deny............................................422

mod_vhost_alias ................................................................................431
Virtual Hosting............................................................................................432
Address-Based Virtual Hosts ..............................................................432
Name-Based Virtual Hosts .................................................................432
Logging........................................................................................................434
Other Web Servers for Use with Ubuntu....................................................435
Sun ONE Web Server .........................................................................436
Zope ...................................................................................................436
Zeus Web Server.................................................................................436
Reference .....................................................................................................437
18 Remote File Serving with FTP 439
Choosing an FTP Server..............................................................................439
Choosing an Authenticated or Anonymous Server ..........................440
Ubuntu FTP Server Packages .............................................................440
Other FTP Servers ..............................................................................440
Installing FTP Software ...............................................................................441
The FTP User ...............................................................................................442
inetd Configuration for wu-ftpd ................................................................444
Starting the Very Secure FTP Server (vsftpd) Package.......................445
Configuring the Very Secure FTP Server.....................................................445
Controlling Anonymous Access........................................................445
Other vsftpd Server Configuration Files ...........................................446
Configuring the Server ...............................................................................448
Using Commands in the ftpaccess File to Configure wu-ftpd...................448
Configure Access Control..................................................................449
Configure User Information..............................................................452
Configure System Logging ................................................................456
Configure Permission Control ..........................................................457
Configure Commands Directed Toward the cdpath.........................459
Structure of the shutdown File..........................................................460

Configuring Fetchmail ......................................................................480
Choosing a Mail Delivery Agent ................................................................483
Procmail .............................................................................................483
Spamassassin......................................................................................484
Squirrelmail........................................................................................484
Virus Scanners....................................................................................484
Mail Daemons .............................................................................................485
Alternatives to Microsoft Exchange Server.................................................485
Microsoft Exchange Server/Outlook Client ......................................486
CommuniGate Pro.............................................................................486
Oracle Collaboration Suite ................................................................486
Bynari.................................................................................................486
Open-Xchange ...................................................................................486
phpgroupware....................................................................................487
PHProjekt ...........................................................................................487
Horde .................................................................................................487
Reference .....................................................................................................488
Ubuntu Unleashed 2008 Edition
xvi
20 Proxying and Reverse Proxying 489
What Is a Proxy Server? ..............................................................................489
Installing Squid ...........................................................................................490
Configuring Clients ....................................................................................490
Access Control Lists ....................................................................................491
Specifying Client IP Addresses....................................................................495
Example Configurations .............................................................................496
Reference .....................................................................................................498
21 Administering Database Services 499
A Brief Review of Database Basics ..............................................................500
How Relational Databases Work .......................................................501

xvii
22 LDAP 525
Configuring the Server ...............................................................................526
Populating Your Directory.................................................................528
Configuring Clients ....................................................................................530
Evolution ...........................................................................................531
Thunderbird.......................................................................................532
Administration............................................................................................532
Reference .....................................................................................................533
Part V Programming Linux
23 Using Perl 537
Using Perl with Linux.................................................................................537
Perl Versions ......................................................................................538
A Simple Perl Program.......................................................................538
Perl Variables and Data Structures..............................................................540
Perl Variable Types.............................................................................540
Special Variables.................................................................................541
Operators.....................................................................................................542
Comparison Operators ......................................................................542
Compound Operators........................................................................543
Arithmetic Operators.........................................................................544
Other Operators.................................................................................544
Special String Constants....................................................................545
Conditional Statements: if/else and unless................................................545
if .........................................................................................................546
unless .................................................................................................546
Looping .......................................................................................................547
for.......................................................................................................547
foreach ...............................................................................................547
while ..................................................................................................548

Reference .....................................................................................................577
25 Writing PHP Scripts 579
Introduction to PHP ...................................................................................580
Entering and Exiting PHP Mode .......................................................580
Variables.............................................................................................580
Arrays .................................................................................................582
Constants ...........................................................................................584
References ..........................................................................................584
Comments .........................................................................................585
Escape Sequences ...............................................................................585
Variable Substitution .........................................................................587
Operators ...........................................................................................587
Conditional Statements.....................................................................589
Special Operators ...............................................................................591
Switching ...........................................................................................592
Loops..................................................................................................593
Including Other Files.........................................................................596
Basic Functions ...........................................................................................596
Strings ................................................................................................596
Arrays .................................................................................................600
Files ....................................................................................................602
Miscellaneous.....................................................................................604
Contents
xix
Handling HTML Forms ...............................................................................607
Databases.....................................................................................................608
Introduction to PEAR::DB .................................................................608
Reference .....................................................................................................610
26 C/C++ Programming Tools for Ubuntu 613
Programming in C with Linux ...................................................................613

Configuring and Using Tripwire .......................................................644
Devices ...............................................................................................645
Ubuntu Unleashed 2008 Edition
xx
Viruses .........................................................................................................645
Configuring Your Firewall...........................................................................646
Forming a Disaster Recovery Plan ..............................................................647
Keeping Up-to-Date on Linux Security Issues............................................648
Reference .....................................................................................................649
29 Performance Tuning 651
Hard Disk ....................................................................................................651
Using the BIOS and Kernel to Tune the Disk Drives ........................652
The hdparm Command.....................................................................653
File System Tuning ............................................................................654
The tune2fs Command......................................................................654
The e2fsck Command........................................................................655
The badblocks Command .................................................................655
Disabling File Access Time.................................................................655
Kernel ..........................................................................................................655
Apache.........................................................................................................656
MySQL.........................................................................................................658
Measuring Key Buffer Usage..............................................................658
Using the Query Cache .....................................................................660
Miscellaneous Tweaks........................................................................661
Query Optimization ..........................................................................661
Reference .....................................................................................................662
30 Command Line Masterclass 663
Why Use the Shell?.....................................................................................664
Basic Commands.........................................................................................665
Printing the Contents of a File with cat ...........................................666

Compiling Software from Source ...............................................................698
Reference .....................................................................................................699
32 Kernel and Module Management 701
The Linux Kernel ........................................................................................702
The Linux Source Tree .......................................................................702
Types of Kernels.................................................................................704
Managing Modules .....................................................................................706
When to Recompile ....................................................................................708
Kernel Versions ...........................................................................................708
Obtaining the Kernel Sources.....................................................................709
Patching the Kernel ....................................................................................710
Compiling the Kernel .................................................................................712
Using xconfig to Configure the Kernel.............................................717
Creating an Initial RAM Disk Image .................................................720
When Something Goes Wrong...................................................................721
Errors During Compile ......................................................................721
Runtime Errors, Boot Loader Problems, and Kernel Oops ...............722
Reference .....................................................................................................723
Part VII Appendixes
A Ubuntu Under the Hood 727
What Is Linux?............................................................................................727
Why Use Linux?..........................................................................................729
What Is Ubuntu?.........................................................................................730
Roots of Ubuntu ................................................................................730
Ubuntu Unleashed 2008 Edition
xxii
Ubuntu for Business....................................................................................731
Ubuntu in Your Home ................................................................................732
64-Bit Ubuntu .............................................................................................733
Ubuntu on the PPC Platform .....................................................................733

Documentation..................................................................................762
Linux Guides......................................................................................763
Ubuntu...............................................................................................763
Mini-CD Linux Distributions ............................................................763
Various Intel-Based Linux Distributions ...........................................764
Contents
xxiii
PowerPC-Based Linux Distributions..................................................764
Linux on Laptops and PDAs..............................................................765
The X Window System ......................................................................765
Usenet Newsgroups.....................................................................................765
Mailing Lists................................................................................................767
Ubuntu Project Mailing Lists.............................................................767
Internet Relay Chat.....................................................................................767
Index 769
Ubuntu Unleashed 2008 Edition
xxiv


Nhờ tải bản gốc
Music ♫

Copyright: Tài liệu đại học © DMCA.com Protection Status