1. Trang chủ
  2. » Công Nghệ Thông Tin

Tài liệu Ubuntu Unleashed pptx

856 623 1
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Ubuntu Unleashed 2008 Edition
Tác giả Andrew Hudson, Paul Hudson
Trường học Sams Publishing
Chuyên ngành Computer Science
Thể loại sách hướng dẫn
Năm xuất bản 2009
Thành phố Indianapolis
Định dạng
Số trang 856
Dung lượng 14,92 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Copying Files Using cp...318Copying Files Using mc...318 System Rescue ...319 The Ubuntu Rescue Disc...320 Backing Up and Restoring the Master Boot Record...320 Booting the System from a

Trang 2

U N L E A S H E D

800 East 96th Street, Indianapolis, Indiana 46240 USA

Andrew Hudson Paul Hudson

2008 Edition

Trang 3

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

First Printing July 2008

Trademarks

All terms mentioned in this book that are known to be trademarks or service marks

have been appropriately capitalized Sams Publishing cannot attest to the accuracy of

this information Use of a term in this book should not be regarded as affecting the

validity of any trademark or service mark.

Warning and Disclaimer

Every effort has been made to make this book as complete and as accurate as

possi-ble, but no warranty or fitness is implied The information provided is on an “as is”

basis The authors and the publisher shall have neither liability nor responsibility to any

person or entity with respect to any loss or damages arising from the information

contained in this book or from the use of the CD or programs accompanying it.

Bulk Sales

Sams Publishing offers excellent discounts on this book when ordered in quantity for

bulk purchases or special sales For more information, please contact:

U.S Corporate and Government Sales

Cover and InteriorDesignerGary AdairCompositionMark Shirar

Trang 4

Contents at a Glance

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

Part III System Administration 10 Managing Users 209

11 Automating Tasks 233

12 System-Monitoring Tools 289

13 Backing Up 301

14 Networking 325

15 Remote Access with SSH and Telnet 371

Part IV Ubuntu as a Server 16 File and Print 381

17 Apache Web Server Management 407

18 Remote File Serving with FTP 439

19 Handling Electronic Mail 471

20 Proxying and Reverse Proxying 489

21 Administering Database Services 499

22 LDAP 525

Trang 5

24 Working with Python 561

25 Writing PHP Scripts 579

26 C/C++ Programming Tools for Ubuntu 613

27 Mono 625

Part VI Ubuntu Housekeeping 28 Securing Your Machines 639

29 Performance Tuning 651

30 Command Line Masterclass 663

31 Managing Software 689

32 Kernel and Module Management 701

Part VII Appendixes A Ubuntu Under the Hood 727

B Installation Resources 737

C Ubuntu and Linux Internet Resources 759

Index ???

Trang 6

Table of Contents

Part I Installation and Configuration

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

Preferred Behaviors 37

Preferred Applications 37

Removable Drives and Media 39

Input Devices 39

Keyboard Shortcuts 40

Keyboard Layout 40

Mouse 41

Detecting and Configuring a Modem 42

Configuring a Serial-Port Modem 42

Configuring WinModems for Laptops 42

Trang 7

Configuring Power Management in Ubuntu 43

Setting the Date and Time 44

Using the date Command 45

Using the hwclock Command 45

Changing the Time and Date 46

Configuring and Using CD, DVD, and CD-RW Drives 46

Checking Drive Assignment 47

Configuring Wireless Networks 48

Reference 49

3 Working with Gnome 51 The Gnome Desktop Environment 52

Gnome: The GNU Network Object Model Environment 52

Eye Candy for the Masses 54

Basic X Concepts 55

Using X 56

Elements of the xorg.conf File 57

Configuring X 62

Starting X 64

Using a Display Manager 65

Changing Window Managers 73

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

Trang 8

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

Working as Root 104

Creating Users 105

Deleting Users 106

Shutting Down the System 106

Rebooting the System 107

Reading Documentation 108

Using Man Pages 108

Reference 110

Part II Desktop Ubuntu 5 On the Internet 113 Getting Started with Firefox 114

Choosing an Email Client 115

Evolution 116

Mozilla Thunderbird 118

KMail 120

Other Mail Clients 120

RSS Readers 120

Firefox 122

Liferea 122

Instant Messaging with Pidgin 123

Internet Relay Chat 124

Usenet Network Newsgroups 127

The Pan News Client Newsreader 128

Videoconferencing with Ekiga 130

Reference 132

6 Productivity Applications 133 Introducing OpenOffice.org 134

Configuring OpenOffice.org 136

Working with OpenOffice.org Writer 137

Working with OpenOffice.org Calc 140

Contents

Trang 9

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

Viewing Video in Linux 181

Personal Video Recorders 181

DVD and Video Players 182

Reference 182

8 Printing with Ubuntu 185 Overview of Ubuntu Printing 185

Configuring and Managing Print Services 187

GUI-Based Printer Configuration Quickstart 187

Managing Printing Services 188

Creating and Configuring Local Printers 189

Creating the Print Queue 190

Editing Printer Settings 192

Reference 195

Trang 10

Linux Gaming 197

Installing Proprietary Video Drivers 198

Installing Games in Ubuntu 199

DOOM 3 200

Unreal Tournament 2004 201

Quake 4 202

Wolfenstein: Enemy Territory 203

Battle for Wesnoth 204

Playing Windows Games with Cedega 204

Reference 205

Part III System Administration 10 Managing Users 209 User Accounts 209

The Super User/Root User 210

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

Trang 11

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

Booting to a Non-Default Runlevel with GRUB 237

Understanding init Scripts and the Final Stage of Initialization 238

Controlling Services at Boot with Administrative Tools 239

Changing Runlevels 240

Troubleshooting Runlevel Problems 240

Starting and Stopping Services Manually 241

Scheduling Tasks 242

Using at and batch to Schedule Tasks for Later 242

Using cron to Run Jobs Repeatedly 245

Basic Shell Control 248

The Shell Command Line 248

Shell Pattern-Matching Support 250

Redirecting Input and Output 251

Piping Data 252

Background Processing 252

Writing and Executing a Shell Script 253

Running the New Shell Program 254

Storing Shell Scripts for Systemwide Access 255

Interpreting Shell Scripts Through Specific Shells 256

Using Variables in Shell Scripts 258

Assigning a Value to a Variable 258

Accessing Variable Values 259

Positional Parameters 259

A Simple Example of a Positional Parameter 259

Using Positional Parameters to Access and Retrieve Variables from the Command Line 260

Using a Simple Script to Automate Tasks 261

Built-In Variables 263

Special Characters 263

Use Double Quotes to Resolve Variables in Strings with 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

Trang 12

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

Assessing Your Backup Needs and Resources 303

Evaluating Backup Strategies 304

Making the Choice 307

Choosing Backup Hardware and Media 307

Removable Storage Media 308

Network Storage 309

Tape Drive Backup 309

Using Backup Software 310

tar: The Most Basic Backup Tool 310

The GNOME File Roller 312

Using the Amanda Backup Application 315

Alternative Backup Software 316

Copying Files 316

Copying Files Using tar 317

Compressing, Encrypting, and Sending tar Streams 317

Contents

Trang 13

Copying Files Using cp 318

Copying Files Using mc 318

System Rescue 319

The Ubuntu Rescue Disc 320

Backing Up and Restoring the Master Boot Record 320

Booting the System from a Generic Boot Floppy 320

Using a GRUB Boot Floppy 321

Using the Recovery Facility 322

Reference 322

14 Networking 325 Laying the Foundation: The localhost Interface 326

Checking for the Availability of the Loopback Interface 326

Configuring the Loopback Interface Manually 326

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

Trang 14

Beyond the Network and onto the Internet 360

Common Configuration Information 360

Configuring Digital Subscriber Line Access 362

Understanding Point-to-Point Protocol over Ethernet 363

Configuring a PPPoE Connection Manually 363

Configuring Dial-Up Internet Access 365

Configuring a Dial-Up Connection Manually 365

Troubleshooting Connection Problems 368

Reference 369

15 Remote Access with SSH and Telnet 371 Setting Up a Telnet Server 371

Telnet Versus SSH 372

Setting Up an SSH Server 372

The SSH Tools 373

Using scp to Copy Individual Files Between Machines 374

Using sftp to Copy Many Files Between Machines 374

Using ssh-keygen to Enable Key-based Logins 375

Remote X 377

XDMCP 377

VNC 378

Reference 378

Part IV Ubuntu as a Server 16 File and Print 381 Using the Network File System 382

Installing and Starting or Stopping NFS 382

NFS Server Configuration 383

NFS Client Configuration 384

Putting Samba to Work 385

Manually Configuring Samba with /etc/samba/smb.conf 387

Testing Samba with the testparm Command 390

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

Trang 15

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

Authentication 423

Final Words on Access Control 425

Apache Modules 426

mod_access 427

mod_alias 427

mod_asis 427

mod_auth 428

mod_auth_anon 428

mod_auth_dbm 428

mod_auth_digest 428

mod_autoindex 429

mod_cgi 429

mod_dir and mod_env 429

mod_expires 429

mod_headers 429

mod_include 429

mod_info and mod_log_config 430

mod_mime and mod_mime_magic 430

mod_negotiation 430

mod_proxy 430

mod_rewrite 430

mod_setenvif 430

Trang 16

mod_status 431

mod_ssl 431

mod_unique_id 431

mod_userdir 431

mod_usertrack 431

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 FTP Server File-Conversion Actions 460

Strip Prefix 461

Strip Postfix 461

Add-On Prefix 461

Add-On Postfix 461

Contents

Trang 17

External Command 461

An Example of Conversions in Action 462

Using the ftphosts File to Allow or Deny FTP Server Connection 463

Using Commands for Server Administration 464

Display Information About Connected Users 464

Count the Number of Connections 465

Use /usr/sbin/ftpshut to Schedule FTP Server Downtime 466

Use /var/log/xferlog to View a Log of Server Transactions 467

Reference 470

19 Handling Electronic Mail 471 How Email Is Sent and Received 471

The Mail Transport Agent 472

Choosing an MTA 474

The Mail Delivery Agent 474

The Mail User Agent 475

Basic Postfix Configuration and Operation 476

Configuring Masquerading 477

Using Smart Hosts 477

Setting Message Delivery Intervals 477

Mail Relaying 478

Forwarding Email with Aliases 478

Using Fetchmail to Retrieve Mail 479

Installing Fetchmail 479

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

Trang 18

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

Understanding SQL Basics 503

Creating Tables 503

Inserting Data into Tables 504

Retrieving Data from a Database 505

Choosing a Database: MySQL Versus PostgreSQL 507

Speed 507

Data Locking 508

ACID Compliance in Transaction Processing to Protect Data Integrity 509

SQL Subqueries 509

Procedural Languages and Triggers 510

Configuring MySQL 510

Setting a Password for the MySQL Root User 511

Creating a Database in MySQL 511

Granting and Revoking Privileges in MySQL 512

Configuring PostgreSQL 513

Initializing the Data Directory in PostgreSQL 514

Creating a Database in PostgreSQL 515

Creating Database Users in PostgreSQL 516

Deleting Database Users in PostgreSQL 517

Granting and Revoking Privileges in PostgreSQL 517

Database Clients 518

SSH Access to a Database 518

Local GUI Client Access to a Database 520

Web Access to a Database 520

The MySQL Command-Line Client 521

The PostgreSQL Command-Line Client 523

Graphical Clients 523

Reference 524

Contents

Trang 19

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

until 548

last and next 548

do while and do until 549

Regular Expressions 549

Access to the Shell 550

Modules and CPAN 551

Code Examples 552

Sending Mail 552

Purging Logs 554

Posting to Usenet 555

Trang 20

One-Liners 556

Command-Line Processing 556

Reference 557

24 Working with Python 561 Python on Linux 561

Getting Interactive 562

The Basics of Python 563

Numbers 563

More on Strings 564

Lists 567

Dictionaries 569

Conditionals and Looping 570

Functions 572

Object Orientation 573

Class and Object Variables 574

Constructors and Destructors 575

Class Inheritance 575

The Standard Library and the Vaults of Parnassus 577

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

Trang 21

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

Using the C Programming Project Management Tools Provided with Ubuntu 614

Building Programs with make 615

Using Makefiles 615

Using the autoconf Utility to Configure Code 617

Managing Software Projects with Subversion 617

Debugging Tools 618

Using the GNU C Compiler 619

Graphical Development Tools 620

Using the KDevelop Client 620

The Glade Client for Developing in GNOME 621

Reference 623

27 Mono 625 Why Use Mono? 625

Mono on the Command Line 626

The Structure of a C# Program 628

Printing Out the Parameters 629

Creating Your Own Variables 629

Adding Some Error Checking 630

Building on Mono’s Libraries 631

Searching with Beagle 631

Creating a GUI with Gtk# 634

Reference 636

Part VI Ubuntu Housekeeping 28 Securing Your Machines 639 Understanding Computer Attacks 639

Assessing Your Vulnerability 641

Protecting Your Machine 642

Securing a Wireless Network 642

Passwords and Physical Security 643

Configuring and Using Tripwire 644

Devices 645

Trang 22

Viruses 645Configuring Your Firewall 646Forming a Disaster Recovery Plan 647Keeping Up-to-Date on Linux Security Issues 648Reference 649

Hard Disk 651Using the BIOS and Kernel to Tune the Disk Drives 652The hdparm Command 653File System Tuning 654The tune2fs Command 654The e2fsck Command 655The badblocks Command 655Disabling File Access Time 655Kernel 655Apache 656MySQL 658Measuring Key Buffer Usage 658Using the Query Cache 660Miscellaneous Tweaks 661Query Optimization 661Reference 662

Why Use the Shell? 664Basic Commands 665Printing the Contents of a File with cat 666Changing Directories with cd 667Changing File Access Permissions with chmod 668Copying Files with cp 669Printing Disk Usage with du 669Finding Files by Searching with find 670Searches for a String in Input with grep 673Paging Through Output with less 674Creating Links Between Files with ln 676Finding Files from an Index with locate 677Listing Files in the Current Directory with ls 678Reading Manual Pages with man 679Making Directories with mkdir 680Moving Files with mv 680Listing Processes with ps 680

Contents

Trang 23

Deleting Files and Directories with rm 681Printing the Last Lines of a File with tail 682Printing Resource Usage with top 682Printing the Location of a Command with which 684Combining Commands 684Multiple Terminals 686Reference 687

Using Add/Remove Applications for Software Management 689Using Synaptic for Software Management 691Staying Up-to-Date 693Working on the Command Line 694Day-to-Day Usage 694Finding Software 697Compiling Software from Source 698Reference 699

The Linux Kernel 702The Linux Source Tree 702Types of Kernels 704Managing Modules 706When to Recompile 708Kernel Versions 708Obtaining the Kernel Sources 709Patching the Kernel 710Compiling the Kernel 712Using xconfig to Configure the Kernel 717Creating an Initial RAM Disk Image 720When Something Goes Wrong 721Errors During Compile 721Runtime Errors, Boot Loader Problems, and Kernel Oops 722Reference 723Part VII Appendixes

What Is Linux? 727Why Use Linux? 729What Is Ubuntu? 730Roots of Ubuntu 730

Trang 24

Ubuntu for Business 731Ubuntu in Your Home 73264-Bit Ubuntu 733Ubuntu on the PPC Platform 733Getting the Most from Ubuntu and Linux Documentation 733Ubuntu Developers and Documentation 735Reference 735

Planning Your Ubuntu Deployment 738Business Considerations 738System Considerations 741User Considerations 742

A Predeployment Planning Checklist 742Planning the Installation 742Hardware Requirements 743Meeting the Minimum Ubuntu Hardware Requirements 743Using Legacy Hardware 744Planning for Hard Drive Storage for Your Ubuntu Installation 744Checking Hardware Compatibility 745Preparing for Potential Hardware Problems 746Preparing and Using a Hardware Inventory 749Preparing for the Install Process 750Preparing to Install from a CD-ROM 753Partitioning Before and During Installation 754Choosing a Partitioning Scheme 756Hosting Parts of the Linux File System on Separate Partitions 756Reference 757

Websites and Search Engines 760Web Search Tips 760Google Is Your Friend 761Ubuntu Package Listings 761Certification 761Commercial Support 762Documentation 762Linux Guides 763Ubuntu 763Mini-CD Linux Distributions 763Various Intel-Based Linux Distributions 764

Contents

Trang 25

PowerPC-Based Linux Distributions 764Linux on Laptops and PDAs 765The X Window System 765Usenet Newsgroups 765Mailing Lists 767Ubuntu Project Mailing Lists 767Internet Relay Chat 767

Trang 26

About the Authors

Andrew Hudson is a freelance journalist who specializes in writing about Linux He has

significant experience in Red Hat and Debian-based Linux distributions and deploymentsand can often be found sitting at his keyboard tweaking various settings and config filesjust for the hell of it He lives in Wiltshire, which is a county of England, along with hiswife, Bernice, and their son, John Andrew does not like Emacs He can be reached atandy.hudson@gmail.com

Paul Hudson is a recognized expert in open-source technologies He is also a professional

developer and full-time journalist for Future Publishing His articles have appeared in Mac Format, PC Answers, PC Format, PC Plus, and Linux Format Paul is passionate about free

software in all its forms and uses a mix of Linux and BSD to power his desktops andservers Paul likes Emacs Paul can be contacted through http://hudzilla.org

Trang 27

—Andrew Hudson

To World Peace—because this is about as close as I’m ever going to

get to being in the Miss World competition.

—Andrew HudsonThanks to Andrew, Shelley, Damon, Seth, Dallas, Mum and Dad, my wife, Ildiko; and, ofcourse, God, who made all this possible No book this big could be done without a lot ofwork from a dedicated team!

—Paul Hudson

Trang 28

We Want to Hear from You!

As the reader of this book, you are our most important critic and commentator We value

your opinion and want to know what we’re doing right, what we could do better, whatareas you’d like to see us publish in, and any other words of wisdom you’re willing topass our way

You can email or write me directly to let me know what you did or didn’t like about thisbook—as well as what we can do to make our books stronger

Please note that I cannot help you with technical problems related to the topic of this book, and that due to the high volume of mail I receive, I might not be able to reply to every message.

When you write, please be sure to include this book’s title and author as well as yourname and phone or email address I will carefully review your comments and share themwith the author and editors who worked on the book

Email: opensource@samspublishing.com

Associate PublisherSams Publishing

800 East 96th StreetIndianapolis, IN 46240 USAReader Services

Visit our website and register this book at informit.com/register for convenient access toany updates, downloads, or errata that might be available for this book

Trang 30

Welcome to Ubuntu Unleashed, 2008 Edition! This book

covers the free Linux distribution named Ubuntu andincludes a fully functional and complete operating systemproduced by the Ubuntu Community, sponsored byCanonical Software This book covers Ubuntu version 8.04LTS, commonly known as the Hardy Heron

Ubuntu directly descends from one of the oldest and mostrevered Linux distributions ever: Debian Those of you whoknow nothing about Linux will likely not have heard ofDebian; it is enough to know that it is considered to beone of the most stable and secure Linux distributionscurrently available Ubuntu benefits directly from manycontributions from free software developers across theworld

If you are new to Linux, you have made a great decision by

choosing this book Sams Publishing’s Unleashed books offer

an in-depth look at their subject, taking in both beginnerand advanced users and moving them to a new level ofknowledge and expertise Ubuntu is a fast-changing distrib-ution that can be updated at least twice a year We havetracked the development of Ubuntu from early on to makesure that the information in this book mirrors closely thedevelopment of the distribution A full copy of Ubuntu isincluded on the enclosed disc, making it possible for you toinstall Linux in less than an hour! No longer an upstart,Linux now has an enviable position in today’s moderncomputing world It can be found on machines as diverse asmobile phones and wristwatches, all the way up to super-computers—in fact, Linux currently runs on more than half

of the world’s top 500 supercomputers

Trang 31

Do not let the reputation of Linux discourage you, however Most people who have heard

of Linux think that it is found only on servers, looking after websites and email Nothingcould be further from the truth because Linux is making huge inroads in to the desktopmarket, too Corporations are realizing the benefits of running a stable and powerful oper-ating system that is easy to maintain and easy to secure Add to that the hundreds ofimprovements in usability, and Linux becomes an attractive proposition that tempts manyCIOs The best part is that as large Linux vendors improve Linux, the majority of thoseimprovements make it into freely available distributions, allowing you to benefit from theadditions and refinements made You can put Ubuntu to work today and be assured of agreat user experience

This book provides all the information that you need to get up and running with Ubuntu

It even tells you how to keep Ubuntu running in top shape and how to adapt Ubuntu tochanges in your own needs You can use Ubuntu at home, in the workplace, or, withpermission, at your school or college In fact, you might want to poke around yourschool’s computer rooms: You will probably find that someone has already beaten you tothe punch—Linux is commonly found in academic institutions Feel free to make as manycopies of the software as you want; because Ubuntu is freely distributable all over theworld, no copyright lawyers are going to pound on your door

After an introduction to Linux and Ubuntu, you will find out how to get started withUbuntu, including installation and initial configuration We also take you through

installing software, managing users, and other common administrative tasks For the moretechnically minded, we also cover some starting steps in programming across severallanguages—why not pick one and try it out? Throughout this book, you will also findinformation about multimedia applications, digital graphics, and even gaming (for after-hours when you are finished tinkering) After you make it through this book, you will bewell equipped with the knowledge needed to use Linux successfully We do assume thatyou are at least familiar with an operating system already (even if it is not with Linux) andhave some basic computer knowledge

Licensing

Software licensing is an important issue for all computer users and can entail moral, legal,and financial considerations Many consumers think that purchasing a copy of a commer-cial or proprietary operating system, productivity application, utility, or game conveys

ownership, but this is not true In the majority of cases, the end user license agreement (EULA) included with a commercial software package states that you have paid only for

the right to use the software according to specific terms This generally means you maynot examine, make copies, share, resell, or transfer ownership of the software package.More onerous software licenses enforce terms that preclude you from distributing orpublishing comparative performance reviews of the software Even more insidious licens-ing schemes (and supporting legislation, especially in the United States) contain provi-sions allowing onsite auditing of the software’s use!

Trang 32

What This Book Contains

This is not the case with the software included with this book You are entirely free tomake copies, share them with friends, and install the software on as many computers asyou want—we encourage you to purchase additional copies of this book to give as gifts,however Be sure to read the README file on the disc included with this book for impor-tant information regarding the included software and disk contents After you installUbuntu, go to http://www.gnu.org/licenses/gpl.html to find a copy of the GNU GPL Youwill see that the GPL provides unrestricted freedom to use, duplicate, share, study, modify,improve, and even sell the software

You can put your copy of Ubuntu to work right away in your home or at your place ofbusiness without worrying about software licensing, per-seat workstation or client licenses,software auditing, royalty payments, or any other type of payments to third parties.However, be aware that although much of the software included with Ubuntu is licensedunder the GPL, some packages on this book’s disc are licensed under other terms There is

a variety of related software licenses, and many software packages fall under a broad

defin-ition known as open source Some of these include the Artistic License, the BSD License, the

Mozilla Public License, and the Q Public License

For additional information about the various GNU software licenses, browse to http://www.gnu.org/ For a definition of open-source and licensing guidelines, along with links to theterms of nearly three dozen open-source licenses, browse to http://www.opensource.org/

Who This Book Is For

This book is for anyone searching for guidance on using Ubuntu and primarily focuses onIntel-based PC platforms Although the contents are aimed at intermediate to advancedusers, even new users with a bit of computer savvy will benefit from the advice, tips,tricks, traps, and techniques presented in each chapter Pointers to more detailed orrelated information are also provided at the end of each chapter

If you are new to Linux, you might need to learn some new computer skills, such as how

to research your computer’s hardware, how to partition a hard drive, and (occasionally)how to use a command line This book helps you learn these skills and shows you how tolearn more about your computer, Linux, and the software included with Ubuntu Systemadministrators with experience using other operating systems can use the information in

this book to install, set up, and run common Linux software services, such as the Network File System (NFS), a File Transfer Protocol (FTP) server, and a web server (using Apache,

among others)

What This Book Contains

Ubuntu Unleashed is organized into seven parts, covering installation and configuration,

Ubuntu on the desktop, system administration, programming and housekeeping, and areference section A disc containing the entire distribution is included so that you haveeverything you need to get started This book starts by covering the initial and essentialtasks required to get Ubuntu installed and running on a target system

Trang 33

If you are new to Linux, and more specifically Ubuntu, first read the chapters in Part I,

“Installation and Configuration.” You will get valuable information on the following:

Detailed steps that walk you through installation

Critical advice on key configuration steps to fully install and configure Linux towork with your system’s subsystems or peripherals, such as pointers, keyboards,modems, USB devices and power management

Initial steps needed by new users transitioning from other computing environments

Working with GNOME, the default desktop environment for Ubuntu

Part II, “Desktop Ubuntu,” is aimed at users who want to get productive with Ubuntu andcovers the following:

Discovering the many productivity applications that come with Ubuntu

Surfing the Internet and working with email and newsgroups

Using Ubuntu to listen to music and watch video

Using Ubuntu to download and manipulate images from digital cameras

Setting up local printers for Ubuntu

Understanding the current state of gaming for Linux

Moving beyond the productivity and desktop areas of Ubuntu, Part III, “System

Administration,” covers the following:

Managing users and groups

Automating tasks and using shell scripts

Monitoring system resources and availability

Backup strategies and software

Network connectivity, including sharing folders and securing the network

Internet connectivity via dial-up and broadband connections

Part IV, “Ubuntu as a Server” gives you the information you need to start building yourown file, web and other servers for use in your home or office

Building and deploying web servers

Database creation, management, and manipulation

File and print servers

Using FTP for serving files across the Internet and local networks

Building and deploying email servers using Postfix and managing mailing lists

Creating remote access gateways and services

Trang 34

Conventions Used in This Book

Configuring DNS for your network

Using LDAP for storing information on users and security

Part V, “Programming Linux,” provides a great introduction to how you can extendUbuntu capabilities even further using the development tools supplied with it This partcovers the following:

Programming in Perl, using variables and scripting

An introduction to the Python language

Writing PHP scripts and linking them to databases

C and C++ programming tools available with Ubuntu and how to use the GNU CCompiler(gcc)

Part VI, “Ubuntu Housekeeping,” looks at some of the more advanced skills you need tokeep your system running in perfect condition, including the following:

Securing your machine against attack from outsiders and viruses

Performance tuning

Command-line masterclass

Advanced apt

Kernel and module management and compilation

An extensive reference in Part VII, “Appendixes,” gives you scope to explore in even moredepth some of the topics covered in this book as well as providing historical context toUbuntu and installation resources

Conventions Used in This Book

A lot of documentation is included with every Linux distribution, and Ubuntu is certainly

no exception Although the intent of Ubuntu Unleashed is to be as complete as possible, it

is impossible to cover every option of every command included in the distribution.However, this book offers numerous tables of various options, commands, and keystrokes

to help condense, organize, and present information about a variety of subjects

This edition is also packed full of screenshots to illustrate nearly all Ubuntu-specific ical utilities—especially those related to system administration or the configuration andadministration of various system and network services

Trang 35

graph-To help you better understand code listing examples and sample command lines, severalformatting techniques are used to show input and ownership For example, if the

command or code listing example shows typed input, the input is formatted in boldface,

as follows:

$ ls

If typed input is required, as in response to a prompt, the sample typed input also is inboldface, like so:

Delete files? [Y/n] y

All statements, variables, and text that should appear on your display use the same face formatting In addition, command lines that require root or super user access are pref-aced with the sudocommand, as follows:

bold-$ sudo printtool &

Command-line examples that any user can run are prefaced with a dollar sign ($), like so:

work-TIP

A tip can contain special insight or a timesaving technique, as well as information

about items of particular interest to you that you might not find elsewhere

CAUTION

A caution warns you about pitfalls or problems before you run a command, edit a figuration file, or choose a setting when administering your system

Trang 36

con-Sidebars Can Be Goldmines

Just because it is in a sidebar does not mean that you will not find something new

here Be sure to watch for these elements that bring in outside content that is an

aside to the discussion in the text You will read about other technologies, Linux-basedhardware, and special procedures to make your system more robust and efficient

Other formatting techniques used to increase readability include the use of italics forplaceholders in computer command syntax Computer terms or concepts are also itali-cized upon first introduction in text

Finally, you should know that all text, sample code, and screenshots in Ubuntu Unleashed

were developed using Ubuntu and open-source tools

Read on to start learning about and using the latest version of Ubuntu Experienced userswill want to consider the new information in this edition when planning or consideringupgrades There are many different Linux distributions from different vendors, but manyderive from, or closely mimic, the Debian distribution

Conventions Used in This Book

Trang 38

PART I

Installation and

Configuration

IN THIS PART

Trang 40

CHAPTER 1

Installing Ubuntu

IN THIS CHAPTER Before You Begin theInstallation

Step-by-Step Installation

Reference

Not that long ago, the mere mention of installing Linux

struck fear into the hearts of mortal men Thanks to a

campaign of fear, uncertainty, and doubt (commonly

referred to as FUD), Linux garnered a reputation as

some-thing of an elitist operating system, only configurable by

those in the know Nowadays, it is a different story entirely,

and Ubuntu is one of the easiest distros to install In this

chapter, we cover how to get started with the install disc,

including booting into Ubuntu Live CD to test your system

Then we cover the actual installation of Ubuntu, looking at

the various options available The whole process is fairly

pain-free under Ubuntu, as you are about to learn

Before You Begin the Installation

Installing a new operating system is a major event, and you

should make sure that you have properly thought through

what is going to take place The first thing to consider is

how the hardware will be affected by the software that you

propose to install Although Ubuntu will run well on an

extremely wide variety of hardware, it is worthwhile

check-ing your hardware components out because there may be a

banana skin waiting for you to slip up on The following

sections provide some areas for you to investigate and think

about, and may even save you hours of frustration when

something goes wrong The sections are designed to

complement the ideas and checklists presented in Appendix

B, “Installation Resources.”

You start by researching and documenting your hardware

This information will prove helpful later on during the

installation

Ngày đăng: 10/12/2013, 14:15

TỪ KHÓA LIÊN QUAN

w