Upper Saddle River, NJ • Boston • Indianapolis • San Francisco
New York • Toronto • Montreal • London • Munich • Paris • Madrid
Capetown • Sydney • Tokyo • Singapore • Mexico City
Linux
Administration
Handbook
®
Evi Nemeth
Garth Snyder
Trent R. Hein
with Lynda McGinley, Ben Whaley,
Adam Boggs, Jeffrey S. Haemer, Tobi Oetiker,
Fritz Zaucker, Scott Seidel, Bryan Buus,
Ned McClain, and David Schweikert
SECOND EDITION
Many of the designations used by manufacturers and sellers to distinguish their products are
claimed as trademarks. Where those designations appear in this book, and the publisher was aware
of a trademark claim, the designations have been printed with initial capital letters or in all capitals.
Red Hat Enterprise Linux and the Red Hat SHADOWMAN logo are registered trademarks of Red
Hat Inc., and such trademarks are used with permission.
Ubuntu is a registered trademark of Canonical Limited, and is used with permission.
Fedora is a trademark of Red Hat Inc., and is used with permission.
Novell, the Novell logo, the N logo, and SUSE are registered trademarks of Novell Inc. in the United
States and other countries.
The authors and publisher have taken care in the preparation of this book, but make no expressed
or implied warranty of any kind and assume no responsibility for errors or omissions. No liability
is assumed for incidental or consequential damages in connection with or arising out of the use of
the information or programs contained herein.
The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases
or special sales, which may include custom covers and content particular to your business, training
goals, marketing focus, and branding interests. For more information, please contact:
U.S. Corporate and Government Sales
(800) 382-3419
corpsales@pearsontechgroup.com
For sales outside the United States, please contact:
International Sales
international@pearsoned.com
Visit us on the Web: www.prenhallprofessional.com
Library of Congress Cataloging-in-Publication Data
Nemeth, Evi.
Linux administration handbook / Evi Nemeth, Garth Snyder, Trent R.
Hein.—2nd ed.
p. cm.
Includes index.
ISBN 0-13-148004-9 (pbk. : alk. paper)
1. Linux. 2. Operating systems (Computers) I. Snyder, Garth. II. Hein, Trent R. III. Title.
QA76.76.O63N448 2006
005.4'32—dc22
2006030150
Copyright © 2007 Pearson Education, Inc.
All rights reserved. Printed in the United States of America. This publication is protected by copy-
right, and permission must be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical,
photocopying, recording, or likewise. For information regarding permissions, write to:
Pearson Education, Inc.
Rights and Contracts Department
One Lake Street
Upper Saddle River, NJ 07458
Fax: (201) 236-3290
ISBN 0-13-148004-9
Text printed in the United States on recycled paper at Courier in Stoughton, Massachusetts.
First printing, October 2006
iii
Contents
FOREWORD TO THE FIRST EDITION xxxiii
PREFACE xxxiv
ACKNOWLEDGMENTS xxxvii
SECTION ONE: BASIC ADMINISTRATION
CHAPTER 1WHERE TO START 3
Suggested background. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Linux’s relationship to UNIX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Linux in historical context. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Linux distributions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
So what’s the best distribution? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Distribution-specific administration tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Notation and typographical conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
System-specific information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Where to go for information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Organization of the man pages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
man: read manual pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Other sources of Linux information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
How to find and install software. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
iv Linux Administration Handbook
Essential tasks of the system administrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Adding, removing, and managing user accounts . . . . . . . . . . . . . . . . . . . . . . . . 16
Adding and removing hardware. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Performing backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Installing and upgrading software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Monitoring the system. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Maintaining local documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Vigilantly monitoring security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Helping users. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
System administration under duress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
System Administration Personality Syndrome . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Recommended reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Exercises. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
CHAPTER 2BOOTING AND SHUTTING DOWN 21
Bootstrapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .21
Automatic and manual booting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Steps in the boot process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Kernel initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Hardware configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Kernel threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Operator intervention (manual boot only). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Execution of startup scripts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Multiuser operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Booting PCs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Using boot loaders: LILO and GRUB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
GRUB: The GRand Unified Boot loader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
LILO: The traditional Linux boot loader. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Kernel options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Multibooting on PCs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
GRUB multiboot configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
LILO multiboot configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Booting single-user mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Single-user mode with GRUB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Single-user mode with LILO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Working with startup scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
init and run levels. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Red Hat and Fedora startup scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
SUSE startup scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Debian and Ubuntu startup scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40