Table of Contents
RHCSA Exam Questions with Solutions: Your Path to RHEL 9
Preparing for the EX200 RHCSA exam certification? This comprehensive guide covers real exam questions with step-by-step solutions. All commands are tested on RHEL 9 and Rocky Linux 9.
Part 1: Server A Tasks
Q1. Configure Network and Static Hostname
Set IP: 172.25.250.10/24, Gateway: 172.25.250.254, Hostname: servera.lab.example.com
# nmcli con show # nmcli con mod "Wired connection 1" ipv4.addresses 172.25.250.10/24 ipv4.gateway 172.25.250.254 ipv4.method manual # nmcli con up "Wired connection 1" # hostnamectl set-hostname servera.lab.example.com
Q2. Configure YUM Repository
Use Rocky 9 mirrors for BaseOS and AppStream.
# vim /etc/yum.repos.d/rocky9.repo [BaseOS] name=BaseOS baseurl=https://dl.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/ gpgcheck=0 enabled=1 [AppStream] name=AppStream baseurl=https://dl.rockylinux.org/pub/rocky/9/AppStream/x86_64/os/ gpgcheck=0 enabled=1 # yum repolist
Q3. Debug SELinux – Web Server on Port 82
Fix SELinux and firewall for Apache on non-standard port.
# setenforce 0 # semanage port -a -t http_port_t -p tcp 82 # systemctl restart httpd # firewall-cmd --permanent --add-port=82/tcp # firewall-cmd --reload # setenforce 1
Q4. Create Users with Groups
Create group sysadms, users natasha and harry (supplementary: sysadms), sarah (nologin shell). Password: trootent
# groupadd sysadms # useradd -G sysadms natasha && useradd -G sysadms harry # useradd -s /sbin/nologin sarah # passwd natasha && passwd harry && passwd sarah
Q5. Configure Cron Job
Run echo command daily at 14:23 for user natasha.
# su - natasha $ crontab -e 23 14 * * * /bin/echo "file"
Q6. Create Collaborative Directory
Create /home/manager with sysadms group, SGID for automatic group inheritance.
# mkdir /home/manager # chgrp sysadms /home/manager # chmod 2770 /home/manager
Q7. Configure NTP
Sync time with classroom.example.com
# yum install -y chrony # vi /etc/chrony.conf server classroom.example.com iburst # systemctl enable --now chronyd
Q8. Configure AutoFS
Automount NFS home directories from classroom.example.com
# 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
Q9. Configure ACL
Set ACL on /var/tmp/fstab: sarah=rw, harry=no access, others=r
# cp /etc/fstab /var/tmp/ # setfacl -m u:sarah:rw- /var/tmp/fstab # setfacl -m u:harry:--- /var/tmp/fstab # setfacl -m o:r-- /var/tmp/fstab # getfacl /var/tmp/fstab
Q10. Create User with Specific UID
Create bob with UID 2112
# useradd -u 2112 bob # passwd bob
Part 2: Server B Tasks
Q11. Reset Root Password
Boot into emergency mode and reset root password.
At boot: press e → add rd.break → Ctrl+x # mount -o remount,rw /sysroot # chroot /sysroot # passwd root # touch /.autorelabel # exit # exit
Q12. Configure YUM Repository (Server B)
# vim /etc/yum.repos.d/local.repo [local_repo] name=Local Repo baseurl=https://dl.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/ gpgcheck=0 enabled=1 [appstream] name=AppStream baseurl=https://dl.rockylinux.org/pub/rocky/9/AppStream/x86_64/os/ gpgcheck=0 enabled=1
Q13. Resize Logical Volume
Resize mylv to 300MB
# lvextend -L 300M /dev/mapper/myvg-mylv # resize2fs /dev/mapper/myvg-mylv
Q14. Add Swap Partition
Add 956MB swap partition
# fdisk /dev/vdb n, p, 2, +965M, t, 82, w # mkswap /dev/vdb2 # swapon /dev/vdb2 # vi /etc/fstab UUID=xxx /dev/vdb2 swap swap defaults 0 0
Q15. Create New LVM
Create PV, VG, LV with ext3 filesystem
# fdisk /dev/vdb (create partition) # pvcreate /dev/vdb3 # vgcreate -s 32M wgroup /dev/vdb3 # lvcreate -l 20 -n wshare wgroup # mkfs.ext3 /dev/wgroup/wshare # mkdir /mnt/wshare # vi /etc/fstab /dev/wgroup/wshare /mnt/wshare ext3 defaults 0 0
Q16. Create VDO Volume
VDO for thin provisioning (RHEL 8). For RHEL 9, use Stratis instead.
# yum install -y vdo kmod-kvdo # vdo create --name=Vdo1 --device=/dev/vdd --vdoLogicalSize=50G # mkfs.xfs -K /dev/mapper/Vdo1
Q17. Configure System Tuning
# tuned-adm profile virtual-guest
Q18. Container with Systemd (RHEL 9)
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
Additional RHEL 9 Topics
SSH Configuration
Enable root login and set port 22
# vi /etc/ssh/sshd_config Port 22 PermitRootLogin yes # systemctl restart sshd
Firewall Configuration
# firewall-cmd --permanent --add-service=http # firewall-cmd --permanent --add-service=https # firewall-cmd --reload
Stratis (RHEL 9 – Recommended over 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
Container Persistent Storage
# 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