Red.Hat.RH134-RHEL8.0-en-1-20190531.pdf - Join the explorers builders and individuals who boldly offer new solutions to old problems For open source

Red.Hat.RH134-RHEL8.0-en-1-20190531.pdf - Join the...

This preview shows page 1 out of 430 pages.

Unformatted text preview: 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: Editor: Fiona Allen, Adrian Andrade, Herve Quatremain, Victor Costea, Snehangshu Karmakar, Marc Kesler, Saumik Paul 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 Scheduling a Deferred User Job .............................................................................. Guided Exercise: Scheduling a Deferred User Job ...................................................... Scheduling Recurring User Jobs .............................................................................. Guided Exercise: Scheduling Recurring User Jobs ...................................................... Scheduling Recurring System Jobs .......................................................................... Guided Exercise: Scheduling Recurring System Jobs .................................................. Managing Temporary Files ....................................................................................... Guided Exercise: Managing Temporary Files .............................................................. Quiz: Scheduling Future Tasks ................................................................................. Summary ............................................................................................................... 37 38 40 44 47 50 53 57 60 64 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: Compressing and Deduplicating Storage with VDO .......................... 240 Lab: Implementing Advanced Storage Features ........................................................ 245 Summary ............................................................................................................. 255 9. Accessing Network-Attached Storage 257 Mounting Network-Attached Storage with NFS ........................................................ 258 Guided Exercise: Managing Network-Attached Storage with NFS ............................... 263 Automounting Network-Attached Storage ............................................................... 268 Guided Exercise: Automounting Network-Attached Storage ........................................ 271 Lab: Accessing Network-Attached Storage .............................................................. 277 Summary ............................................................................................................. 284 10. Controlling the Boot Process 285 Selecting the Boot Target ..................................................................................... 286 Guided Exercise: Selecting the Boot Target .............................................................. 291 Resetting the Root Password ................................................................................. 294 Guided Exercise: Resetting the Root Password ......................................................... 298 Repairing File System Issues at Boot ...................................................................... 300 Guided Exercise: Repairing File System Issues at Boot .............................................. 302 Lab: Controlling the Boot Process .......................................................................... 305 Summary ............................................................................................................... 311 11. Managing Network Security 313 Managing Server Firewalls ...................................................................................... 314 Guided Exercise: Managing Server Firewalls ............................................................. 322 Controlling SELinux Port Labeling .......................................................................... 327 Guided Exercise: Controlling SELinux Port Labeling .................................................. 330 Lab: Managing Network Security ............................................................................ 334 Summary ............................................................................................................. 343 12. Installing Red Hat Enterprise Linux 345 Installing Red Hat Enterprise Linux ......................................................................... 346 Guided Exercise: Installing Red Hat Enterprise Linux ................................................. 350 Automating Installation with Kickstart ...................................................................... 353 Guided Exercise: Automating Installation with Kickstart ............................................. 362 Installing and Configuring Virtual Machines .............................................................. 365 Quiz: Installing and Configuring Virtual Machines ...................................................... 370 Lab: Installing Red Hat Enterprise Linux .................................................................. 372 vi RH134-RHEL8.0-en-1-20190531 Summary ............................................................................................................. 379 13. Comprehensive Review 381 Comprehensive Review ........................................................................................ 382 Lab: Fixing Boot Issues and Maintaining Servers ....................................................... 385 Lab: Configuring and Managing File Systems and Storage ......................................... 393 Lab: Configuring and Managing Server Security ...................................................... 400 RH134-RHEL8.0-en-1-20190531 vii viii RH134-RHEL8.0-en-1-20190531 DOCUMENT CONVENTIONS REFERENCES "References" describe where to find external documentation relevant to a subject. NOTE "Notes" are tips, shortcuts or alternative approaches to the task at hand. Ignoring a note should have no negative consequences, but you might miss out on a trick that makes your life easier. IMPORTANT "Important" boxes detail things that are easily missed: configuration changes that only apply to the current session, or services that need restarting before an update will apply. Ignoring a box labeled "Important" will not cause data loss, but may cause irritation and frustration. WARNING "Warnings" should not be ignored. Ignoring warnings will most likely cause data loss. RH134-RHEL8.0-en-1-20190531 ix x RH134-RHEL8.0-en-1-20190531 INTRODUCTION RED HAT SYSTEM ADMINISTRATION II This course is specifically designed for students who have completed Red Hat System Administration I (RH124). Red Hat System Administration II (RH134) focuses on the key tasks needed to become a full time Linux Administrator and to validate those skills via the Red Hat Certified System Administrator exam. This course goes deeper into Enterprise Linux administration including filesystems and partitioning, logical volumes, SELinux, firewalling, and troubleshooting. COURSE OBJECTIVES • Expand and extend on skills gained during the Red Hat System Administration I (RH124) course. • Build skills needed by an RHCSA-certified Red Hat Enterprise Linux system administrator. AUDIENCE • This course is singularly designed for students who have completed Red Hat System Administration I (RH124). The organization of topics is such that it is not appropriate for students to use RH134 as a curriculum entry point. Students who have not taken a previous Red Hat course are encouraged to take either System Administration I (RH124) if they are new to Linux or the RHCSA Fast Track course (RH200) if they are experienced with Enterprise Linux administration. PREREQUISITES • Having sat the Red Hat System Administration I (RH124) course, or equivalent knowledge. RH134-RHEL8.0-en-1-20190531 xi Introduction ORIENTATION TO THE CLASSROOM ENVIRONMENT Figure 0.1: Classroom environment In this course, the main computer system used for hands-on learning activities is workstation. Two other machines are also used by students for these activities: servera, and serverb. All three of these systems are in the lab.example.com DNS domain. All student computer systems have a standard user account, student, which has the password student. The root password on all student systems is redhat. Classroom Machines MACHINE NAME IP ADDRESSES ROLE bastion.lab.example.com 172.25.250.254 Gateway system to connect student private network to classroom server (must always be running) workstation.lab.example.com 172.25.250.9 Graphical workstation used for system administration servera.lab.example.com 172.25.250.10 First server serverb.lab.example.com 172.25.250.11 Second server The primary function of bastion is that it acts as a router between the network that connects the student machines and the classroom network. If bastion is down, other student machines will only be able to access systems on the individual student network. xii RH134-RHEL8.0-en-1-20190531 Introduction Several systems in the classroom provide supporting services. Two servers, content.example.com and materials.example.com, are sources for software and lab materials used in hands-on activities. Information on how to use these servers is provided in the instructions for those activities. These are provided by the classroom.example.com virtual machine. Both classroom and bastion should always be running for proper use of the lab environment. NOTE When logging on to servera or serverb you might see a message concerning the activation of cockpit. The message can be ignored. [[email protected] ~]$ ssh [email protected] Warning: Permanently added 'serverb,172.25.250.11' (ECDSA) to the list of known hosts. Activate the web console with: systemctl enable --now cockpit.socket [[email protected] ~]$ CONTROLLING YOUR SYSTEMS Students are assigned remote computers in a Red Hat Online Learning classroom. They are accessed through a web application hosted at rol.redhat.com [ ]. Students should log in to this site using their Red Hat Customer Portal user credentials. Controlling the Virtual Machines The virtual machines in your classroom environment are controlled through a web page. The state of each virtual machine in the classroom is displayed on the page under the Online Lab tab. Machine States VIRTUAL MACHINE STATE DESCRIPTION STARTING The virtual machine is in the process of booting. STARTED The virtual machine is running and available (or, when booting, soon will be). STOPPING The virtual machine is in the process of shutting down. STOPPED The virtual machine is completely shut down. Upon starting, the virtual machine boots into the same state as when it was shut down (the disk will have been preserved). PUBLISHING The initial creation of the virtual machine is being performed. WAITING_TO_START The virtual machine is waiting for other virtual machines to start. Depending on the state of a machine, a selection of the following actions is available. RH134-RHEL8.0-en-1-20190531 xiii Introduction Classroom/Machine Actions BUTTON OR ACTION DESCRIPTION PROVISION LAB Create the ROL classroom. Creates all of the virtual machines needed for the classroom and starts them. Can take several minutes to complete. DELETE LAB Delete the ROL classroom. Destroys all virtual machines in the classroom. Caution: Any work generated on the disks is lost. START LAB Start all virtual machines in the classroom. SHUTDOWN LAB Stop all virtual machines in the classroom. OPEN CONSOLE Open a new tab in the browser and connect to the console of the virtual machine. Students can log in directly to the virtual machine and run commands. In most cases, students should log in to the workstation virtual machine and use ssh to connect to the other virtual machines. ACTION → Start ACTION → Shutdown ACTION Off ACTION → Power → Reset Start (power on) the virtual machine. Gracefully shut down the virtual machine, preserving the contents of its disk. Forcefully shut down the virtual machine, preserving ...
View Full Document

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture