InstructorGuides - RH134 RHEL9.0 en 2 20220609 IG

Download as pdf or txt
Download as pdf or txt
You are on page 1of 64

Instructor Guide

Red Hat Enterprise Linux 9.0 RH134


Red Hat System Administration II
Edition 2

RH134-RHEL9.0-en-2-20220609 Copyright ©2022 Red Hat, Inc.


RH134-RHEL9.0-en-2-20220609 Copyright ©2022 Red Hat, Inc.
Red Hat System
Administration II
Red Hat Enterprise Linux 9.0 RH134
Red Hat System Administration II
Edition 2 20220609
Publication date 20220609

Authors: Ashish Lingayat, Bernardo Gargallo, Ed Parenti, Jacob Pelchat,


Mike Kelly, Morgan Weetman, Patrick Gomez
Course Architect: Philip Sweany
DevOps Engineer: Artur Glogowski
Editor: Julian Cable
Copyright © 2022 Red Hat, Inc.

The contents of this course and all its modules and related materials, including handouts to audience members, are
Copyright © 2022 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 send
email to [email protected] or phone toll-free (USA) +1 (866) 626-2994 or +1 (919) 754-3700.

Red Hat, Red Hat Enterprise Linux, the Red Hat logo, JBoss, OpenShift, Fedora, Hibernate, Ansible, CloudForms,
RHCA, RHCE, RHCSA, Ceph, and Gluster are trademarks or registered trademarks of Red Hat, Inc. or its subsidiaries
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 American, Inc. and/or its affiliates.

XFS® is a registered trademark of Hewlett Packard Enterprise Development LP or its subsidiaries in the United
States and/or other countries.

MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.

Node.js® is a trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open
source or commercial project.

The OpenStack word mark and the Square O Design, together or apart, are trademarks or registered trademarks
of OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's
permission. Red Hat, Inc. is not affiliated with, endorsed by, or sponsored by the OpenStack Foundation or the
OpenStack community.

All other trademarks are the property of their respective owners.

Contributors: Adarsh Krishnan, David Sacco, Hemant Chauhan, Roberto Velazquez, Sajith
Eyamkuzhy, Samik Sanyal, Yuvaraj Balaraju
Document Conventions                                                                                                                                                                                                   ix
.............................................................................................................................. ix
Course Timing                                                                                                                                                                                                                               xi
ILT ....................................................................................................................
VLT ...................................................................................................................
Course Introduction                                                                                                                                                                                                           xv
Student Benefits ..................................................................................................... xv
Presentation Notes ................................................................................................. xvi
1. Improve Command-line Productivity                                                                                                                                                       1
Chapter Information ............................................................................................
Chapter Schedule ...............................................................................................
Chapter Objectives ................................................................................................... 2
Key Takeaways ......................................................................................................... 2
Instructor Tips and Suggestions .................................................................................. 2
2. Schedule Future Tasks                                                                                                                                                                                                 5
Chapter Information ............................................................................................
Chapter Schedule ...............................................................................................
Chapter Objectives ................................................................................................... 6
Key Takeaways ......................................................................................................... 6
Instructor Tips and Suggestions ................................................................................. 6
3. Tune System Performance                                                                                                                                                                                   9
Chapter Information ............................................................................................
Chapter Schedule ...............................................................................................
Chapter Objectives .................................................................................................. 10
Key Takeaways ........................................................................................................ 10
Instructor Tips and Suggestions ................................................................................ 10
4. Manage SELinux Security                                                                                                                                                                                     13
Chapter Information ............................................................................................
Chapter Schedule ...............................................................................................
Chapter Objectives .................................................................................................. 14
Key Takeaways ........................................................................................................ 14
Instructor Tips and Suggestions ................................................................................. 14
5. Manage Basic Storage                                                                                                                                                                                               17
Chapter Information ............................................................................................
Chapter Schedule ...............................................................................................
Chapter Objectives .................................................................................................. 18
Key Takeaways ........................................................................................................ 18
Instructor Tips and Suggestions ................................................................................. 18
6. Manage Storage Stack                                                                                                                                                                                             21
Chapter Information ............................................................................................
Chapter Schedule ...............................................................................................
Chapter Objectives ................................................................................................. 22
Key Takeaways ........................................................................................................ 22
Instructor Tips and Suggestions ................................................................................ 22
7. Access Network-Attached Storage                                                                                                                                                       25
Chapter Information ............................................................................................
Chapter Schedule ...............................................................................................
Chapter Objectives ................................................................................................. 26
Key Takeaways ....................................................................................................... 26
Instructor Tips and Suggestions ................................................................................ 26

RH134-RHEL9.0-en-2-20220609 vii
8. Control the Boot Process                                                                                                                                                                                     29
Chapter Information ............................................................................................
Chapter Schedule ...............................................................................................
Chapter Objectives ................................................................................................. 30
Key Takeaways ....................................................................................................... 30
Instructor Tips and Suggestions ............................................................................... 30
9. Manage Network Security                                                                                                                                                                                 33
Chapter Information ............................................................................................
Chapter Schedule ...............................................................................................
Chapter Objectives ................................................................................................. 34
Key Takeaways ....................................................................................................... 34
Instructor Tips and Suggestions ................................................................................ 34
10. Install Red Hat Enterprise Linux                                                                                                                                                               37
Chapter Information ............................................................................................
Chapter Schedule ...............................................................................................
Chapter Objectives ................................................................................................. 38
Key Takeaways ....................................................................................................... 38
Instructor Tips and Suggestions ................................................................................ 38
11. Run Containers                                                                                                                                                                                                                   41
Chapter Information ............................................................................................
Chapter Schedule ...............................................................................................
Chapter Objectives ................................................................................................. 42
Key Takeaways ....................................................................................................... 42
Instructor Tips and Suggestions ................................................................................ 43
12. Comprehensive Review                                                                                                                                                                                       45
Chapter Information ............................................................................................
Chapter Schedule ...............................................................................................
Chapter Objectives ................................................................................................. 46
Key Takeaways ....................................................................................................... 46
Instructor Tips and Suggestions ................................................................................ 46

viii RH134-RHEL9.0-en-2-20220609
Document Conventions

This section describes various conventions and practices used throughout all
Red Hat Training courses.

Admonitions
Red Hat Training courses use the following admonitions:

References
These describe where to find external documentation relevant to a
subject.

Note
These 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 something that makes your life easier.

Important
These provide details of information that is easily missed: configuration
changes that only apply to the current session, or services that need
restarting before an update will apply. Ignoring these admonitions will
not cause data loss, but may cause irritation and frustration.

Warning
These should not be ignored. Ignoring these admonitions will most likely
cause data loss.

Inclusive Language
Red Hat Training is currently reviewing its use of language in various areas
to help remove any potentially offensive terms. This is an ongoing process
and requires alignment with the products and services covered in Red Hat
Training courses. Red Hat appreciates your patience during this process.

RH134-RHEL9.0-en-2-20220609 ix
x RH134-RHEL9.0-en-2-20220609
Course Timing

ILT

Day 1

Activity Time

Introduction 5 minutes (5 minutes with i18n)

Chapter 1 100 minutes

Chapter 2 120 minutes

Chapter 3 90 minutes

Total for day 310 minutes (310 minutes with i18n)

Day 2

Activity Time

Chapter 4 140 minutes

Chapter 5 105 minutes

Chapter 6 55 minutes

Total for day 300 minutes

Day 3

Activity Time

Chapter 6 70 minutes

Chapter 7 110 minutes

Chapter 8 140 minutes

Total for day 320 minutes

Day 4

Activity Time

Chapter 9 110 minutes

RH134-RHEL9.0-en-2-20220609 xi
Course Timing

Activity Time

Chapter 10 140 minutes

Chapter 11 80 minutes

Total for day 330 minutes

Day 5

Activity Time

Chapter 11 140 minutes

Chapter 12 135 minutes

Total for day 275 minutes

VLT

Day 1

Activity Time

Introduction 5 minutes (5 minutes with i18n)

Chapter 1 100 minutes

Chapter 2 120 minutes

Chapter 3 90 minutes

Total for day 310 minutes (310 minutes with i18n)

Day 2

Activity Time

Chapter 4 140 minutes

Chapter 5 105 minutes

Chapter 6 55 minutes

Total for day 300 minutes

Day 3

Activity Time

Chapter 6 70 minutes

xii RH134-RHEL9.0-en-2-20220609
Course Timing

Activity Time

Chapter 7 110 minutes

Chapter 8 140 minutes

Total for day 320 minutes

Day 4

Activity Time

Chapter 9 110 minutes

Chapter 10 140 minutes

Chapter 11 80 minutes

Total for day 330 minutes

Day 5

Activity Time

Chapter 11 140 minutes

Chapter 12 135 minutes

Total for day 275 minutes

RH134-RHEL9.0-en-2-20220609 xiii
xiv RH134-RHEL9.0-en-2-20220609
Course Introduction
Welcome students and provide an orientation to the class, classroom
hardware, and facility or VT environment.

Student Benefits
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, troubleshooting, and containers.

RH134-RHEL9.0-en-2-20220609 xv
Course Introduction

Presentation Notes
Introduce yourself and welcome students to the class. Before starting make sure any operational
requirements, including taking attendance and providing students with materials, have been
met. For an in-person training event, orient students to the facility. Make sure students know the
classroom hours and plans for any rest breaks and lunch.

Discuss the basic structure of the course and course timing with the students.

Objectives
Introduce your students to the main objectives of this course.

Audience and Prerequisites


Discuss the intended audience and prerequisites for this course.

xvi RH134-RHEL9.0-en-2-20220609
Chapter 1

Improve Command-line
Productivity
This chapter reviews running command more efficiently by using advanced
features of the Bash shell, shell scripts, and various Red Hat Enterprise Linux
utilities.

Chapter Schedule

ILT/VT Schedule

Section Title Presentation Time


& Engagement (minutes)
Methods

Introduction 3

1 Write Simple Bash Scripts P: Lecture 15

A: Guided Exercise 10

2 Loops and Conditional P: Lecture 20


Constructs in Scripts
A: Guided Exercise 10

3 Match Text in Command P: Lecture 20


Output with Regular
Expressions A: Guided Exercise 10

4 Improve Command-line A: Lab 10


Productivity

Conclusion 2

Total Time: 100 minutes

RH134-RHEL9.0-en-2-20220609 1
Chapter 1 | Improve Command-line Productivity

Chapter Objectives
By the end of this chapter, students should be able to:

• Run commands more efficiently by using advanced features of the Bash shell, shell scripts, and
various Red Hat Enterprise Linux utilities.

• Run repetitive tasks with for loops, evaluate exit codes from commands and scripts, run tests
with operators, and create conditional structures with if statements.

• Create regular expressions to match data, apply regular expressions to text files with the grep
command, and use grep to search files and data from piped commands.

Key Takeaways
Key takeaways from this chapter include the following:

• Create and execute simple Bash scripts to accomplish simple administration tasks.

• Use loops to iterate through a list of items from the command line and in a shell script.

• Use conditional structures to incorporate decision-making into shell scripts.

• Search for text in log and configuration files by using regular expressions and the grep
command.

Instructor Tips and Suggestions

Write Simple Bash Scripts


• This chapter is a quick introduction to Bash. Quoting special characters is important, it is
essential that students understand how to handle special characters.

• The two sections on scripting are short, with the intent that they be a refresher for some, and a
reminder to others that scripting remains a critical, simple glue for so many ad-hoc daily tasks.
Simple looping and conditional logic, and the ability to pass parameters, allows an admin to
quickly perform an action across multiple files, or similar.

• Make it sound really important, but don't spend a lot of time here. Remind students that there
are so many resources out there to learn scripting skills.

2 RH134-RHEL9.0-en-2-20220609
Chapter 1 | Improve Command-line Productivity

Run Commands More Efficiently with Loops


• The exit command can be executed with an integer between 0 and 255 representing an exit
code. The exit code is passed to the parent process. It is then stored in the ? variable and can be
accessed using $?.

Match Text in Command Output with Regular


Expressions
• Regular expressions are a pattern matching syntax that can be used with the vim, less, and
grep commands. Also found in many other places, like Python.

• Regular expression are another critical skill. Humorously, that fact syncs in with students after
a couple of successes with what appears at first to be difficult syntax. Remind students that,
in the hands of someone with just a little diligence, regular expressions can process exactly
the records you want. "All these, and some of those but not when those also have this." It is an
epiphany when the system admin realizes how many commands and tools out there support
regular expressions, and notices that language and syntax is pretty much consistent everywhere.
Which means that learning regex skills transfers to many useful tools and tasks.

RH134-RHEL9.0-en-2-20220609 3
4 RH134-RHEL9.0-en-2-20220609
Chapter 2

Schedule Future Tasks


This chapter reviews scheduling tasks to execute at a specific time and date.

Chapter Schedule

ILT/VT Schedule

Section Title Presentation Time


& Engagement (minutes)
Methods

Introduction 3

1 Schedule a Deferred User P: Lecture 10


Job
A: Guided Exercise 15

2 Schedule Recurring User P: Lecture 15


Jobs
A: Guided Exercise 10

3 Schedule Recurring P: Lecture 20


System Jobs
A: Guided Exercise 10

4 Manage Temporary Files P: Lecture 15

A: Guided Exercise 15

5 Schedule Future Tasks A: Quiz 5

Conclusion 2

Total Time: 120 minutes

RH134-RHEL9.0-en-2-20220609 5
Chapter 2 | Schedule Future Tasks

Chapter Objectives
By the end of this chapter, students should be able to:

• Set up a command to run once at a future time.

• Schedule commands to run on a repeating schedule with a user's crontab file.

• Schedule commands to run on a repeating schedule with the system crontab file and
directories.

• Enable and disable systemd timers, and configure a timer that manages temporary files.

Key Takeaways
Key takeaways from this chapter include the following:

• Deferred jobs or tasks are scheduled to run once in the future.

• Recurring user jobs execute the user's tasks on a repeating schedule.

• Recurring system jobs accomplish, on a repeating schedule, administrative tasks that have
system-wide impact.

• The systemd timer units can execute both the deferred and recurring jobs.

Instructor Tips and Suggestions

Schedule a Deferred User Job


• Start the discussion of this section by asking a question such as "What would you do, if you
want to accomplish a task, for example, send an email while you are out?". This question helps
students to get the right impression of at and understand its use cases.

• Show students how to schedule a deferred job with at using two or three different time formats.
Also, show them how to inspect and manage deferred jobs.

• Highlight the distinctions between the 3 methods presented in this chapter.

1. The at command is for one-offs.

2. The user cron is for recurring jobs for a single person, and it is really important for users to
understands that the crontab editing method is really the only way to do this.

6 RH134-RHEL9.0-en-2-20220609
Chapter 2 | Schedule Future Tasks

3. The system cron is neither of the above. Instead, this is about system administration, and
things that must be automated on a single system using simple scripting and systemd.

• Learning cron requires understanding non-interactive user environments, and handling


STDOUT and STDERR.

Schedule Recurring User Jobs


• Start explaining this section by mentioning the difference between deferred task and recurring
task. Mention to the students that the package cronie provides different programs that help in
scheduling and managing jobs intended to run on a repeating schedule.

• Show students the use of the crontab command with its various options such as -l, -e, and -
r. Take an example of a user cronjob and explain the job format of the user cronjob. Ensure that
the students understand the meaning of each field in the user job format.

• Mention the challenge that comes with scheduling a recurring job using crontab and that
the crond daemon expects the system to be fully up and running always to execute the
scheduled job. There may be situations where a system may not be fully up which would cause
the scheduled job to fail. This is why the critical system administrative jobs should be scheduled
as system jobs and not user jobs. Mention in the next section that they will learn how to schedule
a system job.

Schedule Recurring System Jobs


• Explain the job format of the system jobs using the syntax diagram from /etc/crontab.
Mention the locations that contain the jobs intended to run hourly, daily, weekly, monthly
respectively. Explain the difference between /etc/crontab and /etc/anacrontab.

• Introduce the systemd timer unit. Use /usr/lib/systemd/system/sysstat-


collect.timer as an example to explain how granular time intervals can be mentioned in the
systemd timer unit. Also, emphasize the recommended practice of modifying unit configuration
files under /etc/systemd/system rather than modifying them under /usr/lib/systemd/
system.

Manage Temporary Files


• The section on temporary file management is really an extension of the housekeeping that was
touched on by introducing cron. Remind students that setting the file cleanup parameters
requires understanding how their major apps use temporary files. Typically, such settings
would be consistent across all servers in the enterprise, and could be an candidate for Ansible
Automation or similar configuration management tools.

RH134-RHEL9.0-en-2-20220609 7
8 RH134-RHEL9.0-en-2-20220609
Chapter 3

Tune System Performance


This chapter reviews improving system performance by setting tuning
parameters and adjusting the scheduling priority of processes.

Chapter Schedule

ILT/VT Schedule

Section Title Presentation Time


& Engagement (minutes)
Methods

Introduction 3

1 Adjust Tuning Profiles P: Lecture 15

A: Guided Exercise 20

2 Influence Process P: Lecture 15


Scheduling
A: Guided Exercise 20

3 Tune System Performance A: Lab 15

Conclusion 2

Total Time: 90 minutes

RH134-RHEL9.0-en-2-20220609 9
Chapter 3 | Tune System Performance

Chapter Objectives
By the end of this chapter, students should be able to:

• Optimize system performance by selecting a tuning profile that the tuned daemon manages.

• Prioritize or deprioritize specific processes, with the nice and renice commands.

Key Takeaways
Key takeaways from this chapter include the following:

• The tuned service automatically modifies device settings to meet specific system needs based
on a predefined selected tuning profile.

• To revert all changes of the selected profile to the system settings, either switch to another
profile or deactivate the tuned service.

• The system assigns a relative priority to a process to determine its CPU access. This priority is
called the nice value of a process.

• The nice command assigns a priority to a process when it starts.

• The renice command modifies the priority of a running process.

Instructor Tips and Suggestions

Adjust Tuning Profiles


• Tuning the kernel is a popular topic and therefore this lecture has the potential to generate
many questions and could impact lecture timing. Proceed with caution and remember that this
section is designed to provide an overview of tuning a system. More details are covered in the
Red Hat Performance Tuning (RH442) course.

• If students are curious to know how static tuning works you could explain that static tuning
uses the predefined sysctl and sysfs settings to adjust the systems behavior based on
various tuning profiles. The output of the sudo sysctl -a | less command will display the
numerous kernel parameters that are available and should be enough to convince students why
this subject matter requires a course of its own.

• Tuned has matured. It is much easier to teach what it does, and how it can be customized. Red
Hat has years of experience now with common scenarios, so it is fair to tell students that almost
all they will do with performance tuning will be to pick the most appropriate tuning profile.

10 RH134-RHEL9.0-en-2-20220609
Chapter 3 | Tune System Performance

• The new web console content for tuned is simple and mostly trivial, but your teaching point is
that "look at how many common tasks are included in the web console by default now, or are
added through simple plugins." Yes, in course design, we were looking for simple tasks where we
could highlight the web console in existing chapters, give the web console some attention, and
show students it is worth playing with.

Influence Process Scheduling


• In the "Viewing Nice Values" section it may help to better understand the graphic if you open an
instance of top to visually demonstrate how the nice value maps to the scheduled priority.

• It is hard to teach priorities without using the term priorities. This section was rewritten because
the previous version was inarticulate and possibly misleading. Priorities are process scheduling
queues. Systems threads use them, but user threads don't any more. User threads are internal
priority ID 0, always. User threads are organized in a btree based on nice values and previous
CPU time balancing, which sounds like prioritizing but without priority queues. Much more
efficient, without the overhead of queue management.

• The most important concept in process scheduling: Thread scheduling only determines which
threads get process first, on an unsaturated system. All threads get all the time they want,
because the system is unsaturated.

• On a saturated system, the lowest value threads aren't going to get on CPU immediately and
have to wait. And that is where the value of the time-weighted binary tree comes in, in making
sure that no thread starves and that they all get a fair amount of scheduling.

RH134-RHEL9.0-en-2-20220609 11
12 RH134-RHEL9.0-en-2-20220609
Chapter 4

Manage SELinux Security


This chapter reviews protecting and managing server security by using
SELinux.

Chapter Schedule

ILT/VT Schedule

Section Title Presentation Time


& Engagement (minutes)
Methods

Introduction 3

1 Change the SELinux P: Lecture 15


Enforcement Mode
A: Guided Exercise 10

2 Control SELinux File P: Lecture 20


Contexts
A: Guided Exercise 15

3 Adjust SELinux Policy with P: Lecture 10


Booleans
A: Guided Exercise 15

4 Investigate and Resolve P: Lecture 15


SELinux Issues
A: Guided Exercise 15

5 Manage SELinux Security A: Lab 20

Conclusion 2

Total Time: 140 minutes

RH134-RHEL9.0-en-2-20220609 13
Chapter 4 | Manage SELinux Security

Chapter Objectives
By the end of this chapter, students should be able to:

• Explain how SELinux protects resources, change the current SELinux mode of a system, and set
the default SELinux mode of a system.

• Manage the SELinux policy rules that determine the default context for files and directories with
the semanage fcontext command and apply the context defined by the SELinux policy to
files and directories with the restorecon command.

• Activate and deactivate SELinux policy rules with the setsebool command, manage the
persistent value of SELinux Booleans with the semanage boolean -l command, and consult
man pages that end with _selinux to find useful information about SELinux Booleans.

• Use SELinux log analysis tools and display useful information during SELinux troubleshooting
with the sealert command.

Key Takeaways
Key takeaways from this chapter include the following:

• Use the getenforce and setenforce commands to manage the SELinux mode of a system.

• The semanage command manages SELinux policy rules. The restorecon command applies
the context that the policy defines.

• Booleans are switches that change the behavior of the SELinux policy. You can enable or disable
them to tune the policy.

• The sealert command displays useful information to help with SELinux troubleshooting.

Instructor Tips and Suggestions

Change the SELinux Enforcement Mode


• Make sure the students understand that switching SELinux off is not recommended. It should
be used uniquely in troubleshooting to confirm that SELinux is the problem. They should then
configure SELinux to solve the problem. This should not longer be an issue like in the early days,
but be prepared for the student who wants to make it a point to fight over.

• The SELinux introduction is completely rewritten. All instructors are suggested to stare at the
decision-making flow diagram until every part of the architecture makes sense and can be easily
discussed.

14 RH134-RHEL9.0-en-2-20220609
Chapter 4 | Manage SELinux Security

• The newly announced feature that SELinux can only be fully disabled using a kernel parameter
does not change the ability to doable or use SELinux in permissive mode. What it does is take
away a major attack vector for getting around SELinux. Today, security is so important, and
an instructor can say with confidence that Linux is possibly the most secure operating system
available simply because of SELinux. As a "deny everything and allow only that with a written
policy", this is pretty solid.

Control SELinux File Contexts


• The restorecon command is preferred to the chcon command. having the default context in
the semanage database is always preferred to manual settings.

Adjust SELinux Policy with Booleans


• Booleans can be difficult to understand, take time over this section. The error messages from
Booleans can be confusing for administrators. Walk the students through the log files concerned
and explain what messages in the log files mean.

• Previous SELinux discussion were light on explaining the context of using Booleans. It is not
just some odd switch. Every Boolean is a capability the service/app developer built into the
SELinux policy for that service/app, and the Boolean is the on/off switch for that capability.
If your students go read the *_selinux man pages for specific services, they will learn every
builtin Boolean capability supported. Sometimes the best thing about SELinux is learning those
Booleans; what scenario they are designed to facilitate and the realization that "hey, we could
use that in our organization."

Investigate and Resolve SELinux Issues


• The output from the sealert may not be as intuitive as it was in earlier versions of RHEL.

• The section on investigating and resolving SELinux issues is explained better, but purposely
remains at an RHCSA level. Students are not expect to be expert SELinux troubleshooters, but
it would be valuable if the the take-away from this lecture is that AVC denials can be understood
and mitigated relatively easily.

RH134-RHEL9.0-en-2-20220609 15
16 RH134-RHEL9.0-en-2-20220609
Chapter 5

Manage Basic Storage


This chapter reviews creating and managing storage devices, partitions, file
systems, and swap spaces from the command line.

Chapter Schedule

ILT/VT Schedule

Section Title Presentation Time


& Engagement (minutes)
Methods

Introduction 3

1 Add Partitions, File P: Lecture 25


Systems, and Persistent
Mounts A: Guided Exercise 15

2 Manage Swap Space P: Lecture 15

A: Guided Exercise 20

3 Manage Basic Storage A: Lab 25

Conclusion 2

Total Time: 105 minutes

RH134-RHEL9.0-en-2-20220609 17
Chapter 5 | Manage Basic Storage

Chapter Objectives
By the end of this chapter, students should be able to:

• Create storage partitions, format them with file systems, and mount them for use.

• Create and manage swap spaces to supplement physical memory.

Key Takeaways
Key takeaways from this chapter include the following:

• The parted command adds, modifies, and removes partitions on disks with the MBR or the
GPT partitioning scheme.

• The mkfs.xfs command creates XFS file systems on disk partitions.

• The /etc/fstab file contains devices that must be persistently mounted.

• The mkswap command initializes swap spaces.

Instructor Tips and Suggestions

Add Partitions, File Systems, and Persistent Mounts


• The fdisk and gdisk commands are still available to partition disks. However, the
Managing file systems guide at https://access.redhat.com/documentation/en-us/
red_hat_enterprise_linux/9/html-single/managing_file_systems/index only uses parted
and does not refer to these two commands any more. Anaconda uses Parted through the
libparted library to partition the disks during the installation process.

• Curriculum overall is agnostic about partition editors, but specific developers have their
favorites. Know that we teach parted for a reason; primarily because everything in RHEL that
paritions uses the libparted library. This is about consistency across multiple tools when
teaching. Be careful not to dilute that message if you decide to teach other editors.

• parted informs the kernel when you create a partition. The kernel then triggers udev for the
creation of the device file under /dev/ (/dev/vdb1 for example). The udevadm settle
command blocks until udev has finished its work. Usually, this is a fast process, and students
should not notice a pause when running the udevadm settle command. This may, however,
be useful in scripts when you chain the creation of the partition and its formatting.

• When the system boots, systemd reads /etc/fstab and creates mount units from it, in /
run. You can list those units with systemctl -t mount --all. Systemd uses these units to

18 RH134-RHEL9.0-en-2-20220609
Chapter 5 | Manage Basic Storage

control and supervise your mounts. Every time you add or remove an entry from /etc/fstab,
it is a good practice to run systemctl daemon-reload to create or delete the corresponding
unit without having to reboot the system. Skipping this step should not prevent you from
mounting and using the file system. See the systemd.mount(5) man page for more details.

• Do not use mount -a to check /etc/fstab. The mount(8) man page states that it is a bad
practice. The only time you see the all option used in this course is after an /etc/fstab or
similar fix and reboot, where the actual intent is to check all mounts.

• Students may ask why they should create a partition on a LUN, and not directly use the LUN
block device. See the Knowledgebase: What are the advantages and disadvantages to using
partitioning on LUNs, either directly or with LVM in between? [https://access.redhat.com/
solutions/163853]

• Basic storage remains the same. Everything moves toward GPT and EFI, but we continue to
cover legacy structures because our customers till use them, for now.

Manage Swap Space


• When the system boots, systemd reads /etc/fstab and creates swap units from it, in /run.
You can list those units with systemctl -t swap --all. Systemd uses these units to control
and supervise the swap spaces. See the systemd.swap(5) man page for more details.

• swapon -s is deprecated. Use swapon --show instead. See the swapon(8) man page.

• Swap is an enterprise server concept, but remains a common need. Servers always run with
swap configured. Servers shifted to the cloud and containers are a completely different handling
of memory needs and are not relevant for swap discussions.

RH134-RHEL9.0-en-2-20220609 19
20 RH134-RHEL9.0-en-2-20220609
Chapter 6

Manage Storage Stack


This chapter reviews creating and managing logical volumes that contain file
systems or swap spaces from the command line.

Chapter Schedule

ILT/VT Schedule

Section Title Presentation Time


& Engagement (minutes)
Methods

Introduction 3

1 Create and Extend Logical P: Lecture 30


Volumes
A: Guided Exercise 20

2 Manage Layered Storage P: Lecture 30

A: Guided Exercise 20

3 Manage Storage Stack A: Lab 20

Conclusion 2

Total Time: 125 minutes

RH134-RHEL9.0-en-2-20220609 21
Chapter 6 | Manage Storage Stack

Chapter Objectives
By the end of this chapter, students should be able to:

• Describe logical volume manager components and concepts, and implement LVM storage and
display LVM component information.

• Analyze the multiple storage components that make up the layers of the storage stack.

Key Takeaways
Key takeaways from this chapter include the following:

• You can use LVM to create flexible storage by allocating space on multiple storage devices.

• Physical volumes, volume groups, and logical volumes are managed by the pvcreate,
vgreduce, and lvextend commands.

• Logical volumes can be formatted with a file system or swap space, and they can be mounted
persistently.

• Additional storage can be added to volume groups and logical volumes can be extended
dynamically.

• Understand the layers and components of the storage stack to manage storage efficiently.

• Virtual Data Optimizer (VDO) uses LVM for compression and deduplication of data.

• You can use Stratis to perform an initial storage configuration or enable advanced storage
features.

Instructor Tips and Suggestions

Create and Extend Logical Volumes


• Chapter 6 is a redesign. The first section on LVM combines the LVM create and expand into
one section, but remains focused on normal volume and file system tasks. Note, at this point,
students have learned device fundamentals, file system basics, and basic mounting in the RH124
course, and partitioning, persistent file systems, and core Logical Volume Manager in this RH134
course.

• The VDO section is gone because VDO was simply incorporated into LVM. The python-based
command set is no longer needed. Creating a VDO volume is done by adding an option while
creating a logical volume. This is shown in this section.

22 RH134-RHEL9.0-en-2-20220609
Chapter 6 | Manage Storage Stack

Manage Layered Storage


• Explain the basic architecture of Stratis and how it helps user to easily manage different layers
of storage features using a single tool. Do not get into too much low-level details to explain how
each storage layer functions.

• Show the students how to use the stratis command to manage Stratis pools and file systems.

• Stratis will be out of Tech Preview in an upcoming RHEL 9 minor release. Stratis makes more
sense when the student user has a visual of the layered stack that Stratis is managing. Stratis
handles these layers opaquely; handling partition management, device pools, dm, LVM
interactions, and XFS file systems.

*Curriculem debated whether to leave the stack and Stratis as two sections, or to teach Stratis
first before summarizing with the stack overview. But those choices did not support the purpose,
which is to grasp the basic elements of RHEL storage and use that knowledge as the Stratis
Storage tool tasks are taught. Therefore, the stack overview is intended to be presented as a
simple overview that feeds into the Stratis narrative.

• Some elements in the stack overview are taught elsewhere, such as Ceph ODS, multipath, and
RAID, and there is no need to do a deep dive or even go into much detail. The goal here is to
only introduce the terms and concepts.

• To repeat, the storage stack overview, before the Stratis content, is intended as a brief overview.
Do not do a deep dive on storage, and manage the questions effectively to communicate that
this is a terminology introduction to lead into the Stratis utility.

RH134-RHEL9.0-en-2-20220609 23
24 RH134-RHEL9.0-en-2-20220609
Chapter 7

Access Network-Attached
Storage
This chapter reviews accessing network-attached storage with the NFS
protocol.

Chapter Schedule

ILT/VT Schedule

Section Title Presentation Time


& Engagement (minutes)
Methods

Introduction 3

1 Manage Network- P: Lecture 20


Attached Storage with
NFS A: Guided Exercise 20

2 Automount Network- P: Lecture 20


Attached Storage
A: Guided Exercise 20

3 Access Network-Attached A: Lab 25


Storage

Conclusion 2

Total Time: 110 minutes

RH134-RHEL9.0-en-2-20220609 25
Chapter 7 | Access Network-Attached Storage

Chapter Objectives
By the end of this chapter, students should be able to:

• Identify NFS export information, create a directory to use as a mount point, mount an NFS
export with the mount command or by configuring the /etc/fstab file, and unmount an NFS
export with the umount command.

• Describe the benefits of using the automounter, and automount NFS exports by using direct
and indirect maps.

Key Takeaways
Key takeaways from this chapter include the following:

• Mount and unmount an NFS share from the command line.

• Configure an NFS share to mount automatically at startup.

• Configure the automounter with direct and indirect maps, and describe their differences.

Instructor Tips and Suggestions

Mount Network-Attached Storage with NFS


• NFS is the default method for Linux and UNIX style operating systems to share network storage
resources. Knowing how to set up and connect to NFS shares is essential, and selecting the
right connection method will make it easier to provide access to the NFS shares when they are
needed.

• Some NFS shares are need transiently and others are needed all the time. Understanding how
to connect using the mount command and the /etc/fstab file supports these use cases.

• Cover the basic features of NFSv4 as the default NFS version on RHEL8 and NFSv3 is the older
supported version, TCP as the protocol (which may mean firewalld needs to be opened), neither
UDP or RPCBIND are needed from RHEL 8, using a NFSv4-only solution, Server/Client.

• Demo manual mounts, show how to browse the server by mounting the root export and
how NFS shares are visible. We are using an NFSv4 share in the class, so you cannot demo
showmount command. Point out it is not reliable for NFSv4 and should only be used to query
NFSv3 servers.

• Show the students the new nfsconf tool, and the new /etc/nfs.conf configuration file.

26 RH134-RHEL9.0-en-2-20220609
Chapter 7 | Access Network-Attached Storage

• Show the students how to configure an NFSv4 only client with the nfsconf tool, and the /
etc/nfs.conf configuration file.

• Demo the /etc/fstab, mount method and umount commands.

• The NFS storage section now explains the practical difference between NFSv3 and NFSv4,
which is the method by which you query a server looking for shares. It is important for students
to understand that concept of a single export tree, and how all shares can be seen in this one
tree. You will have some students who only thing of remote shares as existing as one per share,
as in older NFS and for SMB.

The export tree concept can be useful to demonstrate parsing. Explain to students that the real
shares in the export tree do not mount when you mount the export tree root. Also, a user who
can see the shares in the export tree might still not have the permissions required to mount those
shares.

Automount Network-Attached Storage


• The automounter section was reorganized and edited for clarity. Additional explanations have
been added in an attempt to make explaining direct and indirect maps and their basic use cases.

• The auto-mounter does not require users to specifically mount and unmount shares (requiring
root or sudo privileges), or permanently mount the share via the /etc/fstab which may
consume system and network resources.

• The auto-mounter connects and disconnects on demand, and for all configured users on the
system.

• Make sure your students understand the benefits the auto-mounter brings to the table.

• autofs is typically not installed by default, demo installing it.

• Demo creating the master map file under /etc/auto.master.d/. Make sure the mandatory
extension of autofs is covered and that the file can be called anything. The mapping filename
is absolute.

• Demo creating the mapping files. Cover that the file name is not important but by convention
the file is located in /etc and is named auto.xxx with a meaningful extension. Discuss the
key values as absolute for direct and just the relative path for indirect. Highlight that the last
directory is managed by autofs and in the case of indirect is created and removed automatically
as needed. The options are the same as the mount command options, although mention -
fstype= option for other file systems. Finally the format of the share server: /path/to/
share.

• Direct maps use an absolute mount point, indirect maps use either a directory name or an * and
& to identify mount-points and locations.

• Demo the use of the * and & and make sure students understand what they do and how they
could use them to mount from a common parent directory to a common local parent, based on
the specified path. Mount options need to be shared as well as the parent directories!

• Narrative was added to introduce the automount systemd method, which can be useful. While
this method is much simpler and does not require all the configuration of the autofs server,
inform students that it can only be used for direct mounts, where the mount point is in a known
location and already exists.

RH134-RHEL9.0-en-2-20220609 27
28 RH134-RHEL9.0-en-2-20220609
Chapter 8

Control the Boot Process


This chapter reviews managing the boot process to control offered services
and troubleshooting and repairing problems.

Chapter Schedule

ILT/VT Schedule

Section Title Presentation Time


& Engagement (minutes)
Methods

Introduction 3

1 Select the Boot Target P: Lecture 20

A: Guided Exercise 20

2 Reset the Root Password P: Lecture 15

A: Guided Exercise 20

3 Repair File System Issues P: Lecture 15


at Boot
A: Guided Exercise 20

4 Control the Boot Process A: Lab 25

Conclusion 2

Total Time: 140 minutes

RH134-RHEL9.0-en-2-20220609 29
Chapter 8 | Control the Boot Process

Chapter Objectives
By the end of this chapter, students should be able to:

• Describe the Red Hat Enterprise Linux boot process, set the default target when booting, and
boot a system to a non-default target.

• Log in to a system and change the root password when the current root password is lost.

• Manually repair file-system configuration or corruption issues that stop the boot process.

Key Takeaways
Key takeaways from this chapter include the following:

• The systemctl reboot and systemctl poweroff commands reboot and power down a
system, respectively.

• The systemctl isolate target-name.target command switches to a new target at


runtime.

• The systemctl get-default and systemctl set-default commands can be used to


query and set the default target.

• You can use the rd.break option on the kernel command line to interrupt the boot process
before control is handed over from the initramfs. The root file system is mounted read-only
under /sysroot.

• The emergency target can be used to diagnose and fix file-system issues.

Instructor Tips and Suggestions

Select the Boot Target


• The boot process discussion can be tedious. It has a lot of file name details. Both the BIOS
and EFI details are in the same bulleted list. The new diagram may help; you may have seen
it in the RH342 troubleshooting course. While this discussion should be much lighter than for
troubleshooting, a good diagram can help anchor the lecture and provide flow.

• For more information on the boot process, refer to An introduction to the Linux boot and startup
processes at https://opensource.com/article/17/2/linux-boot-and-startup

• initramfs files are built from 2 cpio archives. The best way to inspect initramfs files is
through the lsinitrd command. For more information on the initramfs file format, refer

30 RH134-RHEL9.0-en-2-20220609
Chapter 8 | Control the Boot Process

to the Knowledgebase: How to extract/unpack/uncompress the contents of the initramfs boot


image? [https://access.redhat.com/solutions/2037313]

• During the exercise, depending on the classroom environment and the physical keyboard layout,
some students may struggle to enter the root password, redhat, and to type commands in
emergency and rescue modes. Once logged in in the emergency or rescue shell, students can
use the loadkeys lang command to select a new layout temporarily. The available layout files
are in the /lib/kbd/keymaps/xkb/ directory. The following example set different layouts.

[root@servera ~]# loadkeys it


[root@servera ~]# loadkeys fr
[root@servera ~]# loadkeys de
[root@servera ~]# loadkeys ch-fr

• In this section, the students practice the rescue target method.

Reset the Root Password


• The process to recover from a lost root password has not changed since Red Hat Enterprise
Linux 7.

• In the boot loader, the line to update by appending rd.break may start by linux, linux16, or
linuxefi depending on the environment.

• There are a number of ways to break into a system when a user has physical access to the
machine. Each has a use case, benefits and drawbacks. This course teaches all of the relevant
methods: rd.break, emergency mode, and the rescue target.

• As an instructor, it is important to be teaching each for the purpose for which it was intended.

– Rescue mode breaks in with most initialization done and therefore is ready to use utilities to
fix the system with access to all disks.

– Emergency mode breaks in even early, after the root disk pivot, and can get an admin in
before hitting the issues in the boot process that are failing.

– The rd.break method drops in even earlier and gives access with almost nothing initialized, and
no SELinux loaded.

• This course teaches rd.break for setting the root password, because both rescue mode and
emrgency mode require an sulogin passowrd. Only rd.break accesses the system before
systemd takes over. Red Hat recommends rd.break for this task, and documents rd.break as the
method in the normal documention. You are welcome to teach whatever works, but remember
that teaching rd.break gives us the opportunity to explain the significance of the SELinux
autorelabel, and how files can end up with a file context if edited when SELinux modules are not
loaded.

Repair File System Issues at Boot


• After editing /etc/fstab, the exercise asks students to run the systemctl daemon-reload
command for systemd to recreate the mount targets from the updated /etc/fstab file.
Because the next step is to reboot the system, this systemctl daemon-reload command
is not necessary in that situation. It is, however, a good practice to get used to running that
command after editing /etc/fstab.

• In this section, the students practice the emergency target method. This target is the most
appropriate for file system failures and other issues that happen during system initialization.

RH134-RHEL9.0-en-2-20220609 31
Chapter 8 | Control the Boot Process

• This section should be the only place where you see the use of mount -a, which is useful for
checking the complete /etc/fstab configuration. As mentioned previously, mount -a use is
discouraged, and should never be used as a lazy shortcut.

32 RH134-RHEL9.0-en-2-20220609
Chapter 9

Manage Network Security


This chapter reviews controlling network connections to services with the
system firewall and SELinux rules.

Chapter Schedule

ILT/VT Schedule

Section Title Presentation Time


& Engagement (minutes)
Methods

Introduction 3

1 Manage Server Firewalls P: Lecture 25

A: Guided Exercise 20

2 Control SELinux Port P: Lecture 20


Labeling
A: Guided Exercise 20

3 Manage Network Security A: Lab 20

Conclusion 2

Total Time: 110 minutes

RH134-RHEL9.0-en-2-20220609 33
Chapter 9 | Manage Network Security

Chapter Objectives
By the end of this chapter, students should be able to:

• Accept or reject network connections to system services with firewalld rules.

• Verify that network ports have the correct SELinux type for services to bind to them.

Key Takeaways
Key takeaways from this chapter include the following:

• The netfilter framework allows kernel modules to inspect every packet traversing the
system, including all incoming, outgoing or forwarded network packets.

• The firewalld service simplifies management by classifying all network traffic into zones.
Each zone has its own list of ports and services. The public zone is set as the default zone.

• The firewalld service ships with a number of predefined services. You can list them by using
the firewall-cmd --get-services command.

• SELinux policy tightly controls network traffic by labeling the network ports. For example, port
22/TCP has the label ssh_port_t associated with it. When a process wants to listen on a port,
SELinux checks to see whether the label associated with it is allowed to bind that port label.

• Use the semanage command to add, delete, and modify labels.

Instructor Tips and Suggestions

Manage Server Firewalls


• This is another section where web console content was included, just because we could. The
benefit to the student is simply a clean visual representation of zones and services. The web
console does not handle rich rules, so there are some tasks that will be better done with the
command line.

• Impress upon students that the predefined zones and predefined services are going to handle
the majority of their normal use cases, and that is sufficient to learn now. However, any time
they have a port requirement that is not covered by a predefined service, they will have to add
those as individual ports.

34 RH134-RHEL9.0-en-2-20220609
Chapter 9 | Manage Network Security

Control SELinux Port Labeling


• The port labeling could be taught in the SELinux chapter, but contextually, it fits better here
combined with setting up the firewall. The workflow is to open the port, and make sure it has the
right context at the same time. By now, the semanage method for persistent context storage
should be comfortable to students.

RH134-RHEL9.0-en-2-20220609 35
36 RH134-RHEL9.0-en-2-20220609
Chapter 10

Install Red Hat Enterprise Linux


This chapter reviews intalling Red Hat Enterprise Linux on servers and virtual
machines.

Chapter Schedule

ILT/VT Schedule

Section Title Presentation Time


& Engagement (minutes)
Methods

Introduction 3

1 Install Red Hat Enterprise P: Lecture 20


Linux
A: Guided Exercise 25

2 Automate Installation with P: Lecture 25


Kickstart
A: Guided Exercise 20

3 Install and Configure P: Lecture 15


Virtual Machines
A: Quiz 5

4 Install Red Hat Enterprise A: Lab 25


Linux

Conclusion 2

Total Time: 140 minutes

RH134-RHEL9.0-en-2-20220609 37
Chapter 10 | Install Red Hat Enterprise Linux

Chapter Objectives
By the end of this chapter, students should be able to:

• Install Red Hat Enterprise Linux on a server.

• Explain Kickstart concepts and architecture, create a Kickstart file with the Kickstart
Generator website, modify an existing Kickstart file with a text editor and check its syntax with
ksvalidator, publish a Kickstart file to the installer, and install Kickstart on the network.

• Install a virtual machine on your Red Hat Enterprise Linux server with the web console.

Key Takeaways
Key takeaways from this chapter include the following:

• The RHEL 9 binary DVD includes Anaconda and all repositories required for installation.

• The RHEL 9 boot ISO includes the Anaconda installer, and can access repositories over the
network during installation.

• The Kickstart system can perform unattended installations.

• Kickstart files can be created by using the Kickstart Generator website or by copying and editing
/root/anaconda-ks.cfg.

• The Virtualization Host DNF package group provides the packages for a RHEL system to
become a virtualization host.

• The cockpit-machines package adds the Virtual Machines menu to Cockpit.

Instructor Tips and Suggestions

Install Red Hat Enterprise Linux


• A teaching point about installations is that the specific steps and what is being configured
remains the same whether you are using Anaconda, kickstart, image builder, or other tools.
Installing using Anaconda is the simplest way to get the big picture of all the installation pieces.
Also, learning about installation is a common request, and to have an installation exercise, no
matter how simple.

• The manual installation of Red Hat Enterprise Linux& 9 is similar to previous versions of RHEL.

• To burn a binary DVD, you need a dual layer DVD because of the size of the ISO file.

38 RH134-RHEL9.0-en-2-20220609
Chapter 10 | Install Red Hat Enterprise Linux

• There is only a single build of RHEL 9 per processor architecture. The variants such as Server,
Workstation, or Desktop do not require a specific ISO anymore.

• The System Purpose item allows administrators to define what the system will be used for and
what support level it should receive. Anaconda gives this information to Subscription Manager
which can more accurately choose the appropriate subscription for the system.

Automate Installation with Kickstart


• The system-config-kickstart command has been replaced by the Kickstart Generator
website. While students are not expected to create a kickstart file this way, it would be worth
reviewing the options on the site to become aware of what capabilities are available in case a
student should ask.

• Students should be made aware that /root/anaconda-ks.cfg is an excellent starting point


for creating kickstart files. Making a copy of this file and modifying it is a much simpler solution
than creating a kickstart file from scratch.

• The kickstart parameters and method haven't changed, at the level we teach here at the RHCSA
level. Still, you can tell the students that each new RHEL release adds functionality and makes
kickstart easier to use for custom builds with tools that use kickstart files.

Install and Configure Virtual Machines


• The virt-manager graphical tool is now deprecated. Red Hat recommends using the web
console with the Machines plug-in installed. The cockpit-machines package provides the
Machines plug-in.

• Web Console supports the most often used configuration options. When you need advanced
features or customization, use the virsh command.

RH134-RHEL9.0-en-2-20220609 39
40 RH134-RHEL9.0-en-2-20220609
Chapter 11

Run Containers
This chapter reviews obtaining, running, and managign simple lightweight
services as containers on a single Red Hat Enterprise Linux server.

Chapter Schedule

ILT/VT Schedule

Section Title Presentation Time


& Engagement (minutes)
Methods

Introduction 3

1 Container Concepts P: Lecture 20

A: Quiz 5

2 Deploy Containers P: Lecture 25

A: Guided Exercise 25

3 Manage Container P: Lecture 30


Storage and Network
Resources A: Guided Exercise 30

4 Manage Containers as P: Lecture 25


System Services
A: Guided Exercise 20

5 Run Containers A: Lab 30

Conclusion 2

Total Time: 215 minutes

RH134-RHEL9.0-en-2-20220609 41
Chapter 11 | Run Containers

Chapter Objectives
By the end of this chapter, students should be able to:

• Explain container concepts and the core technologies for building, storing, and running
containers.

• Discuss container management tools for using registries to store and retrieve images, and for
deploying, querying, and accessing containers.

• Provide persistent storage for container data by sharing storage from the container host, and
configure a container network.

• Configure a container as a systemd service, and configure a container service to start at boot
time.

Key Takeaways
Key takeaways from this chapter include the following:

• Containers provide a lightweight way to distribute and run an application with its dependencies
so that it does not conflict with installed software on the host.

• Containers run from container images that you can download from a container registry or create
yourself.

• You can use container files with instructions to build a customized container image.

• Podman, which Red Hat Enterprise Linux provides, directly runs and manages containers and
container images on a single host.

• Containers can be run as root, or as non-privileged rootless containers for increased security.

• You can map network ports on the container host to pass traffic to services that run in its
containers.

• You can use environment variables to configure the software in containers at build time.

• Container storage is temporary, but you can attach persistent storage to a container by using
the contents of a directory on the container host, for example.

• You can configure a systemd unit file to automatically run containers when the system starts.

42 RH134-RHEL9.0-en-2-20220609
Chapter 11 | Run Containers

Instructor Tips and Suggestions


*The container chapter was reorganized. The intent was to teach the basics of single-system,
non-OpenShift container handling in a more use-case driven flow. The examples that use a web
container to connect to a storage container is the simplest design, but the goal is only to use
fundamental commands.

Container Concepts
• Useful reference for instructors on running containers: Section 1.3. Running containers without
Docker at https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html-
single/building_running_and_managing_containers/index

Deploy Containers
• If a student makes a mistake when running a container and wishes to start over, then the student
first needs to delete the wrong container. To do so, the student can run the two following
commands to delete all the containers on their system:

[student@servera ~]$ podman stop --all


4e934d5e43c7638500bb0d8ab2cc74572207d67b1377ac2ccb21dbf8d62978bf
[student@servera ~]$ podman rm --all
4e934d5e43c7638500bb0d8ab2cc74572207d67b1377ac2ccb21dbf8d62978bf

Manage Container Storage and Network Resources


• With rootless containers, Podman maps the user IDs inside the container with unprivileged user
IDs on the host. The following example starts a MariaDB container, and then shows the user ID
of the mysqld process from inside the container and from the host.

[user@host ~]$ podman run -d --name mydb -e MYSQL_USER=user \


-e MYSQL_PASSWORD=redhat -e MYSQL_DATABASE=inventory \
registry.redhat.io/rhel8/mariadb-103:1-102
4e934d5e43c7638500bb0d8ab2cc74572207d67b1377ac2ccb21dbf8d62978bf
[user@host ~]$ podman exec -ti mydb ps naux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
27 1 4.3 3.3 1528620 62040 ? Ssl 11:16 0:00 /usr/libexec/mysqld
[user@host ~]$ ps naux | grep mysqld
100026 6089 1.3 3.3 1528620 62040 ? Ssl 11:16 0:00 /usr/libexec/mysqld

Inside the container, the process has the user ID 27. From the host point of view, the process has
the user ID 100026. With that example, when preparing a host directory for the database, you
must make sure that the user ID 100026 has read/write access to it.

• For simplicity, when using shared storage in exercises, instructions ask students to set the
directory mode to 777 or ensure that the mode allows access. A more realistic way would be
to set the directory ownership to the user ID running the container processes (100026 in the
preceding example). However, that would require to compute that user ID, and then to run the
chown command as root. Dealing with user namespaces and SELinux on rootless containers

RH134-RHEL9.0-en-2-20220609 43
Chapter 11 | Run Containers

[https://www.redhat.com/sysadmin/user-namespaces-selinux-rootless-containers] provides an
easier way to set the ownership with the podman unshare command.

Manage Containers as System Services


• Many services are shipped as containers now. The context is not applications, but working with
containerized services as a system administrator. Fundamental, but a useful practice.

• To use systemctl --user commands, users must log in at the console or directly through
SSH. If students use su or sudo to switch to the student account, instead of using SSH, the
typical error message when using systemctl --user is as follows:

[student@servera ~]$ systemctl --user


Failed to connect to dbus: No such file or directory

See the pam_systemd(8) man page.

44 RH134-RHEL9.0-en-2-20220609
Chapter 12

Comprehensive Review
This chapter reviews tasks from Red Hat System Administration II.

Chapter Schedule

ILT/VT Schedule

Section Title Presentation Time


& Engagement (minutes)
Methods

Introduction 3

1 Comprehensive Review P: Lecture 10

2 Fix Boot Issues and Review Lab 30


Maintain Servers

3 Configure and Manage File Review Lab 30


Systems and Storage

4 Configure and Manage Review Lab 30


Server Security

5 Run Containers Review Lab 30

Conclusion 2

Total Time: 135 minutes

RH134-RHEL9.0-en-2-20220609 45
Chapter 12 | Comprehensive Review

Chapter Objectives
By the end of this chapter, students should be able to:

• Review tasks from Red Hat System Administration II

Key Takeaways
Key takeaways from this chapter include the following:

Summary bullets are still under development.

Instructor Tips and Suggestions


• There is a new note at the top of each comp review. We have been asked to find ways to
give useful advice for exam prep. While some tips may seem obvious to us, like this one that
effectively says, "try to do the work as a test of your ability, and don't just look at the solution".
However, we have never actually put such tips in writing and presented them, and we are curious
to see if they help.

• Comprehensive Reviews are now given only a specifications, and not as instructions. This makes
them different than end of chapter labs. Remind students that the solution we provide is one
way to do it, and they might use different tools to achieve the same thing. In reality, there is
usually only one way to accomplish system administration configurations, and that admonition is
better applied in developer-style course.

Fix Boot Issues and Maintain Servers


• This lab is a good opportunity to practice alternate boot methods. Experienced system
administrators can do any of the three main breaking in methods properly without having to look
them up. This skill is critically when the usual data center crisis issues occur.

Configure and Manage Files Systems and Storage


• All of the tasks on this lab are common and relevant for practice for the exam.

Configure and Manage Server Security


• All of the tasks on this lab are common and relevant for practice for the exam.

46 RH134-RHEL9.0-en-2-20220609
Chapter 12 | Comprehensive Review

Run Containers
• This lab is similar to the exercises done earlier but the topic is broad enough that this is useful
practice to gain familiarity needed to pass the exam.

RH134-RHEL9.0-en-2-20220609 47
48 RH134-RHEL9.0-en-2-20220609

You might also like