Tải bản đầy đủ (.doc) (1,509 trang)

Red Hat Linux

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (2.55 MB, 1,509 trang )

i
201 West 103rd Street
Indianapolis, IN 46290
David Pitts, et al.
Red Hat
LinuxSecond Edition
Red Hat Linux, Second Edition
UNLEASHED
ii
Publisher Dean Miller
Executive Editor Jeff Koch
Managing Editor Sarah Kearns
Senior Indexer Ginny Bess
Director of Software
and User Services Cheryl Willoughby
Brand Director Alan Bower
This book is dedicated to TM3 and
Associates. Thanks, guys
(non-gender)!!
—David Pitts
Copyright © 1998 by Sams Publishing
SECOND EDITION
All rights reserved. No part of this book shall
be reproduced, stored in a
retrieval system, or transmitted by any
means, electronic, mechanical,
photocopying, recording, or otherwise,
without written permission from the
publisher. No patent liability is assumed with
respect to the use of the
information contained herein. Although every


precaution has been taken in
the preparation of this book, the publisher
and author assume no responsibility
for errors or omissions. Neither is any liability
assumed for damages
resulting from the use of the information
contained herein. For information,
address Sams Publishing, 201 W. 103rd St.,
Indianapolis, IN 46290.
International Standard Book Number: 0-672-
31173-9
Library of Congress Catalog Card Number:
97-68008
01 00 99 98 4 3 2 1
Interpretation of the printing code: The
rightmost double-digit number is
the year of the book’s printing; the rightmost
single digit, the number of the
book’s printing. For example, a printing code
of 98-1 shows that the first
printing of the book occurred in 1998.
Composed in AGaramond and MCPdigital by
Macmillan Computer
Publishing
Printed in the United States of America
Trademarks
All terms mentioned in this book that are
known to be trademarks or
service marks have been appropriately
capitalized. Sams Publishing cannot

attest to the accuracy of this information.
Use of a term in this book should
not be regarded as affecting the validity of
any trademark or service mark.
Red Hat Linux is a trademark of Red Hat
Software.
Acquisitions Editor
Cari Skaggs
Development Editors
Mark Cierzniak
Richard Alvey
Software Development Specialist
Jack Belbot
Project Editor
Dana Rhodes Lesh
Copy Editors
Carolyn Linn, Kate Talbot,
Michael Brumitt, Chuck
Hutchinson, Nancy Albright
Indexer
Cheryl Jackson
Technical Reviewers
Bill Ball, Sriranga R.
Veeraraghavan, Robin Burk
Editorial Coordinators
Mandie Rowell
Katie Wise
Technical Edit Coordinator
Lynette Quinn
Resource Coordinators

Charlotte Clapp
Deborah Frisby
Editorial Assistants
Carol Ackerman, Andi Richter,
Rhonda Tinch-Mize,
Karen Williams
Cover Designer
Jason Grisham
Cover Production
Aren Howell
Book Designer
Gary Adair
Copy Writer
David Reichwein
Production Team Supervisor
Beth Lewis
Production
Bryan Flores, Julie Geeting,
Kay Hoskin, Christy M.
Lemasters, Darlena Murray,
Julie Searls, Sossity Smith
Overview iii
Introduction xxiii
Part I Introduction and Installation of Linux
1 Introduction to Red Hat Linux and UNIX 3
2 Installation of Your Red Hat System 11
3 LILO 27
Part II Configuring Other Servers
4 System Startup and Shutdown 37
5 Configuring and Building Kernels 53

6 Common Desktop Environment 75
7 SMTP and POP 97
8 FTP 131
9 Apache Server 153
10 X Window 175
Part III Hardware Connectivity and Devices
11 Filesystems, Disks, and Other Devices
195
12 Printing with Linux 229
13 TCP/IP Network Management 243
Part IV System Administration and
Management
14 Getting Started with Red Hat Linux 299
15 Essential System Administration 319
16 Advanced System Administration 341
17 GNU Project Utilities 351
18 Backup and Restore 373
Part V Dealing with Others
19 User Accounts and Logins 383
20 System Security 395
21 Shell Programming 411
Red Hat Linux, Second Edition
UNLEASHED
iv
Part VI Automation, Programming, and
Modifying Source Code
22 Automating Tasks 437
23 C and C++ Programming 455
24 Perl Programming 487
25 tcl and tk Programming 499

26 Motif Programming 529
27 gawk Programming 545
28 Network Programming 583
Part VII Appendixes
A The Linux Documentation Project 607
B Top 50 Linux Commands and Utilities 611
C The Linux Documentation Project Copyright
License 629
D Glossary 633
E What’s on the CD-ROM 653
Index 655
v Contents
Introduction xxiii
Part I Introduction and Installation of Linux
1 Introduction to Red Hat Linux and
UNIX 3
Advantages of
Linux ...............................................................
.......... 5
Copyright and
Warranty ........................................................
.......... 7
Where to Get Red Hat
Linux ........................................................... 7
System
Requirements .................................................
...................... 7
System Requirements—
Intel ....................................................... 8
System Requirements—

SPARC................................................... 8
System Requirements—
Alpha ..................................................... 8
Summary.........................................................
................................. 9
2 Installation of Your Red Hat System
Be Prepared, Be Very
Prepared! ......................................................
12
Installing Red Hat
Linux ...............................................................
. 13
Creating the Boot and Supplemental
Disks ............................... 13
Installing Without Using a Boot
Floppy .................................... 14
Virtual
Consoles .........................................................
............... 14
Dialog
Boxes ..............................................................
................ 14
Step-by-Step
Installation ......................................................
.......... 15
Booting ...........................................................
........................... 15
The Installation
Program ..........................................................
. 15

Selecting an Installation
Method ............................................... 17
CD-ROM
Installation ......................................................
......... 17
The Red Hat Package
Manager ......................................................
25
RPM
Usage .............................................................
.................. 25
Summary.........................................................
............................... 26
3 LILO 27
Installing and Configuring
LILO ................................................... 28
Configuring
LILO ................................................................
..... 29
Using LOADLIN.EXE to Boot
Linux ................................................. 33
How to Uninstall
LILO ................................................................
. 33
Summary.........................................................
............................... 33
Part II Configuring Other Servers
4 System Startup and Shutdown 37
The Boot
Process............................................................

................ 38
The Initialization Process and Startup
Scripts ................................. 38
init and /etc/inittab
............................................................. 39
/etc/inittab and System
States ............................................... 40
Red Hat Linux, Second Edition
UNLEASHED
vi
tksysv and Managing Your
Services .............................................. 43
Shutting Down the Linux
System .................................................. 44
shutdown ........................................................
........................... 44
halt and reboot
........................................................................
45
When the System
Crashes ..........................................................
.... 46
Running as
Root ................................................................
........ 47
Creating a Boot
Disk ................................................................
. 47
Your File
Toolbox ...........................................................

.......... 48
Red Hat to the Rescue! When the System
Won’t Boot .............. 49
For More
Information .....................................................
.......... 50
Summary.........................................................
............................... 51
5 Configuring and Building Kernels 53
An Introduction to the Linux
Kernel.............................................. 54
Acquiring the Source
Tree ......................................................... 55
Patching the Source
Tree ........................................................... 57
Modules ..........................................................
.......................... 57
Configuring the Linux
Kernel ........................................................ 58
Starting the
Configuration ..................................................
....... 58
Stepping Through the
Menus .................................................... 59
Final Notes About
Configuration ..............................................
70
Building the
Kernel .............................................................
........... 70

Installing the
Kernel .............................................................
.......... 72
Recovering from Faulty
Kernels ..................................................... 73
Summary.........................................................
............................... 73
6 Common Desktop Environment 75
Installation ......................................................
............................... 76
Getting Started with the
CDE ........................................................ 77
Logging in to the
CDE ..............................................................
77
The Desktop
Environment ...................................................
..... 78
Customizing Your
Session ...........................................................
... 81
The Style
Manager..........................................................
........... 81
The Front
Panel ..............................................................
.......... 82
Advanced
Customizations................................................
.......... 84

Creating New
Actions.............................................................
... 87
Creating and Modifying
Subpanels ............................................ 90
Restoring a Session When Something Goes
Wrong ................... 91
Executing Applications and Commands at
Login ...................... 92
Executing Commands at
Logout ............................................... 93
The Help
Viewer ............................................................
................ 93
Using the Help
Viewer ............................................................
.. 93
Context-Sensitive
Help ..............................................................
93
vii
Adding Help to
Icons ...............................................................
. 94
Help
Topics .............................................................
.................. 95
Summary.........................................................
............................... 96
7 SMTP and POP 97

SMTP ...............................................................
............................. 98
Internet Mail
Protocols .........................................................
..... 99
The Domain Name System and E-
mail ................................... 100
sendmail’s
Jobs .................................................................
...... 104
sendmail’s Auxiliary
Files ........................................................ 105
The Aliases
File ..................................................................
...... 105
Setting Up sendmail
............................................................... 106
sendmail.cf—The Configuration
File .................................... 109
Testing sendmail and sendmail.cf
......................................... 123
POP .................................................................
............................ 124
Configuring a POP
Server .......................................................
125
Managing
Bulletins .........................................................
......... 128
Summary.........................................................

............................. 129
8 FTP 131
Getting and Installing the FTP
Server .......................................... 132
How the FTP Server
Works .........................................................
133
Configuring Your FTP
Server ...................................................... 134
Controlling Access—The /etc/ftpaccess
File ....................... 135
Converting Files On-the-Fly—The
/etc/ftpconversions File 147
Configuring Host Access—The /etc/ftphosts
File ............... 149
The FTP Log File—/var/log/xferlog
................................... 150
FTP Administrative
Tools ............................................................
151
ftpshut ............................................................
....................... 151
ftpwho ............................................................
......................... 151
ftpcount ..........................................................
....................... 152
Summary.........................................................
............................. 152
9 Apache Server 153
Server

Installation ......................................................
................... 154
Runtime Server Configuration
Settings ........................................ 155
Editing httpd.conf
................................................................. 155
Editing srm.conf
.....................................................................
158
Editing access.conf
............................................................... 158
Configuring an inetd
Server ........................................................
159
Configuring inetd
...................................................................
160
Running the Web Server for the First
Time ................................. 162
Starting a Standalone
Server .................................................... 163
Starting an inetd
Server ..........................................................
163
Contents
Red Hat Linux, Second Edition
UNLEASHED
viii
Starting and Stopping the
Server .................................................. 163

The start
Script ..............................................................
....... 164
The stop
Script ..............................................................
......... 164
The restart
Script ..............................................................
.... 164
Configuration File
Listings ...........................................................
165
Summary.........................................................
............................. 173
10 X Window 175
Setting Up Your XFree86
System ................................................. 176
The XF86Config
File ..................................................................
.. 176
Using Xconfigurator
...................................................................
177
Examining the XF86Config
File .................................................... 177
The File
Pathnames .....................................................
............ 178
The Keyboard
Section ...........................................................

.. 179
The Pointer
Section ...........................................................
...... 179
The Server
Section ...........................................................
........ 181
Setting Up Video
Modes .........................................................
182
International Keyboard Layout for
XFree86 ............................ 184
The .xinitrc
File ..................................................................
...... 185
The Personal X Resource
File ....................................................... 186
Using xdm
........................................................................
............. 187
Configuration of the Window
Manager ....................................... 188
Compiling Programs That Use
X ................................................. 188
Some Common
Problems ........................................................
.... 189
Compiling Sources for
XFree86 ................................................... 190
Summary.........................................................

............................. 191
Part III Hardware Connectivity and Devices
11 Filesystems, Disks, and Other
Devices 195
Block
Devices ...........................................................
.................... 197
Filesystems .....................................................
.............................. 197
The mount
Command .......................................................
........... 198
Setting Up
Filesystems .....................................................
............ 202
The Red Hat File System
Manager .......................................... 202
Editing /etc/fstab
Manually ................................................. 203
Creating New
Filesystems .....................................................
....... 204
Repairing
Filesystems .....................................................
.............. 207
Hardware ........................................................
............................. 209
Hard
Disks ...............................................................
............... 209

Floppy
Disks ...............................................................
............ 211
CD-ROM
Drives .............................................................
....... 212
Loopback
Devices ...........................................................
......... 213
Other Block
Devices ...........................................................
..... 215
ix
Character
Devices ...........................................................
............. 217
Parallel
Ports ...............................................................
............. 217
Tape
Drives .............................................................
................ 218
Terminals ........................................................
........................ 220
Serial
Communications .............................................
.............. 222
Generic SCSI
Devices ...........................................................
... 223

CD-ROM
Recorders .......................................................
........ 224
Testing CD
Images ............................................................
...... 224
Other Character
Devices..........................................................
224
Summary.........................................................
............................. 228
12 Printing with Linux 229
Printer
Devices ...........................................................
.................. 230
How Do I
Print? ..............................................................
............ 231
The RHS Linux Print System
Manager ........................................ 232
Remote and LAN
Printers .......................................................
232
Local
Printers ...........................................................
................ 233
Linux Printing
Commands .....................................................
...... 234
Simple

Formatting ......................................................
................. 235
Other Helpful Printer Programs and
Filters ................................. 236
APSfilter ..........................................................
........................ 236
BubbleTools ....................................................
........................ 236
magicfilter ......................................................
.......................... 236
PostScript
Printers ...........................................................
........ 237
Enhanced Printer
Spooler ........................................................
237
System
Accounting .....................................................
............. 237
Some Program
Tips .................................................................
..... 237
emacs .............................................................
.......................... 237
Applixware for
Linux ...............................................................
238
Other Helpful
Programs ........................................................
....... 239

xv....................................................................
......................... 239
pbm
Utilities ...........................................................
.................. 240
Ghostview .......................................................
........................ 240
For More
Information .....................................................
............. 240
Summary.........................................................
............................. 241
13 TCP/IP Network Management 243
An Introduction to
Networking ...................................................
244
What Is an IP
Number? .........................................................
.. 244
A TCP/IP
Primer .............................................................
....... 244
Subnetworking ...............................................
......................... 246
Determining the Broadcast
Address ......................................... 247
The Next Generation of IP,
IPv6 ............................................. 247
Getting a New IP
Address .......................................................

248
Contents
Red Hat Linux, Second Edition
UNLEASHED
x
The Network Card
Solution ........................................................
249
Stock Network
Configuration .................................................
250
Using ifconfig
.......................................................................
254
Using route
........................................................................
..... 256
The Domain Name
Service ..........................................................
258
Before DNS—The /etc/hosts
File ........................................ 258
Configuring the DNS Client: /etc/resolv.conf
.................... 259
The Software of
DNS ..............................................................
259
Configuring DNS
Servers ........................................................
261

The Network Information
Service ................................................ 269
A Brief
History ............................................................
............ 269
Understanding
NIS .................................................................
270
Configuring a Master NIS
Server ............................................. 271
Configuring an NIS
client ....................................................... 274
Configuring an NIS Secondary
Server ..................................... 276
The Network File
System ...........................................................
.. 280
Installing
NFS .................................................................
........ 281
Starting and Stopping the NFS
daemons ................................. 282
Configuring
NFS .................................................................
.... 282
Connecting to the Net with
PPP .................................................. 288
Simple
Client ..............................................................
............. 289

On-Demand
Dialing ............................................................
... 293
Summary.........................................................
............................. 294
Part IV System Administration and
Management
14 Getting Started with Red Hat Linux
299
Organization ...................................................
............................. 300
/bin and /sbin
........................................................................
300
/etc
........................................................................
................. 301
/home
........................................................................
............... 303
/mnt
........................................................................
................. 303
/tmp and /var
........................................................................
.. 303
/usr
........................................................................
................. 304
RPM ................................................................

............................ 305
Major Modes and Common
Options ...................................... 305
Installing
Packages ........................................................
........... 306
Upgrading
Packages ........................................................
......... 309
Uninstalling
Packages ........................................................
...... 309
Querying
Packages ........................................................
........... 310
Verifying
Packages ........................................................
........... 313
Introduction to
glint ................................................................
314
Summary.........................................................
............................. 317
xi
15 Essential System Administration 319
Handling the All-Powerful Root
Account .................................... 320
Maintaining the System—Implementing
Changes ....................... 321
Planning

Processes .......................................................
............ 322
Creating a Back-Out
Plan ........................................................ 322
Making Changes in Small
Increments...................................... 322
Developing a Test
Plan ............................................................
323
Communicating Effectively and in a Timely
Manner .............. 323
Getting
Help ................................................................
................ 328
Man
Pages ..............................................................
................. 329
E-
mail ................................................................
...................... 331
Red Hat Mailing Lists and
Newsgroups ................................... 332
Other
Newsgroups.....................................................
.............. 334
Problem Solving—
Logs ................................................................
335
login.access ....................................................
...................... 336

Other Files That Deny or Allow Users or Hosts
...................... 337

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

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