Table of Contents
RHCSA EX200 – Part 2: Advanced Questions
Advanced RHCSA practice questions. Storage, containers, and system administration on RHEL 9.
System Administration
Q1. Reset Root Password
Reset using rd.break method.
Boot: press e → add rd.break → Ctrl+x # mount -o remount,rw /sysroot # chroot /sysroot # passwd root # touch /.autorelabel # exit; exit
Q2. Configure YUM Repository
RHEL 9 / Rocky 9 BaseOS and AppStream.
# vim /etc/yum.repos.d/rocky9.repo [BaseOS] baseurl=https://dl.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/ gpgcheck=0 enabled=1 [AppStream] baseurl=https://dl.rockylinux.org/pub/rocky/9/AppStream/x86_64/os/ gpgcheck=0 enabled=1
Storage Management
Q3. LVM with Extents
Create PV, VG (16MB PE), LV (50 extents), ext3, mount /mnt/database
# fdisk /dev/sdb (create partition) # pvcreate /dev/sdb1 # vgcreate -s 16M datastore /dev/sdb1 # lvcreate -l 50 -n database datastore # mkfs.ext3 /dev/datastore/database # mkdir /mnt/database # vi /etc/fstab /dev/datastore/database /mnt/database ext3 defaults 0 0
Q4. Add Swap Partition
Add 956MB swap partition
# fdisk /dev/vdb n, p, 2, +965M, t, 82, w # mkswap /dev/vdb2 # vi /etc/fstab UUID=xxx swap swap defaults 0 0 # swapon -a
Q5. Resize LVM
# lvextend -L 300M /dev/mapper/myvg-mylv # resize2fs /dev/mapper/myvg-mylv
Q6. Create VDO (RHEL 8)
For RHEL 9, use Stratis instead.
# yum install -y vdo kmod-kvdo # vdo create --name=Vdo1 --device=/dev/vdd --vdoLogicalSize=50G
Q7. Stratis (RHEL 9)
Modern replacement for VDO.
# yum install -y stratis-cli stratisd # systemctl enable --now stratisd # stratis pool create mypool /dev/sdb # stratis fs create mypool myfs # mkdir /mnt/stratis # vi /etc/fstab /dev/stratis/mypool/myfs /mnt/stratis xfs defaults 0 0
System Tuning
Q8. Configure Tuned
# tuned-adm profile virtual-guest
Containers (RHEL 9)
Q9. Container with Systemd
Create user container with auto-start via systemd.
# yum module install container-tools -y # useradd -m xandu # loginctl enable-linger xandu # su - xandu # podman login registry.lab.example.com # podman run -d --name logserver registry.lab.example.com/syslog # mkdir -p ~/.config/systemd/user # podman generate systemd --name logserver --files --new # podman stop logserver && podman rm logserver # systemctl --user daemon-reload # systemctl --user enable --now container-logserver.service
Q10. Container Persistent Storage
Mount /var/www to host directory.
# su - xandu # mkdir -p /home/xandu/container-storage # podman run -d --name webserver -v /home/xandu/container-storage:/var/www:Z registry.lab.example.com/rhel9/httpd
Network Services
Q11. Configure NTP
# yum install -y chrony # vi /etc/chrony.conf server classroom.example.com iburst # systemctl enable --now chronyd
Q12. Configure AutoFS
# yum install -y autofs # vi /etc/auto.master.d/rhel9.autofs /home/guests /etc/auto.home # vi /etc/auto.home * -rw,sync,fstype=nfs4 classroom.example.com:/home/guests/& # systemctl enable --now autofs