LPIC-2 Study Guide Second Edition
Total Page:16
File Type:pdf, Size:1020Kb
LPIC-2 Study Guide Second Edition ffirs.indd 09/14/2016 Page i LPIC-2: Linux Professional Institute Certification Study Guide Exam 201 and Exam 202 Second Edition Christine Bresnahan Richard Blum ffirs.indd 09/14/2016 Page iii Senior Acquisitions Editor: Kenyon Brown Development Editor: Gary Schwartz Technical Editor: Kevin Ryan Production Editor: Christine O’Connor Copy Editor: Linda Rectenwald Editorial Manager: Mary Beth Wakefield Production Manager: Kathleen Wisor Executive Publisher: Jim Minatel Book Designers: Judy Fung and Bill Gibson Proofreader: Rebecca Rider Indexer: John Sleeva Project Coordinator, Cover: Brent Savage Cover Designer: Wiley Cover Image: Getty Images Inc./Jeremy Woodhouse Copyright © 2016 by John Wiley & Sons, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN: 978-1-119-15079-4 ISBN: 978-1-119-15081-7 (ebk.) ISBN: 978-1-119-15080-0 (ebk.) Manufactured in the United States of America 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 Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hobo- ken, NJ 07030, (201) 748-6011, fax (201) 748-6008, 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 warran- ties, 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 pro- fessional person should be sought. Neither the publisher nor the author shall be liable for damages arising here- from. The fact that an organization or Web site 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 Web site may provide or recommendations it may make. Further, readers should be aware that Internet Web sites 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 (877) 762-2974, outside the U.S. at (317) 572-3993 or fax (317) 572-4002. Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at http://booksupport.wiley.com. For more information about Wiley products, visit www.wiley.com. Library of Congress Control Number: 2016952321 TRADEMARKS: Wiley, the Wiley logo, and the Sybex logo are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries, and may not be used without written permission. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book. 10 9 8 7 6 5 4 3 2 1 ffirs.indd 09/14/2016 Page iv To those looking to further their knowledge of Linux. “A wise man is full of strength, and a man of knowledge enhances his might.” Prov 24:5 (ESV) ffirs.indd 09/14/2016 Page v Acknowledgments First, all glory and praise go to God, who through His Son, Jesus Christ, makes all things possible and gives us the gift of eternal life. Many thanks go to the fantastic team of people at Sybex for their outstanding work on this project. Thanks to Kenyon Brown, the senior acquisitions editor, for offering us the opportunity to work on this book. Also thanks to Gary Schwartz, the development editor, for keeping things on track and making the book more presentable. Thanks, Gary, for all your hard work and diligence. The technical editor, Kevin E. Ryan, did a wonderful job of double-checking all of the work in the book in addition to making suggestions to improve the content. Thanks also goes to the young and talented Daniel Anez (theanez.com) for his illustration work. We would like to thank Carole Jelen at Waterside Productions, Inc., for arranging this opportunity for us and for helping us out in our writing careers. Christine would particularly like to thank her husband, Timothy, for his encouragement, patience, and willingness to listen, even when he has no idea what she is talking about. Rich would particularly like to thank his wife, Barbara, for enduring his grouchy attitude during this project and helping to keep up his spirits with baked goods. About the Authors Christine Bresnahan started working with computers more than 25 years ago in the IT industry as a systems administrator. Christine is an adjunct professor at Ivy Tech Community College, where she teaches Linux certification and Python programming classes. She also writes books and produces instructional resources for the classroom. Richard Blum has worked in the IT industry for more than 25 years as both a system and network administrator, and he has published numerous Linux and open source books. Rich is an online instructor for Linux and web programming courses that are used by col- leges and universities across the United States. When he is not being a computer nerd, Rich enjoys spending time with his wife, Barbara, and his two daughters, Katie and Jessica. ffirs.indd 09/14/2016 Page x Contents at a Glance Introduction xxiii Assessment Test xliii Part I The LPI 201 Exam 1 Chapter 1 Starting a System 3 Chapter 2 Maintaining the System 37 Chapter 3 Mastering the Kernel 93 Chapter 4 Managing the Filesystem 139 Chapter 5 Administering Advanced Storage Devices 199 Chapter 6 Navigating Network Services 271 Part II The LPI 202 Exam 315 Chapter 7 Organizing Email Services 317 Chapter 8 Directing DNS 371 Chapter 9 Offering Web Services 451 Chapter 10 Sharing Files 497 Chapter 11 Managing Network Clients 581 Chapter 12 Setting Up System Security 619 Appendix Answers to Review Questions 655 Index 691 Contents Introduction xxiii Assessment Test xliii Part I The LPI 201 Exam 1 Chapter 1 Starting a System 3 The Linux Boot Process 4 Following the Boot Process 4 Viewing the Boot Process 5 The Firmware Startup 6 The BIOS Startup 6 The UEFI Startup 7 Linux Bootloaders 8 GRUB Legacy 9 GRUB 2 12 Alternative Bootloaders 14 Secure Bootloaders 15 Process Initialization 16 The SysV Method 17 The systemd Method 21 The Upstart Method 26 System Recovery 27 Kernel Failures 27 Root Drive Failure 29 Summary 31 Exam Essentials 31 Review Questions 33 Chapter 2 Maintaining the System 37 Keeping Users Informed 38 Looking at Fluid Messaging 39 Looking at Static Messaging 47 Backing Up the System 51 Developing a Backup Strategy 51 Performing Backups 61 Installing Programs from Source 72 Obtaining the Installation Files 73 Unpacking the Installation Files 73 Reading Installation Documentation 74 Compiling Preparation 75 ftoc.indd 09/14/2016 Page xiii xiv Contents Compiling the Program 76 Completing the Installation 76 Managing Resource Usage 79 Measuring Resource Usage 79 Predicting Resource Usage 83 Troubleshooting Resource Usage 85 Summary 87 Exam Essentials 87 Review Questions 89 Chapter 3 Mastering the Kernel 93 What Is the Kernel? 94 The Kernel Features 94 Parts of the Kernel 104 Kernel Versions 107 Compiling a Kernel 108 Obtaining Source Code 109 Creating the Configuration File 110 Compiling and Installing the Kernel 114 Compiling and Installing Modules 116 Creating an Initial RAM Disk 116 Booting the New Kernel 118 Creating a Kernel Package 119 Maintaining the Kernel 120 Working with Module Files 120 Module Commands 120 Working with Hardware 125 Automatically Detecting Hardware 128 Troubleshooting the Kernel 129 Summary 132 Exam Essentials 133 Review Questions 135 Chapter 4 Managing the Filesystem 139 Operating the Linux Filesystem 140 Understanding Filesystem Structures 140 Understanding Filesystem Types 141 Making a Filesystem 144 Attaching a Filesystem 146 Exploring Additional Filesystem Topics 162 Looking at Memory-Based Linux Filesystems 162 Looking at the Btrfs Filesystem 163 Exploring Btrfs Subvolumes 165 Exploring Btrfs Snapshots 169 ftoc.indd 09/14/2016 Page xiv ftoc.indd 09/14/2016 Page xv Contents xv Looking at Optical Filesystems 171 Looking at Swap Filesystems 177 Looking at Network-Based Filesystems 180 Understanding Auto-Mounting 180 Looking at Encrypted Filesystems 183 Maintaining Linux Filesystems 185 Adjusting a Filesystem 185 Checking and Repairing a Filesystem 187 Using SMART 189 Summary 192 Exam Essentials 192 Review Questions 195 Chapter 5 Administering Advanced