RED HAT SYSTEM ADMINISTRATION II Edition 1
Total Page:16
File Type:pdf, Size:1020Kb
Join the explorers, builders, and individuals who boldly offer new solutions to old problems. For open source, innovation is only possible because of the people behind it. STUDENT WORKBOOK (ROLE) Red Hat Enterprise Linux 8.0 RH134 RED HAT SYSTEM ADMINISTRATION II Edition 1 RH134-RHEL8.0-en-1-20190531 Copyright ©2019 Red Hat, Inc. RED HAT SYSTEM ADMINISTRATION II RH134-RHEL8.0-en-1-20190531 Copyright ©2019 Red Hat, Inc. Red Hat Enterprise Linux 8.0 RH134 Red Hat System Administration II Edition 1 20190531 Publication date 20190531 Authors: Fiona Allen, Adrian Andrade, Herve Quatremain, Victor Costea, Snehangshu Karmakar, Marc Kesler, Saumik Paul Editor: Philip Sweany, Ralph Rodriguez, David Sacco, Seth Kenlon, Heather Charles Copyright © 2019 Red Hat, Inc. The contents of this course and all its modules and related materials, including handouts to audience members, are Copyright © 2019 Red Hat, Inc. No part of this publication may be stored in a retrieval system, transmitted or reproduced in any way, including, but not limited to, photocopy, photograph, magnetic, electronic or other record, without the prior written permission of Red Hat, Inc. This instructional program, including all material provided herein, is supplied without any guarantees from Red Hat, Inc. Red Hat, Inc. assumes no liability for damages or legal action arising from the use or misuse of contents or details contained herein. If you believe Red Hat training materials are being used, copied, or otherwise improperly distributed please e-mail [email protected] or phone toll-free (USA) +1 (866) 626-2994 or +1 (919) 754-3700. Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, Hibernate, Fedora, the Infinity Logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries. Linux® is the registered trademark of Linus Torvalds in the United States and other countries. Java® is a registered trademark of Oracle and/or its affiliates. XFS® is a registered trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries. The OpenStack® Word Mark and OpenStack Logo are either registered trademarks/service marks or trademarks/ service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community. All other trademarks are the property of their respective owners. Contributors: Achyut Madhusudan, Rob Locke, Rudolf Kastl, Prashant Rastogi, Heider Souza, Michael Phillips, Dallas Spohn Document Conventions ix Introduction xi Red Hat System Administration II ............................................................................... xi Orientation to the Classroom Environment ................................................................. xii Controlling Your Systems ................................................................................ xiii Internationalization .................................................................................................. xv 1. Improving Command-line Productivity 1 Writing Simple Bash Scripts ....................................................................................... 2 Guided Exercise: Writing Simple Bash Scripts .............................................................. 6 Running Commands More Efficiently Using Loops ....................................................... 9 Guided Exercise: Running Commands More Efficiently Using Loops ............................... 15 Matching Text in Command Output with Regular Expressions ....................................... 17 Guided Exercise: Matching Text in Command Output with Regular Expressions ............... 26 Lab: Improving Command-line Productivity ............................................................... 29 Summary ............................................................................................................... 36 2. Scheduling Future Tasks 37 Scheduling a Deferred User Job .............................................................................. 38 Guided Exercise: Scheduling a Deferred User Job ...................................................... 40 Scheduling Recurring User Jobs .............................................................................. 44 Guided Exercise: Scheduling Recurring User Jobs ...................................................... 47 Scheduling Recurring System Jobs .......................................................................... 50 Guided Exercise: Scheduling Recurring System Jobs .................................................. 53 Managing Temporary Files ....................................................................................... 57 Guided Exercise: Managing Temporary Files .............................................................. 60 Quiz: Scheduling Future Tasks ................................................................................. 64 Summary ............................................................................................................... 68 3. Tuning System Performance 69 Adjusting Tuning Profiles ......................................................................................... 70 Guided Exercise: Adjusting Tuning Profiles ................................................................ 75 Influencing Process Scheduling ................................................................................ 77 Guided Exercise: Influencing Process Scheduling ........................................................ 81 Lab: Tuning System Performance ............................................................................. 85 Summary ............................................................................................................... 90 4. Controlling Access to Files with ACLs 91 Interpreting File ACLs ............................................................................................. 92 Quiz: Interpreting File ACLs ..................................................................................... 99 Securing Files with ACLs ........................................................................................ 101 Guided Exercise: Securing Files with ACLs ............................................................... 105 Lab: Controlling Access to Files with ACLs ................................................................. 111 Summary .............................................................................................................. 120 5. Managing SELinux Security 121 Changing the SELinux Enforcement Mode ................................................................ 122 Guided Exercise: Changing the SELinux Enforcement Mode ....................................... 126 Controlling SELinux File Contexts ........................................................................... 129 Guided Exercise: Controlling SELinux File Contexts ................................................... 133 Adjusting SELinux Policy with Booleans ................................................................... 136 Guided Exercise: Adjusting SELinux Policy with Booleans ........................................... 138 Investigating and Resolving SELinux Issues ............................................................... 141 Guided Exercise: Investigating and Resolving SELinux Issues ...................................... 145 Lab: Managing SELinux Security ............................................................................. 149 Summary .............................................................................................................. 155 RH134-RHEL8.0-en-1-20190531 v 6. Managing Basic Storage 157 Adding Partitions, File Systems, and Persistent Mounts .............................................. 158 Guided Exercise: Adding Partitions, File Systems, and Persistent Mounts ...................... 168 Managing Swap Space ........................................................................................... 172 Guided Exercise: Managing Swap Space .................................................................. 176 Lab: Managing Basic Storage .................................................................................. 181 Summary ............................................................................................................... 191 7. Managing Logical Volumes 193 Creating Logical Volumes ....................................................................................... 194 Guided Exercise: Creating Logical Volumes .............................................................. 201 Extending Logical Volumes .................................................................................... 207 Guided Exercise: Extending Logical Volumes ............................................................. 212 Lab: Managing Logical Volumes .............................................................................. 216 Summary ............................................................................................................. 223 8. Implementing Advanced Storage Features 225 Managing Layered Storage with Stratis ................................................................... 226 Guided Exercise: Managing Layered Storage with Stratis ............................................ 231 Compressing and Deduplicating Storage with VDO ................................................... 237 Guided Exercise: