• Aucun résultat trouvé

, SUSE , Ubuntu , and 7 Other Distributions Boot Up to Fedora , KNOPPIX, Debian Linux Bible

N/A
N/A
Protected

Academic year: 2022

Partager ", SUSE , Ubuntu , and 7 Other Distributions Boot Up to Fedora , KNOPPIX, Debian Linux Bible"

Copied!
912
0
0

Texte intégral

(1)
(2)

Linux

®

Bible

2006 Edition

Boot Up to Fedora , KNOPPIX, Debian ® , SUSE , Ubuntu , and

7 Other Distributions

Christopher Negus

(3)

Linux

®

Bible

2006 Edition

(4)
(5)

Linux

®

Bible

2006 Edition

Boot Up to Fedora , KNOPPIX, Debian ® , SUSE , Ubuntu , and

7 Other Distributions

Christopher Negus

(6)

Published by

Wiley Publishing, Inc.

10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com

Copyright © 2006 by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada

ISBN-13: 978-0-471-75489-3 ISBN-10: 0-471-75489-7

Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1

1O/RS/QR/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

http://www.wiley.com/go/permissions.

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 Negus, Chris, 1957–

Linux bible / Christopher Negus.—2006 ed.

p. cm.

Includes index.

ISBN-13: 978-0-471-75489-3 (paper/dvd) ISBN-10: 0-471-75489-7 (paper/dvd)

1. Linux. 2. Operating systems (Computers) I. Title.

QA76.76.O63N42143 2006 005.4'32—dc22

2005032276

Trademarks:Wiley and related trade dress are registered trademarks of Wiley Publishing, Inc., in the United States and other countries, and may not be used without written permission. Linux is a registered trademark of Linus Torvalds.

Fedora is a trademark of Red Hat, Inc. Debian is a registered trademark of Software in the Public Interest, Inc. SUSE is a trademark of Novell, Inc. Ubuntu is a trademark of Canonical Limited Company. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book.

Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books.

(7)

About the Author

Chris Negushas written or co-written dozens of books on Linux and UNIX, includ- ing Red Hat Linux Bible (all editions), Linux Troubleshooting Bible, and the recent Linux Toys II. For eight years he worked with the organization at AT&T that devel- oped UNIX before moving to Utah to help contribute to Novell’s short-lived UnixWare project in the early 1990s. When not writing about Linux, Chris enjoys playing soc- cer and just hanging out with his family.

About the Contributing Authors

Wayne Tuckeris a Linux enthusiast and has been a professional system administra- tor for six years. He is currently a technical manager, systems administrator, and net- work engineer at an Internet company in Washington state. He lives in Bellingham, Washington, with his beloved wife, Danielle, whom he would like to thank for her patience while he was working on this project. His future projects include continuing his education and working on the things that have recently accumulated on his

“honey-do” list.

Kurt Wallis a professional technical writer by trade and a historian by training.

These days, Kurt works for TimeSys Corporation in Pittsburgh, Pennsylvania. His primary responsibility is managing TimeSys’s Content Group. In addition to over- seeing production of the technical and end-user documentation of TimeSys’s embedded Linux operating system and development tools, he writes most of the documentation for TimeSys’s embedded Linux products and all of the content available on the TimeSys Network. Kurt has written or co-written 15 books on Linux system administration and programming topics and contributes the occa- sional product review to LinuxPlanet. In his spare time, he has no spare time.

Kurt, who dislikes writing about himself in the third person, receives entirely too much e-mail at [email protected].

(8)

Credits

Executive Editor Carol Long

Acquisitions Editor Debra Williams Cauley Development Editor Sara Shlaer

Technical Editors Kurt Wall

Wayne Tucker Bill von Hagen John Kennedy Dilip Thomas Copy Editor Nancy Rapoport Editorial Manager Mary Beth Wakefield Production Manager Tim Tate

Vice President and Executive Group Publisher

Richard Swadley

Vice President and Executive Publisher

Joseph B. Wikert Project Coordinator Michael Kruzil

Graphics and Production Specialists Denny Hager

Joyce Haughey Heather Ryan Alicia B. South Erin Zeltner

Quality Control Technicians John Greenough

Joe Niesen Brian H. Walls

Media Development Associate Producer

Rich Graves

Media Development Specialist Kate Jenkins

Media Development Coordinator Laura Atkinson

Proofreading and Indexing TECHBOOKS Production Services

(9)

As always, I dedicate this book to my wife, Sheree.

(10)

Contents at a Glance

Acknowledgments . . . xxv

Introduction . . . xxvii

Part I: Linux First Steps. . . 1

Chapter 1: Starting with Linux. . . 3

Chapter 2: Running Commands from the Shell. . . 29

Chapter 3: Getting into the Desktop. . . 77

Part II: Running the Show . . . 123

Chapter 4: Learning Basic Administration . . . 125

Chapter 5: Getting on the Internet . . . 173

Chapter 6: Securing Linux . . . 195

Part III: Choosing and Installing a Linux Distribution . . . 241

Chapter 7: Installing Linux . . . 243

Chapter 8: Running Fedora Core and Red Hat Enterprise Linux . . . 275

Chapter 9: Running Debian GNU/Linux . . . 299

Chapter 10: Running SUSE Linux . . . 325

Chapter 11: Running KNOPPIX . . . 341

Chapter 12: Running Yellow Dog Linux . . . 363

Chapter 13: Running Gentoo Linux. . . 383

Chapter 14: Running Slackware Linux . . . 399

Chapter 15: Running Linspire . . . 415

Chapter 16: Running Mandriva . . . 425

Chapter 17: Running Ubuntu Linux . . . 441

Chapter 18: Running a Linux Firewall/Router . . . 459

Chapter 19: Running Bootable Linux Distributions . . . 485

Part IV: Running Applications . . . 503

Chapter 20: Playing Music and Video . . . 505

Chapter 21: Working with Words and Images . . . 545

Chapter 22: E-Mailing and Web Browsing . . . 585

Chapter 23: Gaming with Linux . . . 619

(11)

Part V: Running Servers . . . 645

Chapter 24: Running a Linux, Apache, MySQL, and PHP (LAMP) Server . . . 647

Chapter 25: Running a Mail Server . . . 673

Chapter 26: Running a Print Server . . . 691

Chapter 27: Running a File Server . . . 715

Part VI: Programming in Linux . . . 751

Chapter 28: Programming Environments and Interfaces . . . 753

Chapter 29: Programming Tools and Utilities. . . 785

Appendix A: Media . . . 817

Appendix B: Entering the Linux Community . . . 825

Index . . . 831

GNU General Public License . . . 873

(12)
(13)

Contents

Acknowledgments . . . xxv

Introduction . . . xxvii

Part I: Linux First Steps 1 Chapter 1: Starting with Linux . . . 3

Understanding Linux. . . 5

Exploring Linux History . . . 7

From a Free-Flowing UNIX Culture at Bell Labs . . . 8

To a Commercialized UNIX . . . 10

To a GNU Free-Flowing (not) UNIX . . . 12

BSD Loses Some Steam . . . 13

Linus Builds the Missing Piece . . . 14

What’s So Great About Linux? . . . 15

Features in Linux . . . 15

OSI Open Source Definition . . . 16

Vibrant Communities . . . 18

Major Software Projects . . . 19

Linux Myths, Legends, and FUD. . . 20

Can You Stop Worrying About Viruses? . . . 20

Will You Be Sued for Using Linux? . . . 21

Can Linux Really Run on Everything from Handhelds to Supercomputers? . . . 22

Will Linux Crush Microsoft?. . . 23

Are You on Your Own If You Use Linux? . . . 23

Is Linux Only for Geeks? . . . 23

How Do Companies Make Money with Linux? . . . 24

How Different Are Linux Distributions from One Another? . . . 25

Is the Linux Mascot Really a Penguin? . . . 25

Getting Started with Linux . . . 26

Summary . . . 27

Chapter 2: Running Commands from the Shell. . . 29

Starting a Shell . . . 30

Using the Shell Prompt . . . 30

Using a Terminal Window . . . 31

Using Virtual Terminals . . . 32

(14)

Choosing Your Shell . . . 32

Using bash (and Earlier sh) Shells . . . 33

Using tcsh (and Earlier csh) Shells. . . 33

Using ash . . . 34

Using ksh . . . 34

Using zsh . . . 34

Exploring the Shell . . . 34

Checking Your Login Session . . . 35

Checking Directories and Permissions . . . 36

Checking System Activity . . . 37

Exiting the Shell . . . 38

Using the Shell in Linux . . . 39

Locating Commands . . . 40

Rerunning Commands . . . 42

Connecting and Expanding Commands . . . 48

Creating Your Shell Environment . . . 51

Configuring Your Shell . . . 51

Using Shell Environment Variables. . . 55

Managing Background and Foreground Processes. . . 59

Working with the Linux File System . . . 61

Creating Files and Directories . . . 63

Moving, Copying, and Deleting Files . . . 70

Using the vi Text Editor . . . 70

Starting with vi . . . 71

Moving Around the File . . . 74

Searching for Text . . . 74

Using Numbers with Commands . . . 75

Summary . . . 76

Chapter 3: Getting into the Desktop . . . 77

Understanding Your Desktop . . . 77

Starting the Desktop . . . 78

K Desktop Environment . . . 82

Using the KDE Desktop . . . 82

Managing Files with the Konqueror File Manager . . . 86

Configuring Konqueror Options . . . 92

Managing Windows . . . 95

Configuring the Desktop. . . 97

Adding Application Launchers and MIME Types . . . 99

The GNOME Desktop . . . 100

Using the Metacity Window Manager . . . 102

Using the GNOME panels . . . 103

Using the Nautilus File Manager . . . 108

Changing GNOME Preferences . . . 110

Exiting GNOME . . . 113

(15)

Configuring Your Own Desktop . . . 114

Configuring X . . . 115

Choosing a Window Manager . . . 118

Choosing Your Personal Window Manager . . . 120

Getting More Information. . . 121

Summary . . . 121

Part II: Running the Show 123 Chapter 4: Learning Basic Administration . . . 125

Graphical Administration Tools . . . 125

Using Web-Based Administration . . . 126

Graphical Administration with Different Distributions. . . 127

Using the root Login. . . 131

Becoming Root from the Shell (su Command) . . . 132

Allowing Limited Administrative Access. . . 133

Exploring Administrative Commands, Configuration Files, and Log Files . . . 134

Administrative Commands . . . 134

Administrative Configuration Files . . . 135

Administrative Log Files . . . 139

Using sudo and Other Administrative Logins . . . 140

Administering Your Linux System . . . 142

Creating User Accounts . . . 143

Adding Users with useradd . . . 143

Setting User Defaults . . . 147

Configuring Hardware . . . 149

Managing Removable Hardware . . . 150

Working with Loadable Modules . . . 153

Managing File Systems and Disk Space . . . 155

Mounting File Systems . . . 158

Using the mkfs Command to Create a File System . . . 165

Adding a Hard Disk . . . 166

Checking System Space . . . 168

Monitoring System Performance . . . 170

Summary . . . 171

Chapter 5: Getting on the Internet . . . 173

Connecting to the Network . . . 173

Connecting via Dial-Up Service . . . 174

Connecting a Single Computer to Broadband . . . 175

Connecting Multiple Computers to Broadband . . . 176

Connecting Servers . . . 177

Connecting Other Equipment . . . 179

(16)

Using Ethernet Connections to the Internet . . . 180

Configuring Ethernet During Installation. . . 180

Configuring Ethernet from the Desktop . . . 181

Using Network Configuration GUI. . . 181

Identifying Other Computers (Hosts and DNS) . . . 183

Understanding Your Internet Connection . . . 185

Using Dial-up Connections to the Internet . . . 187

Getting Information . . . 188

Setting Up Dial-Up PPP . . . 189

Creating a Dial-Up Connection with the Internet Configuration Wizard. . . 189

Launching Your PPP Connection . . . 192

Launching Your PPP Connection on Demand . . . 192

Checking Your PPP Connection . . . 193

Summary . . . 194

Chapter 6: Securing Linux . . . 195

Linux Security Checklist . . . 196

Finding Distribution-Specific Security Resources. . . 198

Finding General Security Resources . . . 199

Using Linux Securely . . . 199

Using Password Protection . . . 199

Choosing Good Passwords . . . 200

Using a Shadow Password File . . . 201

Using Log Files . . . 203

The Role of Syslogd. . . 206

Redirecting Logs to a Loghost with syslogd . . . 207

Understanding the messages Log File . . . 208

Using Secure Shell Tools . . . 209

Starting the ssh Service . . . 209

Using the ssh, sftp, and scp Commands . . . 210

Using ssh, scp, and sftp Without Passwords . . . 212

Securing Linux Servers . . . 213

Controlling Access to Services with TCP Wrappers . . . 213

Understanding Attack Techniques . . . 216

Protecting Against Denial of Service Attacks . . . 217

Protecting Against Distributed DOS Attacks. . . 220

Protecting Against Intrusion Attacks . . . 224

Securing Servers with SELinux . . . 227

Protecting Web Servers with Certificates and Encryption . . . 228

Using Security Tools Linux Distributions . . . 239

Summary . . . 239

(17)

Part III: Choosing and Installing a Linux Distribution 241

Chapter 7: Installing Linux . . . 243

Choosing a Linux Distribution . . . 244

Linux at Work . . . 244

Other Distributions . . . 245

Getting Your Own Linux Distribution . . . 245

Finding Another Linux Distribution. . . 246

Understanding What You Need . . . 246

Downloading the Distribution . . . 247

Burning the Distribution to CD . . . 248

Exploring Common Installation Topics . . . 249

Knowing Your Computer Hardware. . . 249

Upgrading or Installing from Scratch . . . 250

Dual Booting with Windows or Just Linux? . . . 251

Using Installation Boot Options . . . 252

Partitioning Hard Drives . . . 253

Using LILO or GRUB Boot Loaders . . . 262

Configuring Networking . . . 271

Configuring Other Administrative Features . . . 272

Installing from the Linux Bible CD or DVD . . . 273

Summary . . . 273

Chapter 8: Running Fedora Core and Red Hat Enterprise Linux . . . 275

Digging into Features . . . 277

Red Hat Installer (Anaconda) . . . 277

RPM Package Management . . . 278

Kudzu Hardware Detection . . . 278

Red Hat Desktop Look-and-Feel . . . 279

System Configuration Tools . . . 279

Going Forward with Fedora Core . . . 279

Growing Community Support for Fedora . . . 280

Fedora Extras . . . 280

Fedora Legacy Project . . . 281

Forums and Mailing Lists . . . 282

Listening to the People at Red Hat . . . 282

Listening to the Red Hat Community . . . 283

Installing Fedora Core. . . 285

Choosing Computer Hardware . . . 285

Choosing an Installation Method . . . 287

Choosing to Install or Upgrade . . . 288

Beginning the Installation . . . 289

Running Fedora Setup Agent . . . 296

Summary . . . 297

(18)

Chapter 9: Running Debian GNU/Linux . . . 299

Inside Debian GNU/Linux . . . 300

Debian Packages . . . 300

Debian Package Management Tools . . . 301

Debian Releases . . . 303

Getting Help with Debian . . . 303

Installing Debian GNU/Linux . . . 304

Hardware Requirements and Installation Planning . . . 304

Running the Installer . . . 306

Managing Your Debian System . . . 311

Configuring Network Connections . . . 311

Package Management Using APT . . . 314

Package Management Using dpkg. . . 318

Installing Package Sets (Tasks) with Tasksel . . . 320

Alternatives, Diversions, and Stat Overrides . . . 320

Managing Package Configuration with debconf . . . 322

Summary . . . 323

Chapter 10: Running SUSE Linux . . . 325

Understanding SUSE. . . 326

What’s in SUSE . . . 327

Installation and Configuration with YaST . . . 327

RPM Package Management . . . 330

Automated Software Updates . . . 331

Getting Support for SUSE . . . 332

Installing OpenSUSE . . . 332

Before You Begin . . . 333

Starting Installation . . . 334

Starting with SUSE . . . 338

Summary . . . 339

Chapter 11: Running KNOPPIX. . . 341

KNOPPIX News. . . 341

KNOPPIX Features . . . 342

Understanding KNOPPIX . . . 342

Looking Inside KNOPPIX . . . 342

What’s Cool About KNOPPIX . . . 344

Examining Challenges with KNOPPIX . . . 346

Seeing Where KNOPPIX Comes From. . . 347

Exploring Uses for KNOPPIX. . . 347

Starting KNOPPIX . . . 349

Getting a Computer . . . 349

Booting KNOPPIX . . . 350

Correcting Boot Problems . . . 350

(19)

Using KNOPPIX . . . 354

Using the KDE Desktop in KNOPPIX . . . 355

Getting on the Network . . . 356

Installing Software in KNOPPIX . . . 357

Saving Files in KNOPPIX . . . 357

Keeping Your KNOPPIX Configuration . . . 360

Restarting KNOPPIX . . . 361

Summary . . . 362

Chapter 12: Running Yellow Dog Linux. . . 363

Understanding Yellow Dog Linux . . . 363

Going Forward with Yellow Dog . . . 365

Digging into Yellow Dog . . . 366

Installing Yellow Dog Linux . . . 367

Hardware Support . . . 368

Planning Your Installation . . . 369

Beginning the Installation . . . 371

Rebooting Your Linux Mac . . . 378

Updating Yellow Dog Linux . . . 378

Running Mac Applications with Mac-on-Linux . . . 379

Support Options . . . 380

Summary . . . 381

Chapter 13: Running Gentoo Linux . . . 383

Understanding Gentoo . . . 383

Gentoo’s Open Source Spirit. . . 384

The Gentoo Community . . . 385

Building, Tuning, and Tweaking Linux . . . 385

Where Gentoo Is Used . . . 386

What’s in Gentoo . . . 387

Managing Software with Portage . . . 388

Finding Software Packages. . . 389

Installing Gentoo. . . 390

Getting Gentoo . . . 390

Starting Gentoo Installation . . . 391

Summary . . . 398

Chapter 14: Running Slackware Linux . . . 399

Getting into Slackware . . . 399

Characterizing the Slackware Community . . . 401

The Slackware Creator . . . 401

Slackware Users . . . 403

Slackware Internet Sites . . . 403

Challenges of Using Slackware . . . 404

Using Slackware as a Development Platform. . . 405

(20)

Installing Slackware . . . 405

Getting Slackware . . . 406

New Features in Slackware 10.2 . . . 406

Hardware Requirements . . . 407

Starting Installation . . . 407

Starting with Slackware . . . 412

Summary . . . 414

Chapter 15: Running Linspire . . . 415

Overview of Linspire . . . 415

Getting Into Linspire . . . 417

Installing Software with Click-N-Run . . . 417

Other Installation Options . . . 419

Linspire Support and Software. . . 419

Linspire Forums and Information . . . 420

Audio Assistant . . . 420

Installing Linspire Five-0 . . . 420

Linspire Hardware Requirements . . . 421

Installing Linspire . . . 421

Summary . . . 423

Chapter 16: Running Mandriva . . . 425

Mandriva Features. . . 426

Exploring Mandriva . . . 427

Mandriva Installer (DrakX) . . . 428

RPM Package Management with RPMDrake . . . 429

Mandriva Control Center. . . 429

The Mandriva Community . . . 430

RPM Repository on Mandrivaclub . . . 430

Mandriva Forums . . . 431

Installing Mandriva Limited Edition . . . 431

The Right Hardware for Mandriva . . . 432

Begin the DrakX Installation . . . 433

Summary . . . 438

Chapter 17: Running Ubuntu Linux . . . 441

Overview of Ubuntu . . . 441

Ubuntu Releases . . . 442

Ubuntu Installer . . . 442

Ubuntu as a Desktop . . . 443

Ubuntu as a Server . . . 445

Ubuntu Spin-Offs . . . 445

Challenges Facing Ubuntu . . . 446

Installing Ubuntu . . . 447

(21)

Starting with Ubuntu . . . 451

Trying Out the Desktop . . . 452

Adding More Software . . . 453

Getting More Information About Ubuntu . . . 456

Summary . . . 457

Chapter 18: Running a Linux Firewall/Router . . . 459

Understanding Firewalls . . . 460

Protecting Desktops with Firewalls . . . 461

Starting Your Firewall in Red Hat Linux . . . 461

Configuring a Firewall in Mandriva . . . 463

Using Firewalls with iptables . . . 464

Starting with iptables. . . 465

Using iptables to Do SNAT or IP Masquerading . . . 470

Adding Modules with iptables. . . 471

Using iptables as a Transparent Proxy . . . 472

Using iptables for Port Forwarding . . . 473

Making a Coyote Linux Bootable Floppy Firewall . . . 474

Creating a Coyote Linux Firewall . . . 474

Building the Coyote Linux Floppy . . . 475

Running the Coyote Linux Floppy Firewall . . . 481

Managing the Coyote Linux Floppy Firewall . . . 482

Using Other Firewall Distributions . . . 483

Summary . . . 484

Chapter 19: Running Bootable Linux Distributions . . . 485

Overview of Bootable Linux Distributions . . . 485

Choosing a Bootable Linux . . . 486

Security and Rescue Bootables . . . 487

Multimedia Bootables . . . 492

Tiny Desktops . . . 494

Damn Small Linux . . . 495

Special Purpose Bootables . . . 498

Customizing a Bootable Linux . . . 499

Summary . . . 501

Part IV: Running Applications 503 Chapter 20: Playing Music and Video. . . 505

Playing Digital Media and Obeying the Law . . . 505

Copyright Protection Issues . . . 506

Exploring Codecs . . . 508

Playing Music . . . 510

Setting Up Audio Cards. . . 510

Choosing an Audio CD Player . . . 512

(22)

Using MIDI Audio Players . . . 521 Performing Audio File Conversion and Compression . . . 521 Recording and Ripping Music . . . 525 Creating an Audio CD with cdrecord . . . 525 Ripping CDs with Grip . . . 526 Creating CD Labels with cdlabelgen . . . 528 Working with TV, Video, and Digital Imaging . . . 529 Watching TV with Tvtime . . . 530 Video Conferencing with GnomeMeeting . . . 531 Watching Movies and Video . . . 534 Watching Video with xine . . . 534 Using Helix Player and RealPlayer 10. . . 538 Using a Digital Camera with Gtkam and gPhoto2 . . . 538 Downloading Digital Photos with Gtkam . . . 541 Using Your Camera as a Storage Device . . . 542 Summary . . . 543

Chapter 21: Working with Words and Images. . . 545

Using OpenOffice.org . . . 546 Other Word Processors . . . 548 Using StarOffice . . . 548 Using AbiWord. . . 549 Using KOffice . . . 550 Getting Away from Windows. . . 551 Using Traditional Linux Publishing Tools . . . 552 Creating Documents in Groff or LaTeX . . . 553 Text Processing with Groff . . . 555 Text Processing with TeX/LaTeX . . . 565 Converting Documents . . . 569 Building Structured Documents. . . 571 Printing Documents in Linux . . . 575 Printing to the Default Printer . . . 575 Printing from the Shell . . . 575 Checking the Print Queues . . . 576 Removing Print Jobs . . . 577 Checking Printer Status . . . 577 Displaying Documents with ghostscript and Acrobat . . . 578 Using the ghostscript and gv Commands . . . 578 Using Adobe Acrobat Reader . . . 578 Working with Graphics . . . 580 Manipulating Images with The GIMP . . . 580 Acquiring Screen Captures . . . 581 Modifying Images with KPaint . . . 582 Using Scanners Driven by SANE . . . 583 Summary . . . 583

(23)

Chapter 22: E-Mailing and Web Browsing . . . 585

Using E-Mail . . . 585 Choosing an E-Mail Client . . . 585 Getting Here from Windows . . . 587 Getting Started with E-Mail . . . 588 Tuning Up E-Mail . . . 589 Reading E-Mail with Mozilla Mail . . . 590 Managing E-Mail in Evolution . . . 595 Getting Thunderbird . . . 598 Working with Text-Based E-Mail Readers . . . 598 Choosing a Web Browser . . . 601 Web Browsing with Mozilla . . . 602 Using Mozilla’s Other Components . . . 602 Using Text-Based Web Browsers . . . 612 Running the Firefox Web Browser . . . 613 Summary . . . 618

Chapter 23: Gaming with Linux . . . 619

Overview of Linux Gaming . . . 619 Basic Linux Gaming Information. . . 620 Where to Get Information About Linux Gaming . . . 620 Choosing a Video Card for Gaming . . . 622 Basic X Window Games . . . 624 GNOME Games . . . 624 KDE Games. . . 626 Chess Games . . . 627 Freeciv . . . 629 PlanetPenguin Racer (TuxRacer) . . . 634 Commercial Linux Games. . . 635 Playing Commercial Linux Games . . . 636 id Software Games . . . 637 Playing TransGaming and Cedega Games . . . 638 Loki Software Game Demos . . . 640 Summary . . . 644

Part V: Running Servers 645

Chapter 24: Running a Linux, Apache, MySQL, and PHP

(LAMP) Server. . . 647

Components of a LAMP Server . . . 648 Apache . . . 648 MySQL . . . 648 PHP . . . 649

(24)

Setting Up Your LAMP Server . . . 650 Installing Apache . . . 650 Installing PHP . . . 651 Installing MySQL . . . 652 Operating Your LAMP Server . . . 654 Editing Your Apache Configuration Files. . . 654 Adding a Virtual Host to Apache . . . 657 User Content and the UserDir Setting . . . 658 Installing a Web Application: Coppermine Photo Gallery . . . 659 Troubleshooting . . . 663 Configuration Errors . . . 663 Access Forbidden and Server Internal Errors . . . 665 Securing Your Web Traffic with SSL/TLS . . . 666 Generating Your Keys . . . 668 Configuring Apache to Support SSL/TLS . . . 670 Summary . . . 671

Chapter 25: Running a Mail Server . . . 673

Internet E-Mail’s Inner Workings . . . 673 About the System and the Software Used . . . 675 Preparing Your System . . . 676 Configuring DNS for Direct Delivery . . . 676 Configuring for Retrieval from a Mail Host . . . 678 Installing and Configuring the Mail Server Software . . . 678 Installing Exim and Courier . . . 678 Installing ClamAV and SpamAssassin. . . 680 Testing and Troubleshooting. . . 682 Checking Logs . . . 683 Common Errors (and How to Fix Them) . . . 684 Configuring Mail Clients . . . 687 Configuring Fetchmail . . . 687 Configuring Web-Based Mail . . . 688 Securing Communications with SSL/TLS . . . 688 Summary . . . 690

Chapter 26: Running a Print Server . . . 691

Common UNIX Printing Service . . . 692 Setting Up Printers . . . 693 Using Web-Based CUPS Administration . . . 693 Using the Red Hat Printer Configuration Window . . . 696 Working with CUPS Printing . . . 705 Configuring the CUPS Server (cupsd.conf) . . . 705 Starting the CUPS Server. . . 706 Configuring CUPS Printer Options Manually . . . 707

(25)

Using Printing Commands . . . 708 Printing with lpr. . . 708 Listing Status with lpc . . . 709 Removing Print Jobs with lprm . . . 709 Configuring Print Servers. . . 710 Configuring a Shared CUPS Printer . . . 710 Configuring a Shared Samba Printer . . . 712 Summary . . . 714

Chapter 27: Running a File Server . . . 715

Setting Up an NFS File Server . . . 716 Getting NFS . . . 718 Sharing NFS File Systems. . . 718 Using NFS File Systems . . . 723 Unmounting NFS File Systems . . . 729 Other Cool Things to Do with NFS . . . 729 Setting Up a Samba File Server. . . 730 Getting and Installing Samba . . . 731 Configuring Samba with SWAT . . . 732 Working with Samba Files and Commands . . . 742 Using Samba Shared Directories . . . 745 Troubleshooting Your Samba Server . . . 746 Summary . . . 749

Part VI: Programming in Linux 751

Chapter 28: Programming Environments and Interfaces . . . 753

Understanding Programming Environments . . . 754 Using Linux Programming Environments . . . 754 The Linux Development Environment . . . 755 Graphical Programming Environments . . . 764 The Command-Line Programming Environment . . . 768 Linux Programming Interfaces . . . 770 Creating Command-Line Interfaces . . . 770 Creating Graphical Interfaces . . . 776 Application Programming Interfaces . . . 778 Summary . . . 782

Chapter 29: Programming Tools and Utilities . . . 785

The Well-Stocked Toolkit . . . 785 Using the GCC Compiler . . . 787 Compiling Multiple Source Code Files . . . 788 GCC Command-Line Options . . . 791 Automating Builds with make . . . 792

(26)

Library Utilities . . . 795 The nm Command . . . 796 The ar Command . . . 797 The ldd Command . . . 798 The ldconfig Command . . . 799 Environment Variables and Configuration Files . . . 799 Source Code Control . . . 800 Source Code Control Using RCS . . . 800 Source Code Control with CVS . . . 803 Debugging with GNU Debugger . . . 807 Starting GDB . . . 808 Inspecting Code in the Debugger . . . 810 Examining Data . . . 811 Setting Breakpoints . . . 813 Working with Source Code . . . 814 Summary . . . 815

Appendix A: Media. . . 817

Finding Linux Distributions on the DVD . . . 817 Fedora Core 4 Linux . . . 818 SUSE Linux . . . 818 KNOPPIX Linux . . . 818 Slackware 10.1 . . . 818 Ubuntu 5.1 . . . 819 Finding Linux Distributions on the CD . . . 819 Debian GNU/Linux . . . 819 Gentoo Linux . . . 819 Damn Small Linux . . . 820 Inside Security Rescue Toolkit . . . 820 System Rescue CD . . . 820 Coyote Linux. . . 820 Slax . . . 821 Linux Distributions Not on the DVD or CD . . . 821 Creating Linux CDs . . . 821

Appendix B: Entering the Linux Community. . . 825

General Linux Sites . . . 825 Linux Distributions . . . 827 Companies and Groups Supporting Linux . . . 828 Major Linux Projects . . . 829 Linux User Groups. . . 829

Index . . . 831

GNU General Public License. . . 873

(27)

Acknowledgments

I

consider anyone who has contributed to the open source community to be a contributor to the book you are holding. The backbone of any Linux distribution is formed by the organizations that produce the distributions, the major projects included in Linux, and the thousands of people who give their time and code to support Linux. So, thanks to you all!

As for direct contributors to the book, a small team of writers/technical reviewers went through and updated the content from Linux Bible 2005 Editionwhile I was off writing Linux Toys II. Their contributions gave me a head start so I could jump into this book with a good set of rewrites, suggestions, and constructive criticisms already in place. Primary contributors include Wayne Tucker (who originally wrote and then updated the chapters on Debian, LAMP servers, and mail servers) and Kurt Wall (who wrote the programming chapters and helped revise several others).

Other valuable contributions came from technical editors Dilip Thomas, Bill von Hagen, and John Kennedy.

Thanks to the folks at Wiley for helping me press through the project. Debra Williams Cauley shepherded the project through the book’s early stages. Sara Shlaer did her usual great job of editing the book and managing its progress.

Likewise, Nancy Rapoport provided hundreds of helpful comments as copy editor.

Thanks to Margot Maley Hutchison, Kimberly Valentini, and Maureen Maloney from Waterside Productions for contracting the book for me with Wiley.

And finally, special thanks to my wife, Sheree. There’s no way I could do the work I do without the solid support I get on the home front. I love you, and thanks for tak- ing such good care of Seth, Caleb, and me.

(28)
(29)

Introduction

I

nsert the DVD or CD that comes with this book into a PC. Within five minutes, you’ll be able to try out Linux with a full range of desktop applications. Within an hour, you can have a full-blown Linux desktop or server system installed on your computer. If you are like most of us who have been bitten by the Linux bug, you won’t ever look back.

Linux Bible 2006 Editionis here to open your eyes to what Linux is, where it came from, and where it’s going. But, most of all, the book is here to hand you Linux and help you get started. Because Linux is the operating system of free speech and free choice, Linux Biblegives you choices in selecting the Linux that is right for you.

On the DVD and CD that come with this book are 12 different Linux distributions that you are free to install and try out. You learn how those distributions are alike or different, and the book leads you through the basics of installing and setting up your Linux system as:

A desktop computer—You have a full range of office, music, gaming, graphics, and other applications to use.

A server computer—Using some of the world’s best server software, you can set up your computer to be a Web server, file server, mail server, or print server.

A workstation—You can draw on thousands of open source programming tools to develop your own software applications.

Unlike other books on Linux, this book doesn’t tie you to one Linux distribution.

The book teaches you the essentials of Linux graphical interfaces, shell commands, and basic system administration. Separate chapters break down most of the major Linux distributions available today. Then descriptions of the major software pro- jects in most Linux distributions (KDE and GNOME desktops, Apache Web servers, Samba file and printer sharing, and so on) guide you in setting up and using those features, regardless of which Linux you choose.

Understanding the Linux Mystique

To calm your fears that “free” software can’t be that good, this book guides you through the strange and circuitous path of open source software development that

(30)

led to the Linux phenomenon. It also details the major companies and organizations that are behind Linux and the open source movement today.

Along the way, you learn how you can become part of the open source and free soft- ware communities, whose stars are known by a single name (like Linus) or a few ini- tials (like rms). You’ll be staggered by the number of open source projects, forums, and mailing lists that are thriving today (and always looking for more people to get involved).

How This Book Is Organized

Learn the basics of what goes into Linux and you will be able to use all sorts of devices and computers in the future. The book is organized in a way that enables you to start off at the very beginning with Linux, but still grow to the point where you can get going with some powerful server and programming features, if you care to.

Part I assumes that someone has set up a Linux system in front of you. So after

“Starting with Linux” in Chapter 1, you learn the basics of how to

✦Use the shell (Chapter 2)

✦Work with your graphical desktop (Chapter 3) In Part II, you learn how to

✦Do basic administration (Chapter 4)

✦Connect to the Internet (Chapter 5)

✦Secure your Linux system (Chapter 6)

If you don’t have Linux installed yet, this book helps you out in a big way: The com- panion DVD and CD include a variety of Linux distributions you can try. Part III (Chapters 7 through 19) describes each of those distributions and how to install them.

In Part IV, you learn to get some fun and useful features going in Linux so that you can

✦Play music and video (Chapter 20)

✦Write documents and work with graphics (Chapter 21)

✦Use Web browsers and e-mail clients (Chapter 22)

✦Play games (Chapter 23)

(31)

Linux creates powerful servers, and in Part V you learn to

✦Set up a Web server using Apache, MySQL, and PHP in Linux (Chapter 24)

✦Run a mail server (Chapter 25)

✦Share printers with a CUPS print server (Chapter 26)

✦Share files with a Samba or NFS file server (Chapter 27)

If you are coming to Linux for its programming environment, Part VI provides chap- ters that describe

✦Programming environments and interfaces (Chapter 28)

✦Programming tools and utilities (Chapter 29)

In addition, Appendix A tells you what’s on the DVD and CD, how to install from the DVD or CD, and how to burn additional installation CDs from the software that comes with this book, and Appendix B helps get you “plugged in” to the Linux community.

What You Will Get from This Book

By the time you finish this book, you’ll have a good basic understanding of many of the major features in Linux and how you can use them. If you decide then that you want to go a bit deeper into any Red Hat Linux distribution, Red Hat Fedora and Enterprise Linux 4 Bibleis a good next step, with content that includes how to set up many different types of Linux servers. If you are more technically oriented, Linux Troubleshooting Bible(Wiley, 2004) can be a good way to learn more advanced skills for securing and troubleshooting Linux systems.

To order the source code for the material included on the companion DVD and CD, go to www.wiley.com/go/linuxbible2006to download a coupon with further details.

(32)
(33)

Linux First Steps

✦ ✦ ✦ ✦

In This Part Chapter 1 Starting with Linux Chapter 2

Running Commands from the Shell Chapter 3 Getting into the Desktop

✦ ✦ ✦ ✦

I I

(34)
(35)

Starting with Linux

I

n your hands, you have a dozen Linux distributions (on CD and DVD), thousands of applications, and descriptions to launch and get started with it all. For you right now, the worldwide Linux phenomenon is just a reboot away.

Linux is ready for prime time. Are you ready for Linux? Well, whether you know it or not, you probably run into Linux every day. When you buy a book from Amazon.com or search the Web with Google, you use Linux. You use Linux in your TiVo when you record TV shows and Linux may be running the PDA in your pocket. Animations you saw in the movie Shrek 2were created by hundreds of Linux workstations and rendered by a server farm of hundreds of other Linux systems.

Linux truly is everywhere.

Big computer companies, such as IBM, Oracle, Novell, and Red Hat, are lining up their products behind Linux. After dis- missing it for years, companies such as Microsoft and Sun Microsystems are gathering their forces to deal with it. Who would have thought that some of the world’s largest computer companies would fear a computer system built from code nobody can own that is given away for free?

But despite the fact that IBM featured Muhammad Ali in com- mercials for Linux during the Superbowl and that the mere mention of “Linux” for a dot-com company sent its stock through the roof in the 1990s, most people don’t really know what Linux is. As Linux continues to improve exponentially, that’s going to change.

Linux Bible 2006 Editionbrings you into the world of free and open source software that, through some strange twists and turns, has fallen most publicly under the “Linux” banner.

Through descriptions and procedures, this book helps you:

1 1

C H A P T E R

✦ ✦ ✦ ✦

In This Chapter

Understanding Linux Using Linux

Linux myths, legends, and FUD

✦ ✦ ✦ ✦

(36)

✦Understand what Linux is and where it comes from

✦Sort through the various distributions of Linux to choose one (or more) that is right for you (you get several on this book’s CD and DVD)

✦Try out Linux as a desktop computer, server computer, or programmer’s workstation

✦Become connected to the open source software movement, as well as many separate high-quality software projects that are included with Linux

Whether you are using Linux for the first time or just want to try out a new Linux distribution, Linux Bible 2006 Editionis your guide to using Linux and the latest open source technology. While different Linux distributions vary in the exact soft- ware they include, this book describes the most popular software available for Linux to:

✦Manage your desktop (menus, icons, windows, and so on)

✦Listen to music and watch video

✦Use word processor, spreadsheet, and other office productivity applications

✦Browse the Web and send e-mail

✦Play games

✦Find thousands of other open source software packages you can get for free Because most Linux distributions also include features that let them act as servers (in fact, that’s what Linux has always been best at), you’ll also learn about software available for Linux that lets you do the following:

✦Connect to the Internet or other network

✦Use Linux as a firewall, router, and DHCP server to protect and manage your private network

✦Run a Web server (using Apache, MySQL, and PHP)

✦Run a mail server (using exim or other mail transfer agent)

✦Run a print server (using Samba or CUPS)

✦Run a file server (using FTP or Samba)

This book guides you through the basics of getting started with the Linux features just mentioned, plus many more features that I’ll get to later. You’ll go through the following basic steps:

1. Understanding Linux.You need to know where Linux came from, how it is developed, and how it’s ultimately packaged. This chapter describes the UNIX heritage on which Linux was founded, the free and open source software development efforts underway, and the organizations and individuals that package and produce Linux distributions.

(37)

2. Trying Linux.In the past, an impediment to trying Linux was getting it installed on a computer that was devoted solely to Microsoft Windows. With bootable Linux systems such as KNOPPIX (and others included with this book), you can boot a fully functioning Linux from DVD, CD, or floppy disk without disturbing the current contents of your computer.

3. Installing Linux.You can install a fully functioning Linux system permanently on your hard disk. Disk space required varies from a few hundred megabytes for a minimal installation to 6 gigabytes for a full range of desktop, server, and programming features. Chapters in Part III, “Choosing and Installing a Linux Distribution,” describe how to install several different Linux distributions.

4. Using Linux.You won’t know if Linux can be used to replace your current desktop or server system until you start using it. This book helps you try OpenOffice.org software to write documents, create spreadsheets, and build presentations. It describes xmms and mplayer for playing your music and video content, respectively, and covers some of the best Linux tools available for Web browsing (for example, Firefox, Mozilla and Konqueror) and managing your e-mail (such as Evolution and Thunderbird).

5. Configuring Linux.Linux works very well as a desktop system, and it can also be configured to act as a router, a firewall, and a variety of server types. While there are some excellent graphical tools for administering Linux systems, most Linux administrators edit configuration files and run commands to con- figure Linux. Part II, “Running the Show,” contains basic information for administering Linux, and Part V, “Running Servers,” discusses procedures for setting up various types of servers.

Once you’ve been through the book, you should be proficient enough to track down your more advanced questions through the volumes of man pages, FAQs, HOW-TOs, and forums that cover different aspects of the Linux operating system.

Understanding Linux

People who don’t know what Linux is sometimes ask me if it’s a program that runs on Microsoft Windows. When I tell them that Linux is, itself, an operating system like Windows and that they can remove (or never purchase) Windows, I sometimes get a surprised reaction: “A PC can run with nothing from Microsoft on it?”

Yes, Linux is a full-blown operating system that is a free clone of the UNIX operating system. Start your computer with Linux, and Linux takes over the operation of your PC and manages the following aspects of your computer:

Processor— Because Linux can run many processes from many different users at the same time (even with multiple CPUs on the same machine), Linux needs to be able to manage those processes. The Linux scheduler sets the pri- orities for running tasks and manages which processes run on which CPUs (if multiple processors are present). The scheduler can be tuned differently for

(38)

different types of Linux systems. If it’s tuned properly, the most important processes get the quickest responses from the processor. For example, a Linux scheduler on a desktop system gives higher priority to things such as moving a window on the desktop than it does to a background file transfer.

Memory— Linux tries to keep processes with the most immediate need in RAM, while managing how processes that exceed the available memory are moved to swap space. Swap spaceis a defined area on your hard disk that’s used to handle the overflow of running processes and data. When RAM is full, processes are placed in swap space. When swap space is full (something that you don’t want to happen), new processes can’t start up.

Devices— Linux supports thousands of hardware devices, yet keeps the ker- nel a manageable size by including only a small set of drivers in the active ker- nel. Using loadable modules, the kernel can add support for other hardware as needed. Modules can be loaded and unloaded on demand, as hardware is added and removed. (The kernel, described in detail a bit later on, is the heart of the Linux operating system.)

File systems— File systems provide the structure in which files are stored on hard disk, CD, DVD, floppy disks, or other media. Linux knows about different file system types (such as Linux ext3 and reiserfs file systems, or VFAT and NTFS from Windows systems) and how to manage them.

Security— Like UNIX, Linux was built from the ground up to enable multiple users to access the system simultaneously. To protect each user’s resources, every file, directory, and application is assigned sets of read, write, and exe- cute permissions that define who can access them. In a standard Linux sys- tem, the root user has access to the entire system, some special logins have access to control particular services (such as Apache for Web services), and users can be assigned permission individually or in groups. Recent features such as Security-Enhanced Linux enable more refined tuning and protection in highly secure computing environments.

What I have just described are components that primarily make up what is referred to as the Linux kernel. In fact, the Linux kernel (which was created and is still man- aged by Linus Torvalds) is what gives Linux its name. The kernel is the software that starts up when you boot your computer and manages the programs you use so they can communicate effectively and simply with your computer hardware.

Other components, such as administrative commands and applications, are added to the kernel from other free and open source software projects to make Linux a complete operating system. The GNU project, in particular, contributed many com- ponents that are now in Linux. (GNU, Apache, KDE, GNOME, and other key open source projects in Linux are discussed a bit later). Those other projects added such things as:

Graphical user interfaces (GUIs)— Consisting of a graphical framework (typi- cally the X Window System), window managers, panels, icons, and menus.

GUIs enable you to use Linux with a keyboard and mouse combination, instead of just typing commands (as was done in the old days).

(39)

Administrative utilities— Including hundreds (perhaps thousands) of com- mands and graphical windows to do such things as add users, manage disks, monitor the network, install software, and generally secure and manage your computer.

Applications— Although no Linux distribution includes all of them, there are literally thousands of games, office productivity tools, Web browsers, chat windows, multimedia players, and other applications available for Linux.

Programming tools— Including programming utilities for creating applica- tions and libraries for implementing specialty interfaces.

Server features— Enabling you to offer services from your Linux computer to another computer on the network. In other words, while Linux includes Web browsers to view Web pages, it can also be the computer that serves up Web pages to others. Popular server features include Web, mail, database, printer, file, DNS, and DHCP servers.

Once Linus Torvalds and friends had a working Linux kernel, pulling together a complete open source operating system was possible because so much of the avail- able “free” software was:

✦Covered by the GNU Public License (GPL) or similar license. That allowed the entire operating system to be freely distributed, provided guidelines were fol- lowed relating to how the source code for that software was made available going forward (see http://www.gnu.org/licenses/gpl.html).

✦Based on UNIX-like systems. Clones of virtually all the other user-level compo- nents of a UNIX system had been created. Those and other utilities and appli- cations were built to run on UNIX or other UNIX-like systems.

Linux has become the culmination of the open source software movement. But the traditions of sharing code and building communities that made Linux possible started years before Linux was born. You could argue that it began in a comfortable think tank known as Bell Laboratories.

Exploring Linux History

Some histories of Linux begin with this message posted by Linus Torvalds to the comp.os.minixnewsgroup on August 25, 1991:

Hello everybody out there using minix -

I’m doing a (free) operating system (just a hobby, won’t be big and profes- sional like gnu) for 386(486) AT clones. This has been brewing since april, and is starting to get ready. I’d like any feedback on things people like/dislike in minix, as my OS resembles it somewhat (same physical layout of the file- system (due to practical reasons) among other things) . . . Any suggestions are welcome, but I won’t promise I’ll implement them :-)

(40)

Linus ([email protected])

PS. Yes — it’s free of any minix code, and it has a multi-threaded fs. It is NOT protable[sic] (uses 386 task switching etc), and it probably never will support anything other than AT-harddisks, as that’s all I have :-(.

Reprinted from Linux International Web site (www.li.org/linuxhistory.php) Minix was a UNIX-like operating system that ran on PCs in the early 1990s. Like Minix, Linux was also a clone of the UNIX operating system. To truly appreciate how a free operating system could have been modeled after a proprietary system from AT&T Bell Laboratories, it helps to understand the culture in which UNIX was cre- ated and the chain of events that made the essence of UNIX possible to reproduce freely.

From a Free-Flowing UNIX Culture at Bell Labs

From the very beginning, the UNIX operating system was created and nurtured in a communal environment. Its creation was not driven by market needs, but by a desire to overcome impediments to producing programs. AT&T, which owned the UNIX trademark originally, eventually made UNIX into a commercial product, but by that time, many of the concepts (and even much of the early code) which made UNIX special had fallen into the public domain.

If you are under 30 years old, you may not remember a time when AT&T was “the”

phone company. Up until the early 1980s, AT&T didn’t have to think much about competition because if you wanted a phone in the United States, you had to go to AT&T. It had the luxury of funding pure research projects. The Mecca for such pro- jects was the Bell Laboratories site in Murray Hill, New Jersey.

After the failure of a project called Multics in around 1969, Bell Labs employees Ken Thompson and Dennis Ritchie set off on their own to create an operating system that would offer an improved environment for developing software. Up to that time, most programs were written on punch cards that had to be fed in batches to main- frame computers. In a 1980 lecture on “The Evolution of the UNIX Time-sharing System,” Dennis Ritchie summed up the spirit that started UNIX:

What we wanted to preserve was not just a good environment in which to do programming, but a system around which a fellowship could form. We knew from experience that the essence of communal computing as supplied by remote-access, time-shared machines is not just to type programs into a ter- minal instead of a keypunch, but to encourage close communication.

The simplicity and power of the UNIX design began breaking down barriers that impeded software developers. The foundation of UNIX was set with several key elements:

(41)

The UNIX file system— After creating the structure that allowed levels of sub- directories (which, for today’s desktop users, looks like folders inside of fold- ers), UNIX could be used to organize the files and directories in intuitive ways.

Furthermore, complex methods of accessing disks, tapes, and other devices were greatly simplified by representing those devices as individual device files that you could also access as items in a directory.

Input/output redirection— Early UNIX systems also included input redirec- tion and pipes. From a command line, UNIX users could direct the output of a command to a file using a right arrow key (>). Later, the concept of pipes was added (|) where the output of one command could be directed to the input of another command. For example, the command line

$ cat file1 file2 | sort | pr | lpr

concatenates (cat) file1 and file2, sorts (sort) the lines in those files alpha- betically, paginates the sorted text for printing (pr), and directs the output to the computer’s default printer (lpr). This method of directing input and out- put enabled developers to create their own specialized utilities that could be joined together with existing utilities. This modularity made it possible for lots of code to be developed by lots of different people.

Portability— Much of the early work in simplifying the experience of using UNIX led to its also becoming extraordinarily portable to run on different com- puters. By having device drivers (represented by files in the file system tree), UNIX could present an interface to applications in such a way that the pro- grams didn’t have to know about the details of the underlying hardware. To later port UNIX to another system, developers had only to change the drivers.

The applications program didn’t have to change for different hardware!

To make the concept of portability a reality, however, a high-level program- ming language was needed to implement the software needed. To that end, Brian Kernighan and Dennis Ritchie created the C programming language. In 1973, UNIX was rewritten in C. Today, C is still the primary language used to create the UNIX (and Linux) operating system kernels.

As Ritchie went on to say in his 1980 lecture:

Today, the only important UNIX program still written in assembler is the assembler itself; virtually all the utility programs are in C, and so are most of the applications programs, although there are sites with many in Fortran, Pascal, and Algol 68 as well. It seems certain that much of the success of UNIX follows from the readability, modifiability, and portability of its software that in turn follows from its expression in high-level languages.

If you are a Linux enthusiast and are interested in what features from the early days of Linux have survived, an interesting read is Dennis Ritchie’s reprint of the first UNIX programmer’s manual (dated November 3, 1971). You can find it at Dennis Ritchie’s Web site: http://cm.bell-labs.com/cm/cs/who/dmr/1stEdman.html.

(42)

The form of this documentation is UNIX man pages — which is still the primary for- mat for documenting UNIX and Linux operating system commands and program- ming tools today.

What’s clear as you read through the early documentation and accounts of the UNIX system is that the development was a free-flowing process, lacked ego, and was dedicated to making UNIX excellent. This process led to a sharing of code (both inside and outside of Bell Labs) that allowed rapid development of a high- quality UNIX operating system. It also led to an operating system that AT&T would find difficult to reel back in later.

To a Commercialized UNIX

Before AT&T divestiture in 1984, when it was split up into AT&T and seven “baby Bell” companies, AT&T was forbidden to sell computer systems. Companies you now know by names such as Verizon, Qwest, SBC Communications, and Lucent Technologies were all part of AT&T. As a result of AT&T’s monopoly of the tele- phone system, the U.S. government was concerned that an unrestricted AT&T might dominate the fledgling computer industry.

Because AT&T was restricted from selling computers directly to customers before its divestiture, UNIX source code was licensed to universities for a nominal fee.

There was no UNIX operating system for sale from AT&T that you didn’t have to compile yourself.

BSD Arrives

In 1975, UNIX V6 became the first version of UNIX available for widespread use out- side of Bell Laboratories. From this early UNIX source code, the first major variant of UNIX was created at University of California at Berkeley. It was named the Berkeley Software Distribution (BSD).

For most of the next decade, the BSD and Bell Labs versions of UNIX headed off in separate directions. BSD continued forward in the free-flowing, share-the-code man- ner that was the hallmark of the early Bell Labs UNIX, while AT&T started steering UNIX toward commercialization. With the formation of a separate UNIX Laboratory, which moved out of Murray Hill and down the road to Summit, New Jersey, AT&T began its attempts to commercialize UNIX. By 1984, divestiture was behind AT&T and it was ready to really start selling UNIX.

UNIX Laboratory and Commercialization

The UNIX Laboratory was considered a jewel that couldn’t quite find a home or a way to make a profit. As it moved between Bell Laboratories and other areas of AT&T, its name changed several times. It is probably best remembered by its last name, which it had as it began its spin-off from AT&T: UNIX System Laboratories (USL).

(43)

The UNIX source code that came out of USL, the legacy of which is now owned by Santa Cruz Operation (SCO), is being used as the basis for lawsuits by SCO against major Linux vendors (such as IBM and Red Hat, Inc.). Because of that, I think the efforts from USL that have contributed to the success of Linux are sometimes disrespected.

You have to remember that, during the 1980s, many computer companies were afraid that a newly divested AT&T would pose more of a threat to controlling the computer industry than would an upstart company in Redmond, Washington. To calm the fears of IBM, Intel, DEC, and others computer companies, the UNIX Lab made the following commitments to ensure a level playing field:

Source code only— Instead of producing their own boxed set of UNIX, AT&T continued to sell only source code and to make it available equally to all licensees. Each company would then port UNIX to its own equipment. It wasn’t until about 1992, when the lab was spun off as a joint venture with Novell (called Univel), and then eventually sold to Novell, that a commercial boxed set of UNIX (called UnixWare) was produced directly from that source code.

Published interfaces— To create an environment of fairness and community to its OEMs (original equipment manufacturers), AT&T began standardizing what different ports of UNIX had to be able to do to still be called UNIX. To that end, Portable Operating System Interface (POSIX) standards and the AT&T UNIX System V Interface Definition (SVID) were specifications UNIX ven- dors could use to create compliant UNIX systems. Those same documents also served as road maps for the creation of Linux.

In an early e-mail newsgroup post, Linus Torvalds made a request for a copy, preferably online, of the POSIX standard. I think that nobody from AT&T expected someone to actually be able to write their own clone of UNIX from those inter- faces, without using any of its UNIX source code.

Technical approach— Again, until the very end of USL, most decisions on the direction of UNIX were made based on technical considerations. Management was promoted up through the technical ranks and to my knowledge there was never any talk of writing software to break other companies’ software or oth- erwise restrict the success of USL’s partners.

When USL eventually started taking on marketing experts and creating a desktop UNIX product for end users, Microsoft Windows already had a firm grasp on the desktop market. Also, because the direction of UNIX had always been toward source-code licensing destined for large computing systems, USL had pricing diffi- culties for its products. For example, on software it was including with UNIX, USL found itself having to pay out per-computer licensing fees that were based on

$100,000 mainframes instead of $2,000 PCs. Add to that the fact that no application programs were available with UnixWare, and you can see why the endeavor failed.

Note

(44)

Successful marketing of UNIX systems at the time, however, was happening with other computer companies. SCO had found a niche market, primarily selling PC ver- sions of UNIX running dumb terminals in small offices. Sun Microsystems was selling lots of UNIX workstations (originally based on BSD but merged with UNIX in SVR4) for programmers and high-end technology applications (such as stock trading).

Other commercial UNIXes were also emerging by the 1980s as well. This new owner- ship assertion of UNIX was beginning to take its toll on the spirit of open contribu- tions. Lawsuits were being raised to protect UNIX source code and trademarks. In 1984, this new, restrictive UNIX gave rise to an organization that eventually led a path to Linux: the Free Software Foundation.

To a GNU Free-Flowing (not) UNIX

In 1984, Richard M. Stallman started the GNU project (www.gnu.org), recursively named by the phrase GNU is Not UNIX. As a project of the Free Software Foundation (FSF), GNU was intended to become a recoding of the entire UNIX operating system that could be freely distributed.

While rewriting millions of lines of code might seem daunting to one or two people, spreading the effort across dozens or even hundreds of programmers made the pro- ject possible. It turned out that not only could the same results be gained by all new code, but that in some cases that code was better than the original UNIX versions.

Because everyone could see the code being produced for the project, poorly writ- ten code could be corrected quickly or replaced over time.

If you are familiar with UNIX, try searching the more than 3,400 GNU software pack- ages for your favorite UNIX command from the Free Software Directory

(http://directory.fsf.org/GNU). Chances are you will find it there, along with many, many other software projects available as add-ons.

Over time, the term free softwarehas been mostly replaced by the term open source software. As a nod to both the two camps, however, some people use the term Free and Open Source Software (FOSS) instead. An underlying principal of FOSS, how- ever, is that, while you are free to use the software as you like, you have some responsibility to make the improvements you make to the code available to others.

In that way, everyone in the community can benefit from your work as you have benefited from the work of others’.

To clearly define how open source software should be handled, the GNU software project created the GNU Public License (you can read the GPL in its entirety at the end of this book). While there are many other software licenses covering slightly different approaches to protecting free software, the GPL is perhaps the most well known — and it’s the one that covers the Linux kernel itself. Basic features of the GNU Public License include:

(45)

Author rights— The original author retains the rights to his or her software.

Free distribution— People can use the GNU software in their own software, changing and redistributing it as they please. They do, however, have to include the source code with their distribution (or make it easily available).

Copyright maintained— Even if you were to repackage and resell the soft- ware, the original GNU agreement must be maintained with the software, which means all future recipients of the software have the opportunity to change the source code, just as you did.

There is no warranty on GNU software. If something goes wrong, the original devel- oper of the software has no obligation to fix the problem. However, there are many organizations, big and small, that offer paid support packages for the software when it is included in their Linux or other open source software distribution. (See the OSI Open Source Definition later in this chapter for a more detailed definition of open source software.)

Despite its success producing thousands of UNIX utilities, the GNU project itself failed to produce one critical piece of code: the kernel. Its attempts to build an open source kernel with the GNU Hurd project (www.gnu.org/software/hurd) were unsuccessful.

BSD Loses Some Steam

The one software project that had a chance of beating out Linux to be the premier open source software project was the venerable old BSD project. By the late 1980s, BSD developers at UC Berkeley realized that they had already rewritten most of the UNIX source code they had received a decade earlier.

In 1989, UC Berkeley distributed its own UNIX-like code as Net/1 and later (in 1991) as Net/2. Just as UC Berkeley was preparing a complete, UNIX-like operating system that was free from all AT&T code, AT&T hit them with a lawsuit in 1992. The suit claimed that the software was written using trade secrets taken from AT&T’s UNIX system.

The lawsuit was dropped when Novell bought UNIX System Laboratories from AT&T in 1994. But, during that critical time period, there was enough fear and doubt about the legality of the BSD code that the momentum BSD had gained to that point in the fledgling open source community was lost. Many people started looking for another open source alternative. The time was ripe for a college student from Finland who was working on his own kernel.

Today, BSD versions are available from three projects: FreeBSD, NetBSD, and OpenBSD. People generally characterize FreeBSD as the easiest to use, NetBSD as available on the most computer hardware platforms, and OpenBSD as fanatically secure. Many security-minded individuals still prefer BSD over Linux.

Note

Références

Documents relatifs

resource utilization of the operational DSA; the network service related aspects e.g., inbound-associations, outbound-associations, operational status, and finally the

The proposal allows the algorithmic resolution of unknown objects in the directory and in the absence of 1993 X.500 Directory Standard implementations provides an interim

If you decide you want to move all messages in your Inbox from a particular person to a different folder, for example, you can open the Message Filters window, create a rule to

With the cursor still positioned on the last line of the file, type P to paste the text above the current line:.. The quick brown fox jumped over the

(For more information about connecting to remote systems, see Chapter 15, “Connecting to Other Systems.”) Because xterms don’t feature multiple tabs like the GNOME Terminal

This status report includes the Process Identification Number (PID), the terminal (TTY), the time the process has been executing (TIME), and the command line used to

For example, the file for the useradd command defines the default group number, home directory, password expiration date, shell, and skeleton directory ( /etc/skel ) that are used

le webmaster peut mettre les droits suivants dans un fichier .htaccess d’un répertoire conte- nant des fichiers de l’intranet de son entreprise :... None : N’autorise aucun