Linux System Administration Recipes a Problem-Solution Approach
Total Page:16
File Type:pdf, Size:1020Kb
CYAN YELLOW MAGENTA BLACK BOOKS FOR PROFESSIONALS BY PROFESSIONALS® THE EXPERT’s Voice® IN LINUX Companion eBook Linux System Administration Recipes: Available A Problem-Solution Approach Recipes Administration Linux System Dear Reader, I decided to write this book based on my own experience as a sysadmin, having to deal with the wide variety of challenges, bugs, and problems that come up on a daily basis. The sheer scope of the job is both its biggest joy and its biggest chal- lenge. Linux sysadmins can use any number of tools in their jobs—as the Perl maxim says, “There’s more than one way to do it.” This book covers many of those tools in a fast, accessible format. It’s aimed at the busy sysadmin who wants quick tips to solve problems (and avoid future problems) now. It’ll be particularly helpful if you are, as I have been, a solo admin who is responsible for support and setup Linux across all levels of your network (from user-facing to back-end systems). In Linux System Administration Recipes, you’ll find a quick-start guide for several networking and provisioning technologies (LDAP, Kerberos, Nagios, and Puppet), as well as tips to help out with common and not-so-common problems. System Administration This book is designed so that you can flip through the pages, find the stand-alone recipe you need, and use it right away. If you already know which end of a server is which but want to improve your abilities, increase the options in your toolbox, and have a useful reference in hand the next time you encounter a problem, this book is for you. Juliet Kemp Recipes THE APRESS ROADMAP Automating Linux and Unix System Pro Bash Programming: Administration, Second Edition Scripting the Linux Shell A Problem-Solution Approach Beginning the Linux Command Line Beginning Portable Shell Scripting Companion eBook Linux System Recipes for the working sysadmin Beginning Perl, 2nd Edition Administration Recipes to save you time and hassle See last page for details on $10 eBook version THE APRESS ROADMAP Beginning the Linux Command Line Automating Linux and Unix System Beginning Portable Beginning Perl, SOURCE CODE ONLINE Kemp Administration, Second Edition Shell Scripting 2nd Edition Juliet Kemp www.apress.com )3". Pro Bash Programming: Linux System Scripting the Linux Shell Administration Recipes US $34.99 Shelve in Linux User level: Beginner–Intermediate this print for content only—size & color not accurate trim = 7.5" x 9.25" spine = 0.65625" 288 page count Download at WoweBook.Com Linux System Administration Recipes A Problem-Solution Approach ■ ■ ■ Juliet Kemp i Download at WoweBook.Com Linux System Administration Recipes: A Problem-Solution Approach Copyright © 2009 by Juliet Kemp All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 (pbk): 978-1-4302-2449-5 ISBN-13 (electronic): 978-1-4302-2450-1 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. Lead Editor: Frank Pohlmann Technical Reviewer: Sean Purdy Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Tony Campbell, Gary Cornell, Jonathan Gennick, Jonathan Hassell, Michelle Lowman, Matthew Moodie, Jeffrey Pepper, Frank Pohlmann, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Project Manager: Kylie Johnston, Sofia Marchant Copy Editor: Kim Wimpsett Production Support: Patrick Cunningham Indexer: Ron Strauss and Ann Rogers Artist: April Milne Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail [email protected], or visit http://www.springeronline.com. For information on translations, please contact Apress directly at 233 Spring Street, New York, NY 10013. E-mail [email protected], or visit http://www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at http://www.apress.com/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at http://www.apress.com. ii Download at WoweBook.Com iii Download at WoweBook.Com Contents at a Glance ■About the Author ................................................................................................xiv ■About the Technical Reviewer.............................................................................xv ■Acknowledgments..............................................................................................xvi ■Introduction.......................................................................................................xvii ■Chapter 1: Saving Yourself Effort ..........................................................................1 ■Chapter 2: Centralizing Your Network: Kerberos, LDAP, and NFS.......................21 ■Chapter 3: Monitoring and Updating ...................................................................63 ■Chapter 4: Taking Backups and Managing Data..................................................95 ■Chapter 5: Working with Filesystems................................................................119 ■Chapter 6: Securing Your Systems....................................................................135 ■Chapter 7: Working with Apache.......................................................................157 ■Chapter 8: Using the Command Line Better.......................................................171 ■Chapter 9: Working with Text in Files ...............................................................185 ■Chapter 10: Things Going In, Things Going Out .................................................203 ■Chapter 11: Tracking Down Bugs ......................................................................213 ■Chapter 12: Managing Time and People............................................................231 ■Appendix: Perl Tips............................................................................................247 ■Index..................................................................................................................253 iv Download at WoweBook.Com Contents ■About the Author ................................................................................................xiv ■About the Technical Reviewer.............................................................................xv ■Acknowledgments..............................................................................................xvi ■Introduction.......................................................................................................xvii ■Chapter 1: Saving Yourself Effort ..........................................................................1 1-1. Documentation: Knowing It’s a Good Thing ............................................................ 1 1-2. Documentation: Keeping Track of What You’re Doing............................................. 1 1-3. Documentation: Using a Wiki .................................................................................. 2 1-4. Documentation: Running Multiple Independent Wikis on the Same Install............. 3 1-5. Scripting: Setting the Display Style......................................................................... 7 1-6. Dealing with Variables in Perl ................................................................................. 7 1-7. Testing Scripts Fully................................................................................................ 9 1-8. Version Control: Using Subversion Aliases............................................................ 10 1-9. Version Control: Adding Labels to Subversion Log Messages............................... 11 1-10. Version Control: Adding Multiple Files to Subversion.......................................... 11 1-11. Version Control: Telling Subversion to Ignore Files............................................. 13 1-12. Subversion: Dividing Repositories....................................................................... 14 1-13. Subversion: Branching Repositories ................................................................... 15 1-14. Subversion: Merging Repositories ...................................................................... 16 1-15. Testing: Knowing It’s a Good Thing..................................................................... 16 1-16. Reinventing the Wheel ........................................................................................ 18 ■Chapter 2: Centralizing Your Network: Kerberos, LDAP, and NFS.......................21 2-1. Setting Up Kerberos Authentication .....................................................................