$ run as a normal user# run as root (or with sudo)
Scripts and schedules
Shell scripts, regular expressions, at, cron, timers and tmpfiles.
| Task | Short answer |
|---|---|
| A script must stop when it gets no argument | [ $# -eq 0 ] && { echo "Usage: $0 NAME" >&2; exit 1; } — lesson |
Run a command for every user listed in users.txt | while read -r u; do …; done < users.txt — lesson |
| See every line a script runs | bash -x script.sh — lesson |
| Show a config file without comments and empty lines | grep -Ev '^[[:space:]]*(#|$)' FILE — lesson |
Find lines with error or fail, any case | grep -iE 'error|fail' FILE — lesson |
| Run a job once at 23:00 today | echo "CMD" | at 23:00, check with atq — lesson |
User anna runs a script every work day at 07:30 | crontab -e -u anna: 30 7 * * 1-5 /path/script.sh — lesson |
| A user's timer must run without a login | loginctl enable-linger USER — lesson |
| A system job every night at 01:30, logged in the journal | backup.service + backup.timer with OnCalendar=*-*-* 01:30, systemctl enable --now backup.timer — lesson |
Delete files older than 7 days in /var/tmp/app | /etc/tmpfiles.d/app.conf: d /var/tmp/app 0750 root root 7d — lesson |
Logs, SELinux, archives and transfer
The journal, time, SELinux, tar and file copy.
| Task | Short answer |
|---|---|
| Keep the journal after a reboot | Storage=persistent in /etc/systemd/journald.conf.d/*.conf, restart journald — lesson |
| Show only errors of the last boot | journalctl -b -1 -p err — lesson |
Make the clock follow ntp.example.com | server ntp.example.com iburst in /etc/chrony.conf, restart chronyd, chronyc sources — lesson |
Apache must serve files from /srv/web | semanage fcontext -a -t httpd_sys_content_t '/srv/web(/.*)?', restorecon -Rv /srv/web — lesson |
| Allow Apache to connect to the network for good | setsebool -P httpd_can_network_connect on — lesson |
| Find why SELinux blocked something | ausearch -m AVC -ts recent, sealert -a /var/log/audit/audit.log — lesson |
Pack /etc with xz, keeping SELinux labels | tar --selinux --acls --xattrs -cJf etc.tar.xz /etc — lesson |
Copy only changed files of /srv/www to server2 and delete old ones there | rsync -av --delete /srv/www/ server2:/srv/www/ (test with -n first) — lesson |
Performance and storage
tuned, nice, partitions, swap and LVM.
| Task | Short answer |
|---|---|
| Use the recommended tuning profile | tuned-adm recommend, tuned-adm profile NAME, tuned-adm active — lesson |
| Start a backup with the lowest CPU priority | nice -n 19 backup.sh — lesson |
| Give a running process (PID 3210) nice value 10 | renice -n 10 -p 3210 — lesson |
A 2 GiB XFS partition mounted on /data at boot | parted mkpart, mkfs.xfs, fstab line with UUID=, mount -a, findmnt --verify — lesson |
| Add 1 GiB of swap that is active after reboot | Partition or LV, mkswap, fstab swap line, swapon -a — lesson |
| An LV of 100 extents of 16 MiB | vgcreate -s 16M VG PV, lvcreate -l 100 -n LV VG — lesson |
| Make a mounted XFS LV 500 MiB bigger | lvextend -r -L +500M /dev/VG/LV — lesson |
The VG is full: add the disk /dev/vdd | pvcreate /dev/vdd, vgextend VG /dev/vdd — lesson |
Boot, recovery, network and NFS
Targets, GRUB, root access, firewalld, SELinux ports, NFS and autofs.
| Task | Short answer |
|---|---|
| Boot into text mode by default | systemctl set-default multi-user.target — lesson |
Add quiet to all kernel entries | grubby --update-kernel=ALL --args="quiet" — lesson |
| The boot stops in emergency mode after an fstab change | mount -o remount,rw /, fix /etc/fstab, systemctl daemon-reload, mount -a — lesson |
| The root password is lost | GRUB e, add rd.break, mount -o remount,rw /sysroot, chroot /sysroot, passwd, touch /.autorelabel — lesson |
| Allow https from everywhere, for good | firewall-cmd --add-service=https --permanent, firewall-cmd --reload — lesson |
| Apache must listen on port 82 | Listen 82, semanage port -a -t http_port_t -p tcp 82, firewall-cmd --add-port=82/tcp --permanent — lesson |
Mount server2:/srv/nfs/shared on /mnt/shared at boot | fstab: server2:/srv/nfs/shared /mnt/shared nfs rw,_netdev 0 0 — lesson |
Mount every NFS home folder under /home/remote/USER on demand | autofs wildcard map: * -rw server2:/srv/nfs/home/& — lesson |
Install, containers and image mode
Kickstart, Podman, Quadlet and bootc.
| Task | Short answer |
|---|---|
| Install many servers the same way | Kickstart file (start from /root/anaconda-ks.cfg), ksvalidator, boot with inst.ks=URL — lesson |
Run a rootless web container on port 8080 with content from ~/site | podman run -d --name site -p 8080:8080 -v ~/site:/var/www/html:Z IMAGE — lesson |
| Look at an image without pulling it | skopeo inspect docker://IMAGE — lesson |
| A user's container must start at boot | Quadlet ~/.config/containers/systemd/NAME.container, systemctl --user daemon-reload, loginctl enable-linger USER — lesson |
| Add a package to an image-mode server | Add it to the Containerfile, build and push a new image, bootc upgrade — lesson |
| An update of an image-mode server broke it | bootc rollback, reboot — lesson |
Plan the exam
RH124 + RH134 together cover the RHCSA exam (EX200). Practise against the clock until every task is routine.
| Next step | Go to |
|---|---|
| Check every official exam objective | The RHCSA summary |
| Two full practice exams | Practice exam A, Practice exam B |
| The first course again, for the basics | RH124 |
| Every command with all options | Commands |
Exam tip
In the exam, make every change persistent and check it after a reboot: enable --now, --permanent, -P, fstab, set-default. A task that is lost at reboot counts as not done.