Installing from the Linux DVD-ROM ...31Monitoring the Installation Process ...32 Understanding the Fedora Core Installation Phases ...33 Getting Ready to Install ...34 Partitioning and U
Trang 4Red Hat ®
Trang 7Red Hat ® Fedora ™ Linux ® Secrets ®
Copyright © 2005 by Wiley Publishing, Inc., Indianapolis, Indiana
Published by Wiley Publishing, Inc., Indianapolis, Indiana
Published simultaneously in Canada
pay-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 tion 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 organiza- tion or Website may provide or recommendations it may make Further, readers should be aware that Internet Websites listed
limita-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.
Wiley also publishes its books in a variety of electronic formats Some content that appears in print may not be available in electronic books.
Library of Congress Cataloging-in-Publication Data
Trang 8To my wife, Leha, and daughters, Ivy, Emily, and Ashley.
Trang 9About the Author
Naba Barkakati, an electrical engineer and a successful computer-book author, has rience in a wide variety of systems, ranging from MS-DOS and Windows to UNIX andLinux He bought his first personal computer—an IBM PC-AT—in 1984 after graduatingwith a Ph.D in electrical engineering from the University of Maryland at College Park.While pursuing a full-time career in engineering, Naba dreamed of writing software forthe emerging PC software market As luck would have it, instead of building a softwareempire like Microsoft, he ended up writing successful computer books Currently, Naba is
expe-a Senior Level Technologist expe-at the Center for Technology expe-and Engineering in the U.S.Government Accountability Office (GAO)
Over the past 17 years, Naba has written more than 25 computer books on a number oftopics, ranging from object-oriented programming with C++ to Linux He has written sev-
eral best-selling titles, such as The Waite Group’s Turbo C++ Bible, Object-Oriented
Programming in C++, X Window System Programming, Visual C++ Developer’s Guide, Borland C++ 4 Developer’s Guide, and Linux Secrets His books have been translated into
many languages, including Spanish, French, Polish, Greek, Italian, Chinese, Japanese,
and Korean Naba’s most recent books are SUSE Linux 9.3 For Dummies and Linux
All-in-One Desk Reference For Dummies, both published by Wiley.
Naba lives in North Potomac, Maryland, with his wife, Leha, and their children, Ivy,Emily, and Ashley
Trang 10Quality Control Technicians
John GreenoughCarl William Pierce
Proofreading and Indexing
TECHBOOKS Production Services
Trang 12Contents at a Glance
Acknowledgments xxv
Introduction xxvii
Part I: Setting Up Linux .1
Chapter 1: An Overview of Linux .3
Chapter 2: Linux Installation .23
Chapter 3: X Window System Setup .71
Chapter 4: Printer Setup 99
Chapter 5: Sound Setup 119
Chapter 6: Network Setup 133
Part II: Exploring Linux .173
Chapter 7: Linux Basics 175
Chapter 8: GNU Utilities 223
Chapter 9: GUI Desktops 249
Chapter 10: Linux Applications and Utilities .283
Chapter 11: Text Processing .311
Chapter 12: Basic System Administration .353
Part III: Internetworking Linux .377
Chapter 13: Internet Connection Setup .379
Chapter 14: Web Server .417
Chapter 15: Mail Server .451
Chapter 16: News Server and RSS Feeds .479
Chapter 17: FTP Server .501
Chapter 18: DNS and NIS .515
Chapter 19: Samba and NFS .547
Part IV: Managing Linux 561
Chapter 20: Advanced System Administration .563
Chapter 21: Software Installation and Update .613
Chapter 22: System and Network Security .657
Part V: Programming Linux .721
Chapter 23: Software Development in Linux .723
Chapter 24: Shell and Perl Scripting 761
Trang 13Chapter 25: Tcl/Tk Scripting 807
Chapter 26: Java Programming 843
Part VI: Appendixes .903
Appendix A: Linux Commands .905
Appendix B: Disk Drives .937
Appendix C: CD and DVD Drives 957
Appendix D: Ethernet Cards .967
Appendix E: Modems and Terminals 979
Appendix F: PC Cards 999
Appendix G: Linux Resources .1005
Appendix H: Fedora Upgrade Procedure .1009
Appendix I: About the DVD-ROM .1015
Index 1019
End-User License Agreement 1065
Trang 14
Acknowledgments xxv
Introduction xxvii
Part I: Setting Up Linux .1
Chapter 1: An Overview of Linux .3
What Is Linux? .4
Linux Kernel Version Numbers .5
Fedora Core Version Numbers .6
Red Hat’s Commercial Linux Products .6
Under the Hood in Linux Kernel 2.6 .7
Support for a Wider Range of Computer Hardware .7
Better Scalability 7
Improved Device Handling 7
Linux as a UNIX Platform .9
POSIX Compliance 10
Linux Standard Base .11
Linux Desktop 12
Linux Networking 14
TCP/IP 14
PPP Dialup Network 15
Cable/DSL and Wireless Networks 15
File Sharing with NFS .16
Linux System Administration .16
System-Administration Tasks .17
Network-Administration Tasks 17
Windows and Linux 18
Software Development in Linux .19
Linux as an Internet On-Ramp .20
Summary 21
Chapter 2: Linux Installation 23
Understanding the Linux Installation Process 24
Preparing Your PC for Linux Installation 26
Checking Your PC’s Hardware 27
Repartitioning Your Hard Drive .28
Booting the Linux Installer 30
Booting from the Linux DVD-ROM 31
Watching the Boot Process during Installation 31
Trang 15Installing from the Linux DVD-ROM .31
Monitoring the Installation Process 32
Understanding the Fedora Core Installation Phases .33
Getting Ready to Install .34
Partitioning and Using the Hard Disk 35
Configuring Linux .38
Selecting the Package Groups to Install .44
Completing the Installation .49
Troubleshooting the Installation .50
Using Text Mode Installation 51
Using the linux noprobe Command .51
Troubleshooting X at the First Reboot .51
Resolving Other Installation Problems 53
Using Boot Commands during Installation 54
Learning Other Installation Methods 57
Using kickstart Installation .58
Starting a kickstart Installation .58
Preparing the kickstart File .59
Installing Linux on a Laptop .67
PCMCIA 68
Power Management .68
Sound on Laptops .68
X on Laptops .68
Summary 69
Chapter 3: X Window System Setup .71
Understanding Video Cards and Monitors .72
Raster-Scan Display 72
Color Display .73
Understanding the X Window System 75
X Server and Clients .76
Graphical User Interfaces and X .76
X on Linux 77
Setting Up X on Linux 78
Knowing Your Video Hardware before Configuring X.Org X11 78
Configuring X.Org X11 Using system-config-display 82
Examining the xorg.conf File 85
Understanding the Screen Section 87
Understanding the Device Section 88
Understanding the Monitor Section 89
Computing a ModeLine .91
Running X .93
Aborting X Using Ctrl-Alt-Backspace .94
Trying Different Video Modes .94
Adjusting the Display Settings .96
Summary 96
Trang 16
Chapter 4: Printer Setup 99
Configuring CUPS Print Queues .100
Using the Printer Configuration Tool .101
Administering Printers with the CUPS Web Interface 105
Learning the Printing Commands .107
Printing a File 108
Specifying Print Options .109
Controlling the Print Queue .110
Understanding the CUPS Printing System .111
Copying to the Printer: Brute-Force Printing .111
Printing the CUPS Way .111
Understanding the CUPS Configuration Files .113
Summary 117
Chapter 5: Sound Setup 119
Sound Cards Supported by Linux .120
Configuring the Sound Card .124
Checking Information about a Sound Card .125
Manually Configuring the Sound Card .126
Learning Sound Device Names .127
Testing the Sound Card 128
Playing Audio CDs .128
Troubleshooting Sound Cards .130
Summary 131
Chapter 6: Network Setup 133
Networking Basics 134
The OSI Seven-Layer Model .134
A Simplified Four-Layer TCP/IP Network Model .136
Network Protocols .136
Learning More about TCP/IP .137
TCP/IP and the Internet .137
Taking Stock of RFCs .138
Understanding IP Addresses .140
Routing TCP/IP Packets .145
Understanding the Domain Name System .146
TCP/IP Services and Client/Server Architecture .148
Understanding TCP/IP and Sockets 149
Performing Client/Server Communications with TCP/IP 151
Exploring Internet Services and Port Numbers 152
Running the xinetd Superserver .154
Starting Standalone Servers .158
TCP/IP Setup in Linux 159
Learning Network-Device Names .160
Using the Network Configuration Tool 160
Testing the Network 161
Using TCP/IP Configuration Files .162
Configuring Networks at Boot Time .165
Trang 17
TCP/IP Network Diagnostics .166
Looking at Network Interface Status .166
Viewing the IP Routing Table .167
Checking Connectivity to a Host .168
Checking Network Status 169
Using the ip Command .170
Summary 171
Part II: Exploring Linux .173
Chapter 7: Linux Basics 175
Starting Linux for the First Time .176
Controlling Linux with Boot Parameters .176
Configuring for the First Time with firstboot 177
Logging in at Graphical Login Screen .178
Logging Out .181
Shutting Down Linux .181
Looking up Online Documentation 182
Understanding the Linux File System 196
Using the Nautilus Shell .201
Navigating the File System with Linux Commands .203
Using Directory Navigation Commands .203
Showing the Current Directory in the Shell Prompt .204
Interpreting Directory Listings and Permissions .206
Learning the Bash Shell .208
Learning Shell Command Syntax .209
Combining Commands .210
Using I/O Redirection 211
Understanding Environment Variables .212
Viewing Process Information .214
Running Commands in the Background or in Virtual Consoles .215
Typing Less with Filename Completion .216
Using Wildcards in Filenames .217
Viewing the Command History .218
Editing Recalled Commands .219
Using Aliases .220
Summary 221
Chapter 8: GNU Utilities 223
An Overview of GNU Software .224
Core Utilities .227
Shell Utilities 227
File Utilities and the find Command .228
Text Utilities .234
Binary Utilities .237
Trang 18
Other Utilities 239
GNU bc 239
gzip 240
patch 241
Stream Editor — sed 243
Running sed .243
Learning the Basics of sed Commands .244
Summary 247
Chapter 9: GUI Desktops 249
Setting up a Graphical Login 250
Understanding How init Starts the Display Manager .250
Learning the GNOME Display Manager 252
Switching from GNOME to KDE 263
Learning the KDE Display Manager 264
Using GNOME 271
Taking Stock of GNOME .271
Exploring GNOME .272
Using KDE 277
Taking Stock of KDE .277
Exploring KDE .278
Summary 281
Chapter 10: Linux Applications and Utilities .283
Applications on the Companion DVD-ROM .284
Editors 285
Office Tools .287
Managing Your Inbox with Ximian Evolution .287
Writing with OpenOffice.org Writer .289
Preparing Spreadsheets with OpenOffice.org Calc .291
Presenting Information with OpenOffice.org Impress 292
Using Calculators .293
Commercially Available Office Applications for Linux .294
Multimedia 296
Accessing a Digital Camera 296
Burning Data CDs from Nautilus .297
Graphics and Images 298
Manipulating Images with the GIMP .298
Drawing Figures with xfig .301
Plotting Data with Gnuplot .301
Working with PostScript in Ghostscript .305
Viewing PostScript or PDF Files with KGhostview 307
Summary 309
Chapter 11: Text Processing .311
Text Editing with ed and vi 312
Using ed .313
Using vi .317
Trang 19
Working with GNU Emacs 324
Starting GNU Emacs .325
Learning GNU Emacs .326
Typing GNU Emacs Commands 326
Getting Help .327
Reading a File .329
Moving around the Buffer 329
Inserting and Deleting Text .330
Searching and Replacing .331
Copying and Moving .332
Saving Changes 333
Running a Shell in GNU Emacs .334
Writing man Pages with groff .334
Trying an Existing man Page 335
Looking at a man Page Source .337
Writing a Sample man Page .338
Testing and Installing the man Page 339
Preparing Documentation with DocBook .340
Getting Started with DocBook 341
Using Stylesheets .344
Learning Some DocBook Elements .345
Summary 350
Chapter 12: Basic System Administration 353
Revisiting Linux System Administration 354
Becoming root .355
Using the su - Command .356
Becoming Root for the GUI Utilities .356
Recovering from a Forgotten Root Password 356
Managing User Accounts 357
Using User Manager to Add User Accounts 358
Using Commands to Manage User Accounts 359
Understanding the /etc/passwd File .360
Managing Groups 361
Exploring the Server Settings Menu .362
Managing the File System .364
Mounting a Device on the File System .364
Examining the /etc/fstab File .366
Mounting a DOS/Windows File System .367
Mounting DOS Floppy Disks 368
Mounting an NTFS Partition .369
Using mtools 370
Trying mtools .370
The /etc/mtools.conf File .371
Learning the mtools Commands .372
Formatting a DOS Floppy .373
Summary 374
Trang 20
Part III: Internetworking Linux .377
Chapter 13: Internet Connection Setup 379
Deciding How to Connect to the Internet 380
Connecting with DSL .382
Connecting with a Cable Modem .386
Setting Up IEEE 802.11 Wireless Ethernet Networks 391
Understanding Wireless Ethernet Networks .391
Setting up the Wireless Hardware .395
Configuring the Wireless Access Point .396
Configuring Wireless Networking .396
Learning the Basics of Dial-up Networking .400
Understanding SLIP and PPP .401
Connecting to a Remote Network Using PPP .403
Understanding the PPP Configuration Files 405
Configuring CHAP and PAP Authentication 409
Testing the PPP Connection 410
Using IP Masquerading to Share an Internet Connection .411
Setting Up a PPP Server 412
Summary 414
Chapter 14: Web Server .417
Discovering the World Wide Web .418
Learning URLs .419
Understanding HyperText Transfer Protocol 421
Surfing the Net .423
Checking Out the Web Browsers in Linux .424
Starting Firefox .424
Learning Firefox’s User Interface .424
Setting Up the Apache Web Server .425
Learning More about the Apache Web Server .426
Installing the Apache Web Server 426
Configuring the Apache Web Server 428
Supporting Virtual Hosts with the Apache HTTP Server 436
Configuring Apache for Server-Side Includes .439
Supporting CGI Programs in Apache .440
Using Java Servlets with Apache .441
Installing Apache Tomcat 5 .442
Downloading and Installing the mod_jk Module 443
Connecting the Apache httpd Server to Tomcat .443
Testing Apache httpd with Tomcat 5 .444
Creating a Secure Server with SSL .444
Generating Digital Certificates .446
Testing the Secure Server .448
Summary 448
Trang 21
Chapter 15: Mail Server .451
Installing Mail Software .452
Understanding Electronic Mail 453
Understanding Mail Software .453
Learning More about sendmail .455
Using sendmail .455
Testing Mail Delivery .456
Understanding the Mail-Delivery Mechanism 457
Learning the sendmail Configuration File 459
Exploring Other sendmail Files 467
Using the forward File 470
Understanding the sendmail Alias File 472
Creating a sendmail Alias Mailing List .472
Filtering Spam with SpamAssassin .474
Starting SpamAssassin .475
Setting Up procmailrc .476
Summary 477
Chapter 16: News Server and RSS Feeds .479
Using Simple News Strategies .480
Installing News Software .481
Understanding Newsgroups .482
Reading News from Your ISP .482
Subscribing to Newsgroups .487
Posting to Newsgroups 487
Verifying Your Newsgroup Posting 488
Configuring and Starting the INN Server .488
Taking Stock of INN Components .489
Starting INN 493
Defining a Newsgroup Hierarchy .494
Updating Configuration Files .495
Adding the Newsgroups .495
Testing Your Newsgroups .496
Reading RSS Feeds 496
Examining an RSS Feed 496
Reading RSS Feeds 498
Summary 499
Chapter 17: FTP Server .501
Installing FTP Software .502
Understanding FTP .503
Using the Command-Line FTP Client 503
Using a Graphical FTP Client 507
Using a Web Browser as an FTP Client .508
Configuring the FTP Server 508
Learning the vsftpd Configuration Files .509
Using Anonymous FTP 512
Summary 514
Trang 22
Chapter 18: DNS and NIS 515
Using the Domain Name Service .516Understanding Hierarchical Domain Names .517Using the Berkeley Internet Domain Name System .518Configuring DNS .524Configuring a Caching Name Server .525Starting and Testing the Caching Name Server .534Configuring a Primary Name Server .536Using Network Information Service 537Setting Up an NIS Client .538Setting Up the NIS Server .541Testing NIS .544Summary 546
Chapter 19: Samba and NFS .547
Sharing Files with NFS .548Exporting a File System with NFS .549Mounting an NFS File System 551Setting Up a Windows Server Using Samba .552Checking Whether Samba Is Installed .553Configuring Samba .553Accessing Windows Resources with smbclient .556Learning More about Samba .558Summary 559
Part IV: Managing Linux 561
Chapter 20: Advanced System Administration 563
Understanding How Linux Boots .564Understanding the init Process 564Understanding the Linux initscripts 569Scheduling Jobs in Linux 578Scheduling One-Time Jobs 578Scheduling Recurring Jobs .580Backing Up and Restoring Files .583Selecting a Backup Strategy and Media .583Taking Stock of Commercial Backup Utilities for Linux .584Using the Tape Archiver .584Backing Up and Restoring a Multivolume Archive .586Backing Up on Tapes .587Performing Incremental Backups .587Managing Devices 588Understanding Device Drivers .588Persistent Device Naming with udev 590Managing Loadable Driver Modules .591Loading and Unloading Modules 591Understanding the /etc/modprobe.conf File .593
Trang 23
Managing USB Devices .594Monitoring System Performance .596Using top .596Using the GNOME System Monitor .599Using the vmstat Utility 600Checking Disk Performance and Disk Usage .601Exploring the /proc File System .602Using sysctl to View and Set Kernel Parameters .605Summary 611
Chapter 21: Software Installation and Update .613
Working with the Red Hat Package Manager .614Using the Package Management Utility 614Using the RPM Commands 616Building Software Packages from Source Files 623Downloading and Unpacking the Software .623Building the Software from Source Files .624Installing SRPMS .627Updating Fedora with the Update Agent .628Upgrading and Customizing the Linux Kernel .631Upgrading with a Fedora Kernel RPM .631Rebuilding the Kernel .633Summary 654
Chapter 22: System and Network Security .657
Establishing a Security Framework .658Determining Business Requirements for Security .660Performing Risk Analysis .660Establishing a Security Policy 661Implementing Security Solutions .662Managing Security Continuously 662Securing Linux 663Understanding the Host Security Issues .663Understanding Network Security Issues .664Learning Computer Security Terminology .664Securing the Host .668Installing Operating System Updates .668Securing Passwords 668Protecting Files and Directories .673Using exec-shield .676Using SELinux .677Encrypting and Signing Files with GnuPG .680Monitoring System Security .686Securing the Network .687Securing Internet Services .687Using Open Secure Shell for Remote Logins .690Setting Up Simple Firewalls .692Using NATs .699Enabling Packet Filtering in Linux .699
Trang 24
Performing Security Audits 704Understanding Computer Security Audits .704Using a Security Test Methodology .705Exploring Security-Testing Tools 713Keeping Up with Security News and Updates .717Summary 718
Part V: Programming Linux .721
Chapter 23: Software Development in Linux .723
Software Development Tools in Linux .724Using info for Help on GNU Tools .724Running the GNU C and C++ Compilers .727Using the GNU make Utility 731The GNU Debugger .738Preparing a Program for Debugging 739Running gdb .739Finding Bugs by Using gdb .741Fixing Bugs in gdb .743Implications of GNU Licenses .744Understanding the GNU General Public License .745Understanding the GNU Library General Public License 746Version Control .746Controlling Source Files Using RCS .746Performing Concurrent Version Control with CVS 752Linux Programming Topics .753Understanding the Executable and Linking Format .753Using Shared Libraries in Linux Applications .754Summary 759
Chapter 24: Shell and Perl Scripting 761
Looking at Some Shell Scripts .762Learning the Basics of Shell Scripting in Bash 764Writing a Simple Shell Script 765Getting an Overview of Bash Programming .766Taking Stock of Built-in Commands in Bash 769Perl as a Scripting Language .773Determining Whether You Have Perl .773Writing Your First Perl Script 774Learning More about Perl .775Getting an Overview of Perl .776Taking Stock of the Built-in Functions in Perl 792Understanding Perl Packages and Modules .801Using a Perl Module 802Using Perl Objects .803Summary 805
Trang 25
Chapter 25: Tcl/Tk Scripting 807
Introducing Tcl .808Writing Your First Tcl Script 808Getting More Information on Tcl/Tk 809Getting an Overview of Tcl .810Learning the Basic Tcl Syntax .811Understanding Tcl Variables .814Writing Expressions 814Using Control-Flow Commands in Tcl 815Writing Tcl Procedures .819Taking Stock of Built-in Tcl Commands .820Manipulating Strings in Tcl .823Using Arrays .824Accessing Environment Variables in Tcl .825Performing File Operations in Tcl .825Executing Linux Commands in Tcl .827Introducing Tk .827Saying “Hello, World!” in Tk .828Learning Tk Widget Basics .830Summary 841
Chapter 26: Java Programming .843
Getting Ready for Java Programming 844Using GCJ .845Downloading and Installing Java 2 SDK .846Taking Stock of the Java 2 SDK .847Writing Your First Java Program .849Writing a Standalone “Hello, World!” Program 849Writing a Simple Java Applet 850Learning Java .854Objects in Java .854Java Program Structure 861Primitive Data Types in Java .862Nonprimitive Data Types in Java .862String Type .863Arrays in Java .866Exception-Handling in Java .866Interfaces 867Threads in Java 868Writing GUI Applications in Java 871
An Overview of Swing .871Displaying a Calendar Using Swing .880Writing Java Servlets 888The Role of Java Servlets 889Tools to Develop Servlets .891Linking HTML Forms to Servlets .892
Trang 26
A Servlet That Reads an HTML Form 894Testing a Java Servlet with Sun Java System Application Server 898Becoming Proficient in Java .900Summary 901
Part VI: Appendixes .903
Appendix A: Linux Commands .905 Appendix B: Disk Drives .937 Appendix C: CD and DVD Drives .957 Appendix D: Ethernet Cards 967 Appendix E: Modems and Terminals 979 Appendix F: PC Cards .999 Appendix G: Linux Resources .1005 Appendix H: Fedora Upgrade Procedure .1009 Appendix I: About the DVD-ROM 1015
Index 1019 End-User License Agreement 1065
Trang 28
I am grateful to Debra Williams Cauley for giving me the opportunity to write Red Hat ®
Fedora ™ Linux ® Secrets ® Kenyon Brown guided me through the manuscript review processand kept everything moving I also really appreciate the thorough copy editing by the won-derful folks at Wiley
I thank John Kennedy for reviewing the manuscript for technical accuracy and providingmany useful suggestions for improving the book’s content
Thanks to everyone at Wiley Publishing, Inc., for transforming my raw manuscript intothis well-edited and beautifully packaged book
Of course, there would be no reason for this book if it were not for Linux For this, we haveLinus Torvalds and the legions of Linux developers around the world to thank Thanks tothe Fedora Project for continuing to develop and enhance the Linux distribution calledFedora Core and for making publicly available the ISO image used to create the DVD-ROM that is bundled with this book
Finally, and as always, my greatest thanks go to my wife, Leha, and our daughters, Ivy,Emily, and Ashley—it is their love and support that keep me going Thanks for beingthere!
Trang 30If you are new to using Linux, you need a practical guide that not only gets you goingwith the installation and setup of Linux but also shows you how to use Linux for specificfunctions, such as a Web server or a software development platform If you want to learnLinux, the practical guide should also include tutorials on how various parts of a Linux
system work behind the scenes Red Hat Fedora Linux Secrets is just the book to help you
learn Linux and use it productively
There are many capable Linux distributions that you could use to learn and use Linux.What this book offers is Fedora Core (also referred to as Fedora or Fedora Linux)—theable successor to the venerable Red Hat Linux and the testing ground for Red Hat’s com-mercial Linux offering, Red Hat Enterprise Linux Fedora Core is a full-fledged Linux dis-tribution with all the desktop and server components you need for every conceivable taskyou expect a Linux system to do You have the choice of GNOME and KDE desktops Forproductivity applications, Fedora includes the Firefox Web browser, Evolution personalinformation manager, and the OpenOffice.org office suite As for servers, Fedora comeswith the standard suite of Apache Web server, Tomcat Java application server, Sendmailmail server, Samba Windows server, Bind domain name server, and many more
Red Hat Fedora Linux Secrets follows the successful model of the “Secrets” series and
highlights crucial, less-known facts as “secrets.” The focus is on providing insights intothe inner workings of Linux—which configuration files control what, which commands totype in what sequence to perform a key task, and so on In addition to these insights, thebook provides all the usual information on many of the applications—such as email, theWeb, and news, plus graphics and text utilities—that are included on the book’s compan-ion DVD-ROM
The book’s companion DVD-ROM comes with the binaries for the latest release of Fedora
as well as all the source code The DVD-ROM is packed with all the software you need toturn your PC into a powerful Linux desktop and server The book provides detailed tech-nical information on installing and customizing Linux for use with various types of com-puters and peripherals
The unique aspects of Red Hat Fedora Linux Secrets are the details of how things work
behind the scenes The book includes tutorials, tips, techniques, shortcuts, and known facts about using Linux in various real-world tasks that range from simply learn-ing UNIX commands to setting up a secure, Java-capable Web server for your business
little-By reading this book you can:
Learn how to install and set up Linux from the DVD-ROM included with thebook
Learn how to use various peripherals (video cards, hard disks, and networkcards) in Linux
Learn about dial-up networking (with SLIP and PPP) under Linux
Get tips, techniques, and shortcuts for specific uses of Linux, such as:
• Setting up and using Internet services such as Web, Mail, News, FTP (FileTransfer Protocol), NFS (Network File System), NIS (Network InformationService), and DNS (Domain Name Service)
• Setting up a Windows server using Samba
Trang 31• Learning UNIX on Linux
• Learning Perl, shell, and Tcl/Tk programming on Linux
• Learning Java programming on Linux
Understand the basics of system and network security
Learn to perform system and network administration tasks
Receive many Linux tools and utilities
Learn about Linux resources that can serve as continuing sources of information
in the ever-changing world of Linux
Learn how to download the latest release of Fedora and burn a DVD-ROM fromthe downloaded ISO file
Organization of the Book
Red Hat Fedora Linux Secrets contains 26 chapters and 9 appendixes and is organized
into 6 parts covering topics such as installation and setup, routine use, networking andserver setup, system administration, and programming
Part I: Setting Up Linux
Part I includes six chapters that introduce you to Linux, guide you through Linux tion, and show you how to configure various types of hardware in Linux The first chapterprovides an overview of Linux in general The second chapter takes you through the stepsneeded to install Linux from this book’s companion DVD-ROM The next four chaptersexplain how to configure the X Window System, printers using the Common Unix PrintingSystem (CUPS), and sound and network components
installa-Part II: Exploring Linux
This part acquaints you with Linux The six chapters in this section describe the popularGNU utilities, the GUI desktops—GNOME and KDE, and the applications included withLinux on the companion DVD-ROM You will also learn how to edit text files, prepareDocBook documentation, and perform basic systems administration functions
Part III: Internetworking Linux
The seven chapters in Part III focus on connecting the Linux system to the Internet andsetting up various Internet services on the system After describing dial-up networking,the chapters in this part walk you through the setup and configuration of a number ofservers including Web, FTP, SMTP (Simple Mail Transfer Protocol for mail), news, DNS,NIS, NFS, and Samba
Part IV: Managing Linux
The three chapters in Part IV cover systems administration and security The first chapter
in this part, Chapter 20, starts by discussing a number of advanced system administrationtopics The next two chapters show you how to install and upgrade software using theRed Hat Package Manager (RPM), how to build software from source files, how to rebuildand install a new kernel, and how to secure the system and the network
Trang 32
Part V: Programming Linux
The four chapters in Part V turn to the subject of programming in Linux The first chapter,Chapter 23, covers the basics as well as a number of software development tools and theGNU Public License that affects software developed in Linux Then, that chapter brieflytouches on C and C++ programming The next two chapters cover scripting using theshell, Perl, and Tcl/Tk Finally, the last chapter in this section introduces you to writingapplet, servlets, and standalone applications using Java
Part VI: Appendixes
This section includes nine appendixes:
Appendix A, “Linux Commands,” presents alphabetically arranged referenceentries for the many commonly used Linux commands
Appendix B, “Disk Drives,” describes IDE and SCSI disk controllers and listsdriver modules needed for specific SCSI controllers
Appendix C, “CD and DVD Drives,” lists specific types of Linux-supportedCD-ROM drives, categorized by interface type
Appendix D, “Ethernet Cards,” describes the physical setup of an Ethernet LANand lists the Ethernet cards that Linux supports
Appendix E, “Modems and Terminals,” explains how to connect, set up, and usemodems and terminals in Linux
Appendix F, “PC Cards,” briefly describes PC Cards that use the PCMCIA face and the PCMCIA support package for Linux
inter- Appendix G, “Linux Resources,” lists resources on the Internet where you canobtain the latest information about Linux
Appendix H, “Fedora Upgrade Procedure,” explains how to download andupgrade your system to the latest Fedora Linux release
Appendix I, “About the DVD-ROM,” summarizes the contents of the book’scompanion DVD-ROM
If you are a new user, you should start by reading Part I, which guides you throughinstalling Linux from the DVD-ROM that accompanies the book (see Appendixes H and Ialso) If you have specific hardware questions, you should go directly to the relevantappendix (see Appendixes B through F) If you have already installed Linux, you mightwant to begin with Part II, where you’ll learn how to make the most of Linux in everydayuse (see Appendix G also) For questions related to Internet services, consult the appro-priate chapter in Part III Part IV gets you going with various systems administration tasksand explains how to maintain system and network security To learn about programming
in specific languages, consult the relevant chapters in Part V When you need information
on a specific Linux command, turn to Appendix A and look for that command in thealphabetically arranged reference entries
Conventions Used in This Book
Red Hat Fedora Linux Secrets uses a simple notational style All listings, filenames,
func-tion names, variable names, and keywords are typeset in a monospaced fontfor ease of
reading The first occurrences of new terms and concepts are in italic Text you are
directed to type is in boldface The output of commands follows the typed command and
the output is shown in a monospaced font
Trang 33
Each chapter starts with a short list that highlights the “secrets” you will find in that ter The summary at the end of the chapter tells you a bit more about what the chaptercovered.
chap-Following in the time-honored tradition of the “Secrets” series, I use icons to help youquickly pinpoint useful information The icons include the following:
The Note icon marks a general interesting fact—something that I thought you’d like toknow
The Insider Insight icon marks things that you should know to make your job easierand to work smarter
The Caution icon highlights potential pitfalls With this icon, I’m telling you: “Watch out!This could hurt your system!”
The Cross-Reference icon points out other chapters in the book for a deeper discussion
of a specific topic
cross ref caution
insider
insight
About the Companion DVD-ROM
Red Hat Fedora Linux Secrets addresses the needs of new users who want to put Linux to
some productive use on their home or office PC To ensure that readers have everythingthey need to start using Linux, this book includes a copy of Fedora on the companionDVD-ROM Fedora is a well-known Linux distribution that’s easy to install and is wellsupported by a community of developers (http://fedora.redhat.com)
See Appendix I for a summary description of the contents of the companion DVD-ROM
To learn how to download a newer version of Fedora and burn your own DVD, seeAppendix H As you browse the contents of the DVD-ROM, you’ll notice that there is ahuge amount of software included in Linux The long list of software shouldn’t overwhelm
The Secret icon marks facts that explain the inner working of some aspect of Linuxand related software These are details that may not be that well-documented, butare important to know It’s not that no one knows this fact—it’s just hard to find; andknowing this fact usually clears up many other questions that you may have Thisicon also marks technical information that will be of interest to an advanced user
Secret
Trang 34you You have to learn to use only what you need Besides, this book will show you how toinstall Linux and use most of this software.
If you have enough space (at least 5GB) available on your PC’s hard disk (or, better yet, aspare second hard disk) and your PC can boot from the DVD drive, Linux installation can
be as simple as plopping the DVD-ROM into the DVD drive, booting the PC, and filling
up information in a series of dialog boxes You don’t have to take my word for it—you cansee for yourself
It’s time to get started on your Linux adventure Take out the companion DVD-ROM, turn
to Chapter 1, and let the fun begin Before you know it, you’ll be a Linux expert!
I hope you enjoy this book as much as I enjoyed writing it!
Trang 36Part I
Setting Up Linux
Chapter 1: An Overview of Linux Chapter 2: Linux Installation Chapter 3: X Window System Setup
Chapter 4: Printer Setup Chapter 5: Sound Setup Chapter 6: Network Setup
Trang 38An Overview
of Linux
Secrets in This Chapter
Red Hat, Fedora Project, and Fedora Core 4 Dynamic Device Files with udev 8 Linux as a UNIX Platform 9 Posix Compliance 10 Linux Standard Base (LSB) 11 Linux Desktop 13
Chapter1
Trang 39The world of operating systems changed forever when Linus Torvalds of theUniversity of Helsinki in Finland decided to build a UNIX-like operating system forthe PC What started as a simple task-switching example, with two processes that printedAAAA and BBBB on a dumb terminal, has grown into a full-fledged, multitasking,multiuser operating system that rivals commercially available UNIX systems for Intel80x86 systems Many programmers around the world have contributed code and collabo-rated to bring Linux to its current state With the release of version 1.0 in March 1994,Linux became an operating system of choice for UNIX enthusiasts, as well as for peoplelooking for a low-cost UNIX platform for a specific purpose, such as developing software
or running an Internet host
This chapter provides a broad-brushstroke picture of Linux and describes how you canget the most out of the built-in capabilities of Linux, such as networking, developing soft-ware, and running applications
After you overcome your initial fear of the unknown and install Linux, you will see how youcan use it to turn your PC into a UNIX workstation The best part is that you can get Linuxfor free — just download it from one of several Internet sites (for example, you’ll find links tomany Linux distributions at the Distrowatch.com website at www.distrowatch.com) Thebest way for beginners and experts alike to get started, though, is to buy a book (such asthis one) that comes with a Linux distribution on a DVD This book is your guide to the innerworkings of Linux The next chapter shows how to install Linux, and subsequent chaptersdescribe specific tasks (such as connecting to the Internet or developing software) that youmay want to perform with your Linux PC In addition to many utilities with graphical userinterfaces (GUIs), this book provides you the details such as what commands to use andwhat configuration files to edit
What Is Linux?
Linux is a freely available UNIX-like operating system that runs on a wide variety of tems Linus Torvalds and other programmers originally developed Linux for the Intel80x86 processor Nowadays, Linux is also available for systems based on other processors,such as those with AMD’s 64-bit AMD64 processors, the Motorola 68000 family; AlphaAXPs; Sun SPARCs and UltraSPARCs; Hewlett-Packard’s HP PA-RISC; the PowerPC andPowerPC64 processors; and the MIPS R4x00 and R5x00 More recently, IBM has releasedits own version of Linux for its S/390 and zSeries mainframes This book covers FedoraCore — a Linux distribution for the Intel 80x86 and Pentium processors (these are known
sys-as the IA32 architecture processors, or i386, because they support the instruction set of the
80386 processor) Fedora Core evolved from Red Hat Linux, which was a freely availableand popular Linux distribution from Red Hat
Red Hat, Fedora Project, and Fedora Core
In late September 2003, Red Hat announced the Fedora Project — an open-sourceproject sponsored by Red Hat where the developer community can participate andcontinue to evolve what used to be the Red Hat Linux product (Red Hat Linux 9 wasthe last version of that product line) The new Linux distribution from the Fedora
Project goes by the name Fedora Core (or, simply, Fedora) and the project is
expected to have Fedora Core releases every four to six months Red Hat will tinue to participate in the Fedora Project and help prepare the Fedora Core releases,
con-Secret
Trang 40Fedora Core is a specific Linux distribution A Linux distribution is essentially a package
consisting of the Linux operating system and a collection of applications, together with aneasy-to-use installation program All Linux distributions include the core Linux operatingsystem (the kernel); the X Window System (graphical user interface); one or more graph-ical desktops, such as GNOME and KDE; and a large selection of applications Everythingcomes in ready-to-run binary format, but the source code and documentation are alsoavailable By now, each Linux distribution includes so much software that it comes onmultiple CD-ROMs or a DVD-ROM For example, this book comes with a DVD-ROM con-taining the full Fedora Core Linux distribution, including the source code
Some Linux distributions such as Red Hat Enterprise Linux and SUSE Linux are cial Linux distributions The GNU (which stands for “GNU’s Not UNIX”) General PublicLicense that applies to Linux allows for such commercial, for-profit distribution, butrequires that the software be distributed in source-code form, and stipulates that anyonecan copy and distribute the software in source-code form to anyone else
commer-Both the Linux kernel and Fedora Core Linux have gone through a number of versions.The version numbers are unrelated, but each has particular significance
Linux Kernel Version Numbers
After Linux version 1.0 was released on March 14, 1994, the loosely organized Linux
development community adopted a version-number scheme Versions 1.x.y and 2.x.y, where x is an even number, are stable versions The y number is the patch level, which is
incremented as problems are fixed Notice that these version numbers are of the form
Major.Minor.Patch, where Major and Minor are integers denoting the major and minor
version numbers, and Patch is another integer representing the patch level.
Versions 2.x.y with an odd x number are beta releases for developers only; they may be
unstable, so you should not adopt these versions for day-to-day use Developers add newfeatures to these odd-numbered versions of Linux
At the time of this writing, the latest stable version of the Linux kernel is 2.6.11 (note thatinformation about the latest version of the Linux kernel is available at www.kernel.org/).This book’s companion DVD-ROM contains the latest version of the Linux kernel as ofSpring 2005
but everything will be done with the involvement of the open source communityunder a public release schedule As you might expect, Fedora Core is available freely,just as Red Hat Linux used to be, and you can expect books such as this one toinclude Fedora Core on DVD or CDs
Red Hat anticipates that new technologies and enhancements that first appear inFedora Core will eventually find their way into Red Hat Enterprise Linux — the com-mercial Linux offering from Red Hat In this way, the Fedora Project should serve as
an incubator and testing ground for future Linux development This means that bylearning what’s in Fedora Core, you can keep up with (or, more accurately, stay aheadof) the latest developments in Red Hat Enterprise Linux
To learn more about the Fedora Project and the latest Fedora Core releases, visit theFedora Project’s home page at http://fedora.redhat.com