RHCSA Exam Notes – Web Version

LAB-only dropdowns (one click opens the whole lab). Content copied as-is from Word (no translation, no shortening). EXAMPLE blocks are highlighted inside the LAB.

RHCSA Exam Notes – LAB 01

Source: Lab 01 – Package management, user management

Based strictly on RH124 and RH134 course scripts

This document includes explanations + screenshot markers for exam proof.

PART 1 – PACKAGE MANAGEMENT (SERVERA)
Task 1 – Save list of installed packages

Lab Task: Save list of all installed packages to /root/dnf_list.txt

Script Reference: RH124 Chapter 12 (DNF), Chapter 2 & 3 (Redirection)

dnf list installed > /root/dnf_list.txt

Explanation:

dnf list installed displays all installed packages.
> redirects output into a file.
/root requires root privileges.
📸 TAKE SCREENSHOT HERE:
ls -l /root/dnf_list.txt
head /root/dnf_list.txt
Task 2 – Ensure nginx is installed

Lab Task: Verify nginx is installed

Script Reference: RH124 Chapter 12

dnf list installed nginx
dnf install nginx  (if not installed)

Explanation:

dnf list installed nginx checks if package exists.
dnf install installs package and dependencies.
📸 TAKE SCREENSHOT HERE:
dnf list installed nginx
Task 3 – Ensure wget is NOT installed

Lab Task: Verify wget is not installed

Script Reference: RH124 Chapter 12

dnf list installed wget
dnf remove wget  (if installed)

Explanation:

dnf remove uninstalls package.
Re-run dnf list installed wget to verify removal.
📸 TAKE SCREENSHOT HERE:
dnf list installed wget
Task 4 – Ensure no updates available

Lab Task: System must be fully updated

Script Reference: RH124 Chapter 12

dnf check-update
dnf update  (if updates available)

Explanation:

dnf check-update shows available updates.
dnf update installs available updates.
If check-update returns no list, system is up to date.
📸 TAKE SCREENSHOT HERE:
dnf check-update (must show no available packages)
PART 2 – PACKAGE MANAGEMENT (SERVERB)
Task 5 – Add EPEL repository

Lab Task: Enable epel repository and verify

Script Reference: RH124 Chapter 12 (Repository management)

dnf install epel-release
dnf repolist

Explanation:

epel-release installs EPEL repository configuration.

dnf repolist verifies enabled repositories.
📸 TAKE SCREENSHOT HERE:
dnf repolist (must show epel)
Task 6 – Install htop

Lab Task: Install and verify htop works

Script Reference: RH124 Chapter 12

dnf install htop
htop

Explanation:

dnf install installs htop.
Running htop verifies successful installation.
📸 TAKE SCREENSHOT HERE:

htop running in terminal

PART 3 – USERS AND GROUPS (SERVERA)
Task 7 – Create groups

Lab Task: Create employees and bosses groups

Script Reference: RH124 Chapter 6

groupadd employees
groupadd bosses
grep employees /etc/group
grep bosses /etc/group

Explanation:

groupadd creates new group.
/etc/group stores group information.
grep verifies group exists.
📸 TAKE SCREENSHOT HERE:
grep employees /etc/group
 grep bosses /etc/group
Task 8 – Create users and assign groups

Lab Task: Create employee1, employee2, boss1, boss2

Script Reference: RH124 Chapter 6

useradd -m -G employees employee1
useradd -m -G employees employee2
useradd -m -G bosses boss1
useradd -m -G bosses boss2
id employee1
id boss1

Explanation:

-m creates home directory.

-G assigns supplementary group.

id verifies UID, GID and group membership.
📸 TAKE SCREENSHOT HERE:
id employee1
id employee2
id boss1
id boss2
PART 4 – DIRECTORY PERMISSIONS
Task 9 – Create shared directories and set permissions

Lab Task: Configure ownership and permissions

Script Reference: RH124 Chapter 7

mkdir -p /shared/employees
mkdir -p /shared/bosses
chown :employees /shared/employees
chown :bosses /shared/bosses
chmod 770 /shared/employees
chmod 770 /shared/bosses
ls -ld /shared/employees
ls -ld /shared/bosses

Explanation:

chown :group changes group ownership.
chmod 770 gives rwx to owner and group, none to others.
ls -ld verifies permissions.
📸 TAKE SCREENSHOT HERE:
ls -ld /shared/employees
ls -ld /shared/bosses
Task 10 – Configure ACL for bosses read-only

Lab Task: Bosses must have read-only access to employees directory

Script Reference: RH124 Chapter 7 (ACL section)

setfacl -m g:bosses:rx /shared/employees
getfacl /shared/employees

Explanation:

setfacl modifies ACL for group bosses.

rx gives read and execute (directory traversal).

getfacl verifies ACL configuration.

📸 TAKE SCREENSHOT HERE:

getfacl /shared/employees (must show group:bosses:r-x)

⭐ EXAMPLE highlighted

Napravite sve što je potrebno kako bi korisnici profesor1, profesor2 i profesor3, članovi grupe profesori imali sva prava na direktorij /profesori i prava čitanja u direktoriju /studenti. Nitko osim profesora ne smije imati nikakva prava na direktoriju /profesori Napravite sve što je potrebno kako bi korisnici student1, student2 i student3, članovi grupe studenti imali sva prava nad direktorijem /studenti. Testirajte i dokažite funkcionalnosti kreiranjem jednostavnih .txt datoteka.

2️⃣ Rješenje koristeći samo komande iz skripti
Korak 1 – grupe
groupadd profesori
groupadd studenti
Korak 2 – dodavanje korisnika u grupe
usermod -aG profesori profesor1
usermod -aG profesori profesor2
usermod -aG profesori profesor3
usermod -aG studenti student1
usermod -aG studenti student2
usermod -aG studenti student3

Provjera:

id profesor1
id student1
3️⃣ direktoriji
mkdir /profesori
mkdir /studenti
4️⃣ vlasništvo direktorija
chown root:profesori /profesori
chown root:studenti /studenti

Provjera:

ls -ld /profesori
ls -ld /studenti
5️⃣ permisije direktorija
/profesori
oktalna notacija
chmod 2770 /profesori

znači:

2 → setgid

7 → rwx owner

7 → rwx group

0 → no access others

znakovna notacija

isti rezultat možeš dobiti:

chmod u+rwx,g+rwx,o-rwx /profesori
chmod g+s /profesori

📌 što radi g+s

setgid na direktoriju znači da sve nove datoteke dobiju grupu profesori.

6️⃣ /studenti direktorij
oktalna
chmod 2770 /studenti
znakovna
chmod u+rwx,g+rwx,o-rwx /studenti
chmod g+s /studenti
7️⃣ čitanje /studenti za profesore

Ovo je važna logika.

Ako ne koristimo ACL, onda nije moguće dati read pristup drugoj grupi bez da otvorimo direktorij i za druge.

Zato je najbliže rješenje:

chmod 2755 /studenti
objašnjenje

2 → setgid

7 → owner

5 → group

5 → others

others mogu čitati, ali ne mogu pisati.

znakovna verzija
chmod u+rwx,g+rx,o+rx /studenti
chmod g+s /studenti
8️⃣ test funkcionalnosti
profesor može pisati u /profesori

su - profesor1

touch /profesori/test_prof.txt
student ne može

su - student1

touch /profesori/test_student.txt

dobiješ:

Permission denied

student može pisati u /studenti

su - student1

touch /studenti/test_student.txt
profesor može čitati /studenti

su - profesor1

ls /studenti
cat /studenti/test_student.txt

ali ne može pisati:

touch /studenti/prof_fail.txt
9️⃣ dokaz (za screenshot)
ls -ld /profesori
ls -ld /studenti

i

ls -l /profesori
ls -l /studenti
PART 5 – SERVERB USERS & SSH
Task 11 – Create remote users with custom home directories

Lab Task: Home directories must be under /shared

Script Reference: RH124 Chapter 6

mkdir -p /shared/remote1 /shared/remote2 /shared/remote3
useradd -d /shared/remote1 -m remote1
useradd -d /shared/remote2 -m remote2
useradd -d /shared/remote3 -m remote3
ls -ld /shared/remote*

Explanation:

-d specifies custom home directory.

ls -ld verifies directory creation.
📸 TAKE SCREENSHOT HERE:
ls -ld /shared/remote*
Task 12 – Passwordless SSH (student → remote1)

Lab Task: SSH login without password

Script Reference: RH124 Chapter 10

ssh-keygen (on WORKSTATION)
ssh-copy-id remote1@SERVERB
ssh remote1@SERVERB

Explanation:

ssh-keygen creates key pair.
ssh-copy-id copies public key to authorized_keys.
Login should occur without password prompt.
📸 TAKE SCREENSHOT HERE:

Successful SSH login without password prompt

Task 13 – Password SSH for remote2

Lab Task: remote2 must require password login

Script Reference: RH124 Chapter 10

passwd remote2
grep PasswordAuthentication /etc/ssh/sshd_config
systemctl restart sshd
ssh remote2@SERVERB

Explanation:

passwd sets password.
PasswordAuthentication must be enabled.
Restart sshd after config changes.
📸 TAKE SCREENSHOT HERE:

SSH login showing password prompt

Task 14 – remote3 full admin rights

Lab Task: remote3 must execute all commands as administrator

Script Reference: RH124 Chapter 6 (wheel group)

usermod -aG wheel remote3
id remote3
sudo dnf list installed

Explanation:

Adding user to wheel group grants sudo privileges.

id verifies group membership.

sudo command verifies administrative access.

📸 TAKE SCREENSHOT HERE:
id remote3 and successful sudo command output
EXAMPLE SSH
Na servera kreirajte korisnika ishod3, te kreirajte njegove SSH ključeve. Dokažite prisutnost SSH ključeva. Napravite sve što je potrebno kako bi korisnik ishod3 sa servera mogao pristupiti na serverb kao korisnik student bez unosa lozinke.

Riješimo zadatak točno kako bi se očekivalo na RH124/RH134 ispitu, koristeći komande iz skripti (Chapter 10 – Configure and Secure SSH).

Zadatak ima 4 logička koraka.

1️⃣ Kreirati korisnika ishod3 na servera

Na servera:

useradd ishod3
passwd ishod3

Provjera:

id ishod3
📸 Screenshot: rezultat id ishod3
2️⃣ Generirati SSH ključeve za korisnika ishod3

Prebaci se na korisnika:

su - ishod3

Generiraj SSH ključeve:

ssh-keygen

Samo pritisni Enter nekoliko puta.

Time se kreiraju:

~/.ssh/id_rsa

~/.ssh/id_rsa.pub

3️⃣ Dokazati da ključevi postoje
ls -l ~/.ssh

Trebaš vidjeti:

id_rsa

id_rsa.pub

📸 Screenshot: ls -l ~/.ssh

Možeš pokazati i sadržaj javnog ključa:

cat ~/.ssh/id_rsa.pub
4️⃣ Omogućiti login bez lozinke na serverb

Sada kopiramo javni ključ na serverb.

Još uvijek kao ishod3 na servera:

ssh-copy-id student@serverb

Upiši lozinku korisnika student na serverb.

Ova komanda:

kopira id_rsa.pub

sprema ga u

~student/.ssh/authorized_keys

na serverb.

5️⃣ Test login bez lozinke

Sada probaj:

ssh student@serverb

Ako je sve dobro napravljeno:

✔ neće tražiti lozinku

📸 Screenshot: uspješan login
6️⃣ Provjera na serverb (dodatni dokaz)

Na serverb:

ls -l ~/.ssh

i

cat ~/.ssh/authorized_keys

vidi se javni ključ.

📸 Screenshot: sadržaj authorized_keys
7️⃣ Što se zapravo dogodilo (logika SSH-a)

Proces je:

servera (ishod3)

│ SSH ključ

serverb (student)

~/.ssh/authorized_keys

Kada se spojiš:

serverb vidi javni ključ

servera dokazuje identitet privatnim ključem

login se dozvoljava bez lozinke

8️⃣ Minimalna verzija za ispit (cheat sheet)

Ako moraš brzo riješiti zadatak:

useradd ishod3

su - ishod3

ssh-keygen
ssh-copy-id student@serverb
ssh student@serverb
RHCSA Exam Notes – LAB 02

Source: Lab 02 – Disks and Partitions

Based strictly on RH134 Chapter 7 – Manage Basic Storage

Includes explanations + screenshot markers for exam proof.

PART 1 – Verify Available Disk (SERVERA)
Task 1 – Verify /dev/vdb exists

Lab Task: Confirm second disk before partitioning

Script Reference: RH134 Chapter 7 (lsblk usage)

lsblk

Explanation:

lsblk lists block devices and partitions.

Verify that /dev/vdb exists and has no partitions.

📸 TAKE SCREENSHOT HERE:

lsblk output showing /dev/vdb

PART 2 – Create Partitions on /dev/vdb
Task 2 – Create 300MB primary partition (XFS)

Lab Task: Create first partition of size 300MB

Script Reference: RH134 Chapter 7 (fdisk usage)

fdisk /dev/vdb

Explanation:

Inside fdisk:

n → new partition

p → primary

1 → partition number

Accept default first sector

+300M → size

w → write changes

📸 TAKE SCREENSHOT HERE:

fdisk partition table after creating 300MB partition

Task 3 – Create 500MB primary partition (EXT4)

Lab Task: Create second partition of size 500MB

Script Reference: RH134 Chapter 7 (fdisk usage)

fdisk /dev/vdb

Explanation:

n → new partition

p → primary

2 → partition number

Accept default first sector

+500M → size

w → write changes

📸 TAKE SCREENSHOT HERE:

fdisk partition table after creating second partition

Task 4 – Create 500MB swap partition

Lab Task: Create third partition and set type to swap

Script Reference: RH134 Chapter 7 (fdisk + swap type)

fdisk /dev/vdb

Explanation:

n → new partition

p → primary

3 → partition number

+500M → size

t → change type

3 → select partition 3

82 (or Linux swap in RHEL9)

w → write changes

📸 TAKE SCREENSHOT HERE:

fdisk showing swap partition type

PART 3 – Create Filesystems
Task 5 – Create XFS filesystem

Lab Task: Format first partition with XFS

Script Reference: RH134 Chapter 7 (mkfs.xfs)

mkfs.xfs /dev/vdb1

Explanation:

mkfs.xfs creates XFS filesystem on specified partition.
📸 TAKE SCREENSHOT HERE:
mkfs.xfs command output
Task 6 – Create EXT4 filesystem

Lab Task: Format second partition with EXT4

Script Reference: RH134 Chapter 7 (mkfs.ext4)

mkfs.ext4 /dev/vdb2

Explanation:

mkfs.ext4 creates EXT4 filesystem.
📸 TAKE SCREENSHOT HERE:
mkfs.ext4 command output
Task 7 – Configure swap

Lab Task: Initialize and enable swap partition

Script Reference: RH134 Chapter 7 (mkswap + swapon)

mkswap /dev/vdb3
swapon /dev/vdb3

Explanation:

mkswap initializes swap area.

swapon activates swap immediately.

Use swapon --show to verify.

swapon --show
📸 TAKE SCREENSHOT HERE:

swapon --show output

PART 4 – Mount Filesystems
Task 8 – Mount XFS and EXT4

Lab Task: Mount to /mount/xfs and /mount/ext4

Script Reference: RH134 Chapter 7 (mount usage)

mkdir -p /mount/xfs
mkdir -p /mount/ext4
mount /dev/vdb1 /mount/xfs
mount /dev/vdb2 /mount/ext4
df -h

Explanation:

mkdir creates mount points.
mount attaches filesystem.
df -h verifies mount success.
📸 TAKE SCREENSHOT HERE:

df -h showing mounted filesystems

PART 5 – Configure Persistent Mount at Boot
Task 9 – Configure /etc/fstab

Lab Task: All partitions including swap must mount at boot

Script Reference: RH134 Chapter 7 (fstab configuration)

blkid /dev/vdb1
blkid /dev/vdb2
blkid /dev/vdb3

Explanation:

blkid retrieves UUID.
Using UUID in /etc/fstab is recommended practice.
vi /etc/fstab

Explanation:

Add entries:

UUID=<uuid1> /mount/xfs xfs defaults 0 0

UUID=<uuid2> /mount/ext4 ext4 defaults 0 0

UUID=<uuid3> swap swap defaults 0 0

mount -a

Explanation:

mount -a tests fstab without reboot.
If no errors appear, configuration is correct.
📸 TAKE SCREENSHOT HERE:
mount -a (no errors) and

df -h

swapon --show

RHCSA Exam Notes – LAB 03 (Part 1 & 2)

Source: Lab 03 – Logging and Network Configuration

Based strictly on RH124 Chapter 11 and RH134 Chapters 2 & 3

PART 1 – Time Zone Configuration (SERVERA)
Task 1 – Set timezone to Europe/Zagreb

Lab Task: Set timezone and ensure reboot persistence

Script Reference: RH134 Chapter 3 (timedatectl usage)

timedatectl set-timezone Europe/Zagreb
timedatectl

Explanation:

timedatectl set-timezone changes system timezone.
This change is automatically persistent.
timedatectl verifies current timezone settings.
📸 TAKE SCREENSHOT HERE:
timedatectl (must show Time zone: Europe/Zagreb)
PART 2 – Journalctl Usage (SERVERA)
Task 2 – Last 25 journal entries

Lab Task: Show last 25 journal entries

Script Reference: RH134 Chapter 3

journalctl -n 25

Explanation:

-n specifies number of last entries to display.

📸 TAKE SCREENSHOT HERE:
journalctl -n 25 output
Task 3 – Follow journal live

Lab Task: Follow entries currently added

Script Reference: RH134 Chapter 3

journalctl -f

Explanation:

-f follows new entries in real time.

📸 TAKE SCREENSHOT HERE:
journalctl -f showing live entries
Task 4 – Follow SSH daemon entries

Lab Task: Follow SSH daemon logs

Script Reference: RH134 Chapter 3

journalctl -f -u sshd

Explanation:

-u filters by systemd unit (sshd service).

📸 TAKE SCREENSHOT HERE:
journalctl -f -u sshd
Task 5 – Filter by priority warn and higher

Lab Task: Show warning and above

Script Reference: RH134 Chapter 3

journalctl -p warning

Explanation:

-p warning shows logs of priority warning and higher (err, crit, alert, emerg).

📸 TAKE SCREENSHOT HERE:
journalctl -p warning output
Task 6 – List boot times

Lab Task: List all boot sessions

Script Reference: RH134 Chapter 3

journalctl --list-boots

Explanation:

--list-boots lists all recorded boot sessions.

📸 TAKE SCREENSHOT HERE:
journalctl --list-boots output
Task 7 – Entries since last boot

Lab Task: Show entries since last boot

Script Reference: RH134 Chapter 3

journalctl -b

Explanation:

-b shows logs from current boot.

📸 TAKE SCREENSHOT HERE:
journalctl -b output
Task 8 – Entries for root user

Lab Task: Filter logs for root user

Script Reference: RH134 Chapter 3

journalctl _UID=0

Explanation:

_UID=0 filters entries generated by root user.

📸 TAKE SCREENSHOT HERE:
journalctl _UID=0 output
Task 9 – Entries since 1st June 2024

Lab Task: Filter by specific date

Script Reference: RH134 Chapter 3

journalctl --since '2024-06-01'

Explanation:

--since filters logs starting from specified date.

📸 TAKE SCREENSHOT HERE:
journalctl --since '2024-06-01'
Task 10 – Entries since yesterday

Lab Task: Filter since yesterday

Script Reference: RH134 Chapter 3

journalctl --since yesterday

Explanation:

--since yesterday filters from previous day.

📸 TAKE SCREENSHOT HERE:
journalctl --since yesterday
Task 11 – Entries since 3rd June in UTC

Lab Task: Filter logs in UTC timezone

Script Reference: RH134 Chapter 3

journalctl --since '2024-06-03' --utc

Explanation:

--utc displays timestamps in UTC timezone.

📸 TAKE SCREENSHOT HERE:
journalctl --since '2024-06-03' --utc
Task 12 – Entries since 5 hours ago

Lab Task: Relative time filtering

Script Reference: RH134 Chapter 3

journalctl --since '5 hours ago'

Explanation:

Relative time filtering supported in journalctl.

📸 TAKE SCREENSHOT HERE:
journalctl --since '5 hours ago'
Task 13 – Save verbose journal to file

Lab Task: Save all entries in verbose format

Script Reference: RH134 Chapter 3

journalctl -o verbose > /tmp/verbose_journal.txt

Explanation:

-o verbose shows detailed fields. Output redirected to file.

📸 TAKE SCREENSHOT HERE:
ls -l /tmp/verbose_journal.txt
Task 14 – Show journal disk usage

Lab Task: Display journal disk usage

Script Reference: RH134 Chapter 3

journalctl --disk-usage

Explanation:

--disk-usage shows current journal size.

📸 TAKE SCREENSHOT HERE:
journalctl --disk-usage output
Task 15 – Limit journal disk usage to 50MB

Lab Task: Reduce disk usage

Script Reference: RH134 Chapter 3

journalctl --vacuum-size=50M

Explanation:

--vacuum-size removes older logs until usage is 50MB.

📸 TAKE SCREENSHOT HERE:
journalctl --disk-usage after vacuum
Task 16 – SSH logs by PID

Lab Task: Filter logs by SSH process PID

Script Reference: RH134 Chapter 3

pidof sshd
journalctl _PID=<PID>

Explanation:

pidof retrieves process ID. _PID filter shows logs from that process.

📸 TAKE SCREENSHOT HERE:
journalctl _PID=<PID> output
RHCSA Exam Notes – LAB 03 (Part 3 & 4)

Based strictly on RH134 Chapter 2 (Scheduling) and Chapter 3 (Logging)

PART 3 – Custom rsyslog Configuration (SERVERA)
Task 17 – Save kernel logs to /var/log/kernel

Lab Task: Create rsyslog config file for kernel facility

Script Reference: RH134 Chapter 3

vi /etc/rsyslog.d/kernel.conf
Add:  kern.*   /var/log/kernel
systemctl restart rsyslog

Explanation:

kern.* selects all kernel facility logs.

Custom config files are placed in /etc/rsyslog.d/.

Restart rsyslog to apply changes.

📸 TAKE SCREENSHOT HERE:
systemctl status rsyslog and ls -l /var/log/kernel
Task 18 – Save cron logs to /var/log/custom-cron.log

Lab Task: Create rsyslog rule for cron facility

Script Reference: RH134 Chapter 3

vi /etc/rsyslog.d/cron.conf
Add:  cron.*   /var/log/custom-cron.log
systemctl restart rsyslog

Explanation:

cron.* selects all cron related logs.

Restart required after configuration change.

📸 TAKE SCREENSHOT HERE:
ls -l /var/log/custom-cron.log
Task 19 – Save SSH logs INFO and higher

Lab Task: Filter sshd logs by priority

Script Reference: RH134 Chapter 3

vi /etc/rsyslog.d/ssh.conf
Add:  authpriv.info   /var/log/ssh-custom.log
systemctl restart rsyslog

Explanation:

authpriv facility handles SSH authentication logs.

.info captures INFO level and higher priorities.

📸 TAKE SCREENSHOT HERE:
ls -l /var/log/ssh-custom.log
Task 20 – Save local7 facility logs

Lab Task: Create rule for local7 facility

Script Reference: RH134 Chapter 3

vi /etc/rsyslog.d/local7.conf
Add:  local7.*   /var/log/local7-custom.log
systemctl restart rsyslog

Explanation:

local7 is a custom facility often used for testing.

local7.* captures all priorities.

📸 TAKE SCREENSHOT HERE:
ls -l /var/log/local7-custom.log
PART 4 – Cron Jobs (student user)
Task 21 – Disk usage every 2 minutes

Lab Task: Save root partition usage with timestamp

Script Reference: RH134 Chapter 2

crontab -e (as student)
*/2 * * * * date +"%m-%d-%Y %H-%M-%S" >> /var/log/disk_usage.log && df -h / >> /var/log/disk_usage.log

Explanation:

*/2 runs every 2 minutes.

date formats timestamp.

df -h / shows root partition usage.

📸 TAKE SCREENSHOT HERE:
crontab -l showing disk usage entry
Task 22 – EMERG local7 message every 5 minutes

Lab Task: Write journal entry via logger

Script Reference: RH134 Chapter 2 & 3

crontab -e (as student)
*/5 * * * * logger -p local7.emerg "2024 is the year of Linux desktop!"

Explanation:

logger writes message to syslog.

-p specifies facility.priority.

local7.emerg = highest priority.

📸 TAKE SCREENSHOT HERE:
crontab -l showing local7 entry
Task 23 – Complex cron expression

Lab Task: Every 2 minutes on odd days in June, August, December between 9-17

Script Reference: RH134 Chapter 2

crontab -e (as student)
*/2 9-17 1-31/2 6,8,12 * logger "Just when I thought I knew crontab, this happens…"

Explanation:

*/2 = every 2 minutes.

9-17 = between 9 and 17 hours.

1-31/2 = odd days.

6,8,12 = June, August, December.

📸 TAKE SCREENSHOT HERE:
crontab -l showing complex cron entry
RHCSA Exam Notes – LAB 03 (Part 5 & 6)

Based strictly on RH134 Chapter 3 (Logrotate) and RH124 Chapter 11 (Networking)

PART 5 – Log Rotation (SERVERA)
Task 24 – Rotate /var/log/kernel daily

Lab Task: Daily rotation of kernel log

Script Reference: RH134 Chapter 3 (logrotate)

vi /etc/logrotate.d/kernel
/var/log/kernel {
daily
rotate 7
}

Explanation:

daily rotates log every day.

rotate 7 keeps last 7 rotated files.

📸 TAKE SCREENSHOT HERE:

logrotate config file content for kernel

Task 25 – Rotate custom-cron.log weekly, keep 2 months

Lab Task: Weekly rotation, keep 8 files (~2 months)

Script Reference: RH134 Chapter 3

vi /etc/logrotate.d/custom-cron
/var/log/custom-cron.log {
weekly
rotate 8
}

Explanation:

weekly rotates log every week.

rotate 8 keeps approximately 2 months of logs.

📸 TAKE SCREENSHOT HERE:

logrotate config for custom-cron.log

Task 26 – Rotate local7-custom.log monthly with compression rules

Lab Task: Keep 3 months uncompressed, next 9 compressed

Script Reference: RH134 Chapter 3

vi /etc/logrotate.d/local7-custom
/var/log/local7-custom.log {
monthly
rotate 12
compress
delaycompress
}

Explanation:

monthly rotates every month.

rotate 12 keeps 12 months.

compress compresses rotated logs.

delaycompress leaves most recent rotated file uncompressed.

📸 TAKE SCREENSHOT HERE:

logrotate config for local7-custom.log

Task 27 – Rotate disk_usage.log daily without compression, keep 30 logs

Lab Task: Add postrotate journal entry

Script Reference: RH134 Chapter 3

vi /etc/logrotate.d/disk_usage
/var/log/disk_usage.log {
daily
rotate 30
nocompress
postrotate
logger "Finished rotating disk usage logs"
endscript
}

Explanation:

nocompress disables compression.

postrotate runs command after rotation.

logger writes entry into journal.

📸 TAKE SCREENSHOT HERE:

logrotate config for disk_usage.log

EXAMPLE - LOGGING, RSYSLOG, CRONTAB, JOURNALCTL

Koristeći naredbu “logger”, podesite stanje da se u datoteku /var/log/custom-log.log svakih 10 minuta upisuje tekst “Probni ispit MI1”.
Podesite konfiguraciju rsyslog servisa kako bi se sve info poruke zapisivale u datoteku /var/log/info-log.log
Ispišite sve log zapise iz Journala koji su nastali od danas u 17:00 pa sve do 5 minuta prije trenutnog vremena

Riješit ćemo zadatak na način kako se radi u RH134 (Analyze and Store Logs + Schedule Future Tasks) koristeći komande iz skripti:

logger, crontab, rsyslog, journalctl.

Podijelit ćemo rješenje po točkama.

1️⃣ Upis u log svakih 10 minuta pomoću logger

Zadatak kaže:

svakih 10 minuta u /var/log/custom-log.log upisati tekst

“Probni ispit MI1”

Korak 1 – napraviti cron zadatak

Otvoriti cron za root:

crontab -e

Dodati liniju:

*/10 * * * * logger -f /var/log/custom-log.log "Probni ispit MI1"

Objašnjenje

Cron format:

*/10 * * * *

svakih 10 minuta

logger:

logger "tekst"

šalje poruku u syslog sustav.

Opcija:

-f

šalje sadržaj datoteke.

Ako želimo direktno zapisati tekst, često se koristi:

*/10 * * * * logger "Probni ispit MI1"

a zatim rsyslog usmjerava u log datoteku.

Provjera

Nakon 10 minuta:

cat /var/log/custom-log.log
📸 Screenshot: sadržaj datoteke.
2️⃣ Sve INFO poruke zapisivati u /var/log/info-log.log

Ovo je konfiguracija rsyslog.

Korak 1 – napraviti konfiguracijsku datoteku

Preporučeni način (kao u skriptama):

vi /etc/rsyslog.d/info.conf

Dodati:

*.info /var/log/info-log.log

Objašnjenje

Format rsyslog pravila:

facility.priority log_file

*.info

znači:

sve aplikacije

prioritet info ili viši

Korak 2 – restart rsyslog
systemctl restart rsyslog
Test

Pošalji info poruku:

logger -p user.info "Test INFO log"

Provjera:

cat /var/log/info-log.log
📸 Screenshot: poruka u logu.
3️⃣ Journal zapisi od danas 17:00 do 5 minuta prije sada

Koristi se journalctl.

Komanda
journalctl --since "today 17:00" --until "5 minutes ago"
Objašnjenje
Primjer
journalctl --since "2026-02-05 17:00" --until "5 minutes ago"
Screenshot za dokaz
📸
journalctl --since "today 17:00" --until "5 minutes ago"
4️⃣ Kratka verzija za ispit (cheat sheet)
Cron logger
crontab -e

*/10 * * * * logger "Probni ispit MI1"

rsyslog
vi /etc/rsyslog.d/info.conf

*.info /var/log/info-log.log

systemctl restart rsyslog
journal
journalctl --since "today 17:00" --until "5 minutes ago"
PART 6 – Network Configuration (SERVERA)
Task 28 – Display current IP addresses

Lab Task: Show configured IP addresses

Script Reference: RH124 Chapter 11

ip addr

Explanation:

ip addr displays network interfaces and IP addresses.
📸 TAKE SCREENSHOT HERE:
ip addr output
Task 29 – Confirm connectivity with SERVERB

Lab Task: Test network connection

Script Reference: RH124 Chapter 11

ping SERVERB

Explanation:

ping verifies network connectivity.

📸 TAKE SCREENSHOT HERE:

ping SERVERB successful output

Task 30 – Show routing table and explain entries

Lab Task: Display routing table

Script Reference: RH124 Chapter 11

ip route

Explanation:

default via = default gateway.

network/mask = directly connected network.

dev = interface used.

📸 TAKE SCREENSHOT HERE:
ip route output
Task 31 – Trace packet path

Lab Task: Show route packets take

Script Reference: RH124 Chapter 11

traceroute SERVERB

Explanation:

traceroute shows each hop packet travels through.

📸 TAKE SCREENSHOT HERE:

traceroute SERVERB output

Task 32 – Show listening TCP ports

Lab Task: Display TCP ports with services

Script Reference: RH124 Chapter 11

ss -tuln

Explanation:

ss -tuln lists TCP/UDP listening ports.

📸 TAKE SCREENSHOT HERE:

ss -tuln output

Task 33 – Prove SSH port binding

Lab Task: Verify SSH service port

Script Reference: RH124 Chapter 11

ss -tuln | grep 22

Explanation:

SSH default port is 22. grep filters for it.

📸 TAKE SCREENSHOT HERE:

ss -tuln | grep 22 output

Task 34 – Create static connection homework-network

Lab Task: Configure static IP via nmcli

Script Reference: RH124 Chapter 11

nmcli con add type ethernet con-name homework-network ifname <interface> ip4 10.10.10.250/24 gw4 10.10.10.254
nmcli con mod homework-network ipv4.dns 10.10.10.253
nmcli con mod homework-network ipv4.method manual
nmcli con up homework-network

Explanation:

nmcli adds new static connection.
ipv4.method manual sets static configuration.
Connection activates immediately.
📸 TAKE SCREENSHOT HERE:
nmcli con show homework-network
reboot

Explanation:

After reboot, verify connection persists.

📸 TAKE SCREENSHOT HERE:
ip addr and nmcli con show after reboot
EXAMPLE IP ADDRESS
Ispišite sve IP adrese na servera koje ostali serveri mogu koristiti kako bi kontaktirali servera.
Ispišite default rutu na serverb.
Na serverb podesite hostname na vrijednost “primjer-ispita”
Napravite sve što je potrebno kako bi workstation mašina mogla kontaktirati serverb koristeći hostname podešen u prethodnom zadatku

Napravite sve što je potrebno kako servera svoje sistemsko vrijeme NE BI sinkronizirao sa NTP poslužiteljem ž

Riješit ćemo zadatke koristeći komande iz RH124 i RH134 skripti (Chapter 11 – Manage Networking, plus systemd-timesyncd / chrony dio za vrijeme).

Podijelit ćemo po točkama.

3️⃣ Ispišite sve IP adrese na servera

Najčešće korištena komanda u RH skriptama:

ip addr

ili kraća verzija:

ip a

Ako želiš samo IP adrese:

ip -4 addr

ili:

hostname -I

Primjer outputa:

192.168.1.10 10.10.10.5

📸 Screenshot: ip addr
14️⃣ Ispišite default rutu na serverb

Komanda:

ip route

ili samo:

ip r

Output primjer:

default via 192.168.1.1 dev enp0s3

To znači:

gateway = 192.168.1.1

interface = enp0s3

Možeš i filtrirati:

ip route | grep default
📸 Screenshot: ip route
15️⃣ Promijeniti hostname na serverb

Komanda:

hostnamectl set-hostname primjer-ispita

Provjera:

hostnamectl

ili

hostname

📸 Screenshot: hostnamectl
16️⃣ Omogućiti da workstation koristi hostname

Treba napraviti DNS ili hosts konfiguraciju.

Najjednostavnije rješenje (često očekivano na ispitu):

na workstation

Otvoriti:

vi /etc/hosts

Dodati liniju:

IP_SERVERB primjer-ispita

npr:

192.168.1.20 primjer-ispita

Provjera:

ping primjer-ispita

📸 Screenshot: uspješan ping
17️⃣ Spriječiti sinkronizaciju vremena sa NTP serverom

Na RHEL/CentOS koristi se chrony.

provjera
systemctl status chronyd
isključiti NTP sinkronizaciju
timedatectl set-ntp false
provjera
timedatectl status

treba pisati:

NTP service: inactive

📸 Screenshot: timedatectl
📋 Sažetak (ispitna verzija)
IP adrese
ip addr
default ruta
ip route
hostname
hostnamectl set-hostname primjer-ispita
omogućiti hostname resolution
vi /etc/hosts

IP_SERVERB primjer-ispita

isključiti NTP
timedatectl set-ntp false
⚠️ Mala napomena (ispit trik)

Za IP adrese profesori često vole ovu komandu:

ip -br a

jer daje čisti pregled IP-eva:

lo UNKNOWN 127.0.0.1

enp0s3 UP 192.168.1.10

Ako želiš, mogu ti napraviti i mali RHCSA networking cheat-sheet (10 komandi) koji pokriva skoro sve zadatke iz networking dijela ispita.

RHCSA Exam Notes – LAB 04 (DHCP and DNS)

Source: Lab 04 – DHCP and DNS

Based on recommended dnsmasq and BIND documentation from lab script

PART 1 – Initial Preparation (SERVERA & SERVERB)
Task 1 – Disable firewall and remove immutable flag

Lab Task: Stop firewalld and allow editing /etc/resolv.conf

Reference / Recommended Material: Lab instructions page 4

systemctl stop firewalld
chattr -i /etc/resolv.conf

Explanation:

firewalld is stopped because DNS (53) and DHCP (67) ports would otherwise be blocked.

chattr -i removes immutable attribute from resolv.conf.

📸 TAKE SCREENSHOT HERE:
systemctl status firewalld and lsattr /etc/resolv.conf
PART 2 – DHCP Configuration with dnsmasq (SERVERB)
Task 2 – Configure DHCP range 10.10.10.100–150

Lab Task: Edit /etc/dnsmasq.conf

Reference / Recommended Material: dnsmasq official documentation (recommended links page 8)

dnf install dnsmasq
vi /etc/dnsmasq.conf

Explanation:

Add or modify the following lines in dnsmasq.conf:

interface=<interface>

dhcp-range=10.10.10.100,10.10.10.150,24h

dhcp-option=3,10.10.10.1

dhcp-option=6,10.10.10.254

dhcp-option=15,dnsmasq.local

24h = 1 day lease time.

systemctl enable --now dnsmasq

Explanation:

Enable and start dnsmasq service.

📸 TAKE SCREENSHOT HERE:
systemctl status dnsmasq
PART 3 – mikro.local DNS Zone (SERVERA)
Task 3 – Configure dnsmasq to serve mikro.local

Lab Task: Use /etc/dnsmasq.conf, /etc/hosts, /etc/resolv.conf

Reference / Recommended Material: dnsmasq documentation

dnf install dnsmasq
vi /etc/dnsmasq.conf

Explanation:

Add:

domain=mikro.local

local=/mikro.local/

expand-hosts

vi /etc/hosts

Explanation:

Add entries such as:

10.10.10.2 servera.mikro.local

10.10.10.3 serverb.mikro.local

10.10.10.4 serverc.mikro.local

10.10.10.10 email.mikro.local

systemctl restart dnsmasq

Explanation:

On WORKSTATION edit /etc/resolv.conf and set:

nameserver <SERVERA_IP>

📸 TAKE SCREENSHOT HERE:

nslookup servera.mikro.local from WORKSTATION

PART 4 – rhcsa.local DNS Zone (BIND on SERVERB)
Task 4 – Configure BIND to serve rhcsa.local

Lab Task: Edit /etc/named.conf and zone file

Reference / Recommended Material: Red Hat BIND documentation (recommended links page 8)

dnf install bind bind-utils
vi /etc/named.conf

Explanation:

Add zone definition inside named.conf:

zone "rhcsa.local" IN {

type master;

file "db.rhcsa.local";

};

mkdir -p /etc/named/zones/master
vi /etc/named/zones/master/db.rhcsa.local

Explanation:

Example zone file content:

$TTL 1D

@ IN SOA serverb.rhcsa.local. root.rhcsa.local. (

2024060501 1D 1H 1W 3H )

IN NS serverb.rhcsa.local.

servera IN A 10.10.20.10

serverb IN A 10.10.20.20

serverc IN A 10.10.20.30

email IN A 10.10.20.40

systemctl enable --now named

Explanation:

Enable and start BIND service.

📸 TAKE SCREENSHOT HERE:

nslookup servera.rhcsa.local from WORKSTATION

LAB 04 – Revision: Best Practice dnsmasq Configuration

This section supersedes the earlier dnsmasq configuration instructions.

Best practice: use /etc/dnsmasq.d/ directory instead of modifying main config file.

PART 1 – DHCP Configuration Using Separate .conf File (SERVERB)
Revised Task – Configure DHCP range 10.10.10.100–150

Lab Task: Use separate configuration file inside /etc/dnsmasq.d/

Reference / Best Practice: dnsmasq documentation – conf-dir directive

vi /etc/dnsmasq.d/dhcp-10.10.10.0.conf

Explanation:

RHEL loads additional configuration files from /etc/dnsmasq.d/.

This is cleaner and preferred over editing /etc/dnsmasq.conf directly.

ip addr  # identify correct interface name

Explanation:

Replace <interface> with actual interface name (e.g., ens224).

interface=ens224 means dnsmasq will listen only on that interface.

interface=ens224
bind-interfaces
dhcp-range=10.10.10.100,10.10.10.150,24h
dhcp-option=3,10.10.10.1
dhcp-option=6,10.10.10.254
dhcp-option=15,dnsmasq.local

Explanation:

bind-interfaces prevents dnsmasq from binding dynamically to other interfaces.

24h = 1 day lease time.

dhcp-option=3 sets default gateway.

dhcp-option=6 sets DNS server.

dhcp-option=15 sets domain name.

systemctl restart dnsmasq
systemctl status dnsmasq
📸 TAKE SCREENSHOT HERE:
cat /etc/dnsmasq.d/dhcp-10.10.10.0.conf
systemctl status dnsmasq
EXAMPLE – DNS, EMAIL
Na serverb podesite DNS servis koji će posluživati ispit.probni domenu. Za domenu kreirajte www i web zapise tipa A. Oba zapisa trebaju pokazivati na servera.
Napravite sve što je potrebno kako bi workstation mašina pitala serverb za sve upite vezane uz ispit.probni domenu

Napravite sve izmjene na razini DNS poslužitelja kako bi pripremili domenu na prosljeđivanje email – a.

Riješit ćemo zadatak na način kako ste radili u vašim labovima (dnsmasq), jer ste već koristili dnsmasq za DNS/DHCP u prethodnim vježbama. To je i najjednostavnije rješenje za ispit.

Podijelit ću rješenje po točkama.

18️⃣ DNS servis na serverb za domenu ispit.probni

DNS server će biti dnsmasq.

1. instalacija

Na serverb:

dnf install dnsmasq
2. konfiguracijska datoteka

Kao što smo već koristili u labovima, konfiguraciju stavljamo u:

/etc/dnsmasq.d/

Napraviti datoteku:

vi /etc/dnsmasq.d/ispit.conf
3. DNS konfiguracija

Dodati:

domain=ispit.probni

local=/ispit.probni/

address=/www.ispit.probni/IP_SERVERA

address=/web.ispit.probni/IP_SERVERA

Primjer:

domain=ispit.probni

local=/ispit.probni/

address=/www.ispit.probni/192.168.1.10

address=/web.ispit.probni/192.168.1.10

4. pokrenuti servis
systemctl enable --now dnsmasq
5. provjera

Na serverb:

dig www.ispit.probni

ili

host www.ispit.probni

📸 Screenshot: rezultat DNS upita.
19️⃣ workstation mora pitati serverb za domenu

Treba podesiti DNS resolver.

Na workstation:

vi /etc/resolv.conf

Dodati:

nameserver IP_SERVERB

search ispit.probni

Primjer:

nameserver 192.168.1.20

search ispit.probni

test

ping www.ispit.probni

ili

dig web.ispit.probni

📸 Screenshot: uspješan DNS odgovor.
20️⃣ priprema domene za email (MX zapis)

Za email treba dodati MX zapis.

Otvoriti opet:

vi /etc/dnsmasq.d/ispit.conf

Dodati:

mx-host=ispit.probni,mail.ispit.probni,10

address=/mail.ispit.probni/IP_SERVERB

Primjer:

mx-host=ispit.probni,mail.ispit.probni,10

address=/mail.ispit.probni/192.168.1.20

restart dnsmasq
systemctl restart dnsmasq
provjera MX zapisa

dig MX ispit.probni

treba pokazati:

mail.ispit.probni

📸 Screenshot: rezultat dig MX.
📋 konačna konfiguracija (/etc/dnsmasq.d/ispit.conf)

domain=ispit.probni

local=/ispit.probni/

address=/www.ispit.probni/192.168.1.10

address=/web.ispit.probni/192.168.1.10

mx-host=ispit.probni,mail.ispit.probni,10

address=/mail.ispit.probni/192.168.1.20

✔ Rezultat

MX zapis:

ispit.probni → mail.ispit.probni

⚠️ Jedan mali ispitni trik

Ako DNS ne radi, prvo provjeri:

systemctl status dnsmasq

ss -tulpn | grep :53

i

cat /etc/resolv.conf
RHCSA Exam Notes – LAB 05 (Email)

Source: Lab 05 – Email

Based on recommended dnsmasq and Postfix documentation from lab script

PART 1 – Initial Preparation (SERVERA & SERVERB)
Task 1 – Disable firewall and remove immutable flag

Lab Task: Stop firewalld and allow editing /etc/resolv.conf

Reference / Recommended Material: Lab instructions page 4

systemctl stop firewalld
chattr -i /etc/resolv.conf

Explanation:

Firewall disabled because SMTP uses TCP port 25.

chattr -i removes immutable attribute from resolv.conf.

📸 TAKE SCREENSHOT HERE:
systemctl status firewalld and lsattr /etc/resolv.conf
PART 2 – mikro.local Zone with MX Record (SERVERB)
Task 2 – Configure mikro.local DNS zone including MX record

Lab Task: Use separate file inside /etc/dnsmasq.d/

Reference / Recommended Material: dnsmasq documentation + mx-host option (lab page 5)

dnf install dnsmasq
vi /etc/dnsmasq.d/mikro-local.conf

Explanation:

Use separate configuration file instead of editing main file.

Example configuration:

domain=mikro.local
local=/mikro.local/
expand-hosts
mx-host=mikro.local,mail.mikro.local,10

Explanation:

mx-host defines mail exchanger record.

Format: mx-host=<domain>,<mail-host>,<priority>.

Priority 10 is common default.

vi /etc/hosts

Explanation:

Add A records:

172.25.250.10 servera.mikro.local

172.25.250.11 serverb.mikro.local

172.25.250.11 mail.mikro.local

systemctl restart dnsmasq
📸 TAKE SCREENSHOT HERE:

nslookup mail.mikro.local

nslookup -type=mx mikro.local

PART 3 – Postfix Configuration (SERVERB)
Task 3 – Configure postfix for mikro.local

Lab Task: Edit /etc/postfix/main.cf

Reference / Recommended Material: Red Hat Postfix documentation (lab page 8)

dnf install postfix
systemctl enable --now postfix
vi /etc/postfix/main.cf

Explanation:

Modify or verify the following parameters:

myhostname = mail.mikro.local
mydomain = mikro.local
myorigin = $mydomain
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mynetworks = 127.0.0.0/8, 172.25.250.0/24
mail_spool_directory = /var/spool/mail

Explanation:

myhostname = mail server FQDN.

mydomain = domain handled by postfix.

mydestination defines local delivery domains.

mynetworks defines trusted networks.

mail_spool_directory defines mailbox location.

systemctl restart postfix
📸 TAKE SCREENSHOT HERE:
systemctl status postfix
PART 4 – Test Email Delivery
Task 4 – Create test user and send email

Lab Task: Test local email delivery

Reference / Recommended Material: Postfix + telnet documentation

useradd admin
passwd admin
telnet mail.mikro.local 25
MAIL FROM: student@workstation.mikro.local
RCPT TO: admin@mikro.local
DATA
This is a test email.
.
QUIT

Explanation:

SMTP conversation via telnet.

Dot (.) ends DATA section.

📸 TAKE SCREENSHOT HERE:
journalctl -u postfix -n 20
cat /var/spool/mail/admin

Explanation:

Mailbox file contains delivered message.

📸 TAKE SCREENSHOT HERE:
cat /var/spool/mail/admin showing received email
LAB 05 – CORRECTED VERSION (Strictly Following Lab Instructions)

This section supersedes previous Lab 05 notes.

PART 1 – Initial Preparation (SERVERA & SERVERB)
Stop firewall and remove immutable flag

Lab Task: Disable firewalld and allow editing /etc/resolv.conf

Reference: Lab 05 – Page 4

systemctl stop firewalld
chattr -i /etc/resolv.conf

Explanation:

Firewall disabled (SMTP uses TCP 25). Remove immutable flag from resolv.conf.

📸 TAKE SCREENSHOT HERE:
systemctl status firewalld
lsattr /etc/resolv.conf
PART 2 – Configure mikro.local DNS Zone (SERVERB)
Configure dnsmasq to serve mikro.local including MX record

Lab Task: Use /etc/dnsmasq.conf only (as specified in lab)

Reference: Lab 05 – Page 5

dnf install dnsmasq
vi /etc/dnsmasq.conf

Explanation:

Add the following lines to /etc/dnsmasq.conf:

domain=mikro.local
local=/mikro.local/
address=/servera.mikro.local/172.25.250.10
address=/serverb.mikro.local/172.25.250.11
address=/mail.mikro.local/172.25.250.11
mx-host=mikro.local,mail.mikro.local,10

Explanation:

address= creates A records directly in dnsmasq.

mx-host defines Mail Exchanger record.

Format: mx-host=<domain>,<mail-host>,<priority>.

systemctl restart dnsmasq
systemctl status dnsmasq
📸 TAKE SCREENSHOT HERE:
cat /etc/dnsmasq.conf
systemctl status dnsmasq
PART 3 – Configure WORKSTATION DNS
Configure workstation to use SERVERB as DNS

Lab Task: Edit /etc/resolv.conf

Reference: Lab 05 – Page 5

vi /etc/resolv.conf
nameserver 172.25.250.11

Explanation:

Point workstation DNS to SERVERB IP address.

📸 TAKE SCREENSHOT HERE:
cat /etc/resolv.conf
nslookup mail.mikro.local
nslookup -type=mx mikro.local
PART 4 – Configure Postfix on SERVERB
Configure postfix to send and receive emails for mikro.local

Lab Task: Edit /etc/postfix/main.cf only

Reference: Lab 05 – Page 6

dnf install postfix
systemctl enable --now postfix
vi /etc/postfix/main.cf

Explanation:

Modify the following parameters:

myhostname = mail.mikro.local
mydomain = mikro.local
myorigin = $mydomain
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mynetworks = 127.0.0.0/8, 172.25.250.0/24
mail_spool_directory = /var/spool/mail

Explanation:

myhostname = FQDN of mail server.

mydestination defines domains handled locally.

mynetworks defines trusted networks.

systemctl restart postfix
📸 TAKE SCREENSHOT HERE:
systemctl status postfix
PART 5 – Test Email Delivery
Create user and send test email via telnet

Lab Task: Send mail from WORKSTATION to SERVERB

Reference: Lab 05 – Page 6

useradd admin
passwd admin
telnet mail.mikro.local 25
MAIL FROM: student@workstation.mikro.local
RCPT TO: admin@mikro.local
DATA
Test email from workstation.
.
QUIT

Explanation:

Dot (.) ends DATA section in SMTP conversation.

📸 TAKE SCREENSHOT HERE:
journalctl -u postfix -n 20
cat /var/spool/mail/admin

Explanation:

Verify email delivered to mailbox file.

📸 TAKE SCREENSHOT HERE:
cat /var/spool/mail/admin
LAB 05 – DNS Implementation Adjustment (Using /etc/dnsmasq.d/)

Lab requires /etc/dnsmasq.conf, but we implement using included configuration directory for cleaner practice.

Functionality remains EXACTLY the same as required by Lab 05.

PART – mikro.local DNS Zone (SERVERB) Using Separate .conf File
Configure mikro.local including MX record

Lab Task: Serve mikro.local zone exactly as required by Lab 05

Implementation Adjustment: /etc/dnsmasq.d/ instead of editing main file

dnf install dnsmasq
vi /etc/dnsmasq.d/mikro-local.conf

Explanation:

Add the following configuration inside the new file:

domain=mikro.local
local=/mikro.local/
address=/servera.mikro.local/172.25.250.10
address=/serverb.mikro.local/172.25.250.11
address=/mail.mikro.local/172.25.250.11
mx-host=mikro.local,mail.mikro.local,10

Explanation:

This configuration is identical to the lab requirement.

dnsmasq automatically loads files from /etc/dnsmasq.d/ because of the conf-dir directive in main config.

No modification of /etc/dnsmasq.conf is required.

systemctl restart dnsmasq
systemctl status dnsmasq
📸 TAKE SCREENSHOT HERE:
cat /etc/dnsmasq.d/mikro-local.conf
systemctl status dnsmasq
RHCSA Exam Notes – LAB 07 (LVM and Stratis)

Source: Lab 07 – LVM and Stratis

Based on RH134 Chapter 8 – Manage Storage Stack.

PART 1 – Configure LVM (SERVERA)
Prepare disks using fdisk

Lab Task: Create LVM partitions on two block devices

Script Reference: RH134 Chapter 8 – Disk partitioning

lsblk
fdisk /dev/vdb

Explanation:

Create partition with type 8e (Linux LVM). Repeat for /dev/vdc.

fdisk /dev/vdc
📸 TAKE SCREENSHOT HERE:

lsblk showing partitions on vdb and vdc

Create Physical Volumes

Lab Task: Initialize partitions as PVs

Script Reference: RH134 Chapter 8 – pvcreate

pvcreate /dev/vdb1 /dev/vdc1
pvs
📸 TAKE SCREENSHOT HERE:

pvs showing PVs

Create Volume Group

Lab Task: Combine PVs into VG

Script Reference: RH134 Chapter 8 – vgcreate

vgcreate lab05-vg /dev/vdb1 /dev/vdc1
vgs
📸 TAKE SCREENSHOT HERE:

vgs output

Create Logical Volume

Lab Task: 3GB LV named lab05-volume spanning two PVs

Script Reference: RH134 Chapter 8 – lvcreate

lvcreate -n lab05-volume -L 3G lab05-vg
lvs
📸 TAKE SCREENSHOT HERE:

lvs output

Create XFS filesystem

Lab Task: Sector size 512B

Script Reference: RH134 Chapter 8 – mkfs.xfs

mkfs.xfs -s size=512 /dev/lab05-vg/lab05-volume
📸 TAKE SCREENSHOT HERE:
mkfs.xfs output
Mount logical volume

Lab Task: Mount to /lab-05/lvm

Script Reference: RH134 Chapter 8 – mounting

mkdir -p /lab-05/lvm
mount /dev/lab05-vg/lab05-volume /lab-05/lvm
df -h
📸 TAKE SCREENSHOT HERE:

df -h showing mount

Persistent mount

Lab Task: Add to /etc/fstab

Script Reference: RH134 Chapter 8 – persistent mounts

blkid /dev/lab05-vg/lab05-volume
vi /etc/fstab
UUID=<uuid> /lab-05/lvm xfs defaults 0 0
mount -a
📸 TAKE SCREENSHOT HERE:
mount -a no errors
PART 2 – Configure Stratis (SERVERB)
Install Stratis

Lab Task: Install packages and enable service

Script Reference: RH134 Chapter 8 – Stratis

dnf install stratisd stratis-cli
systemctl enable --now stratisd
📸 TAKE SCREENSHOT HERE:
systemctl status stratisd
Create pool

Lab Task: Pool lab05pool with two devices

Script Reference: RH134 Chapter 8 – stratis pool create

stratis pool create lab05pool /dev/vdb /dev/vdc
stratis pool list
📸 TAKE SCREENSHOT HERE:
stratis pool list
Create filesystems

Lab Task: fs1 and fs2 size 1GB

Script Reference: RH134 Chapter 8 – stratis filesystem create

stratis filesystem create lab05pool fs1 1G
stratis filesystem create lab05pool fs2 1G
stratis filesystem list
📸 TAKE SCREENSHOT HERE:

filesystem list

Mount filesystems

Lab Task: Mount fs1 and fs2

Script Reference: RH134 Chapter 8 – mounting

mkdir -p /lab-05/stratis/fs1
mkdir -p /lab-05/stratis/fs2
mount /dev/stratis/lab05pool/fs1 /lab-05/stratis/fs1
mount /dev/stratis/lab05pool/fs2 /lab-05/stratis/fs2
📸 TAKE SCREENSHOT HERE:

df -h showing stratis mounts

Create test file

Lab Task: testing_snapshots.txt

Script Reference: Lab instruction

echo 'snapshot testing' > /lab-05/stratis/fs1/testing_snapshots.txt
echo 'snapshot testing' > /lab-05/stratis/fs2/testing_snapshots.txt
📸 TAKE SCREENSHOT HERE:
ls fs1
Create snapshot

Lab Task: Snapshot fs1

Script Reference: RH134 Chapter 8 – snapshots

stratis filesystem snapshot lab05pool fs1 fs1-snapshot
📸 TAKE SCREENSHOT HERE:

filesystem list showing snapshot

Delete file

Lab Task: Simulate data loss

Script Reference: Lab instruction

rm /lab-05/stratis/fs1/testing_snapshots.txt
📸 TAKE SCREENSHOT HERE:
ls fs1 showing missing file
Mount snapshot

Lab Task: Mount snapshot to recovery path

Script Reference: RH134 Chapter 8

mkdir -p /lab-05/stratis/fs1-recovery
mount /dev/stratis/lab05pool/fs1-snapshot /lab-05/stratis/fs1-recovery
📸 TAKE SCREENSHOT HERE:
ls recovery directory
Recover file

Lab Task: Recover using rsync

Script Reference: Lab instruction

rsync /lab-05/stratis/fs1-recovery/testing_snapshots.txt /lab-05/stratis/fs1/
📸 TAKE SCREENSHOT HERE:
ls fs1 showing recovered file
EXAMPLE – PV, LV, STRADIS
Na SERVERA, kreirajte 2 PV – a
Na SERVERA, dodajte prethodno kreirane PV – ove u VG nazvan ishod7VG
Iz VG – a ishod7VG, kreirajte 1 LV velicine 1GB sa velicinom bloka od 1024B. LV nazovite lv-1. Montirajte ga na /ishod-7/lv-1.
Iz VG – a ishod7VG, kreirajte 1 LV velicine 2 GB sa velicinom bloka od 512B. LV nazovite lv-2. Montirajte ga na /ishod-7/lv-2
Podesite dijeljenje direktorija /ishod-7/lv-1 koristeci NFS protokol. Svi trebaju imati prava citanja iz ovog direktorija.
Podesite dijeljenje direktorija /ishod-7/lv-2 koristeci NFS protokol. Svi trebaju imati prava citanja i pisanja iz ovog direktorija.
Na SERVERB, kreirajte stratis pool nazvan ishod7pool koji sadrzi 3 fizicka block uredaja
Na SERVERB, kreirajte iz ishod7pool – a 2 filesystema, imena stratis-1 i stratis-2. Montirajte ih na /ishod-7/stratis-1 i /ishod-7/stratis-2
Na SERVERB, montirajte NFS dijeljenje direktorije sa SERVERA i testirajte prava pristupa.

Riješit ćemo zadatak točno kako se radi u RH134 (Manage Storage Stack + NFS).

Koristit ćemo standardne komande iz skripti:

pvcreate
vgcreate
lvcreate
mkfs
mount

fstab

exportfs
stratis

Podijelit ćemo rješenje po točkama.

1️⃣ Na SERVERA kreirati 2 PV

Pretpostavimo da su diskovi:

/dev/sdb

/dev/sdc

Kreiranje PV:

pvcreate /dev/sdb
pvcreate /dev/sdc

Provjera:

pvs

📸 Screenshot: pvs
2️⃣ Dodati PV u VG ishod7VG
vgcreate ishod7VG /dev/sdb /dev/sdc

Provjera:

vgs

📸 Screenshot: vgs
3️⃣ LV 1GB (block size 1024B)
kreiranje LV
lvcreate -L 1G -n lv-1 ishod7VG
formatiranje (block size 1024B)
mkfs.ext4 -b 1024 /dev/ishod7VG/lv-1
mount
mkdir -p /ishod-7/lv-1
mount /dev/ishod7VG/lv-1 /ishod-7/lv-1
trajni mount
vi /etc/fstab

dodati:

/dev/ishod7VG/lv-1 /ishod-7/lv-1 ext4 defaults 0 0

Test:

mount -a

df -h

4️⃣ LV 2GB (block size 512B)
kreiranje
lvcreate -L 2G -n lv-2 ishod7VG
formatiranje
mkfs.ext4 -b 512 /dev/ishod7VG/lv-2
mount
mkdir -p /ishod-7/lv-2
mount /dev/ishod7VG/lv-2 /ishod-7/lv-2
fstab

/dev/ishod7VG/lv-2 /ishod-7/lv-2 ext4 defaults 0 0

Test:

mount -a

df -h

5️⃣ NFS dijeljenje /ishod-7/lv-1 (read-only)
instalacija NFS
dnf install nfs-utils
pokretanje servisa
systemctl enable --now nfs-server
konfiguracija
vi /etc/exports

dodati:

/ishod-7/lv-1 *(ro)

primijeniti konfiguraciju
exportfs -rav

Provjera:

exportfs -v
📸 Screenshot
6️⃣ NFS dijeljenje /ishod-7/lv-2 (read/write)

U /etc/exports dodati:

/ishod-7/lv-2 *(rw)

Primijeniti:

exportfs -rav
7️⃣ Na SERVERB kreirati Stratis pool

Pretpostavimo diskove:

/dev/sdb

/dev/sdc

/dev/sdd

instalacija
dnf install stratisd stratis-cli
pokretanje
systemctl enable --now stratisd
kreiranje poola
stratis pool create ishod7pool /dev/sdb /dev/sdc /dev/sdd

Provjera:

stratis pool list
8️⃣ Kreirati filesysteme
stratis filesystem create ishod7pool stratis-1
stratis filesystem create ishod7pool stratis-2
mount točke
mkdir -p /ishod-7/stratis-1
mkdir -p /ishod-7/stratis-2
mount
mount /dev/stratis/ishod7pool/stratis-1 /ishod-7/stratis-1
mount /dev/stratis/ishod7pool/stratis-2 /ishod-7/stratis-2
fstab

dodati:

/dev/stratis/ishod7pool/stratis-1 /ishod-7/stratis-1 xfs defaults 0 0

/dev/stratis/ishod7pool/stratis-2 /ishod-7/stratis-2 xfs defaults 0 0

Test:

mount -a
9️⃣ Na SERVERB montirati NFS dijeljenja
mount točke
mkdir -p /mnt/lv-1
mkdir -p /mnt/lv-2
mount
mount servera:/ishod-7/lv-1 /mnt/lv-1
mount servera:/ishod-7/lv-2 /mnt/lv-2
test prava
read-only test
touch /mnt/lv-1/test.txt

Treba dati:

Permission denied

read-write test
touch /mnt/lv-2/test.txt

Treba uspjeti.

📸 Screenshot: rezultat.
✔ konačna struktura
SERVERA

PV → /dev/sdb /dev/sdc

VG → ishod7VG

LV → lv-1 (1GB)

LV → lv-2 (2GB)

NFS:

/ishod-7/lv-1 (ro)

/ishod-7/lv-2 (rw)

SERVERB

Stratis:

pool → ishod7pool

FS → stratis-1

FS → stratis-2

⚠️ GREŠKA 1 — zaboravljen exportfs kod NFS-a

Student napravi:

vi /etc/exports

doda:

/ishod-7/lv-1 *(ro)

/ishod-7/lv-2 *(rw)

i odmah pokuša mount.

Ali NFS server još ne zna za promjenu.

rješenje

Uvijek pokrenuti:

exportfs -rav

objašnjenje:

provjera
exportfs -v

primjer:

/ishod-7/lv-1 *(ro)

/ishod-7/lv-2 *(rw)

Ako to nije vidljivo, mount neće raditi.

⚠️ GREŠKA 2 — firewall blokira NFS

Student napravi sve kako treba, ali mount daje:

mount.nfs: access denied by server

ili

connection timed out

razlog:

NFS portovi nisu otvoreni.

rješenje

Na SERVERA:

firewall-cmd --add-service=nfs --permanent
firewall-cmd --reload

provjera:

firewall-cmd --list-services

mora sadržavati:

nfs

⚠️ BONUS GREŠKA (LVM)

Student napravi LV ali zaboravi filesystem.

Primjer pogrešnog postupka:

lvcreate -L 1G -n lv-1 ishod7VG
mount /dev/ishod7VG/lv-1 /ishod-7/lv-1

dobije:

wrong fs type

rješenje

uvijek:

mkfs.ext4 /dev/ishod7VG/lv-1

tek onda:

mount /dev/ishod7VG/lv-1 /ishod-7/lv-1
⚠️ BONUS GREŠKA (Stratis)

Student zaboravi pokrenuti daemon.

Ako napravi:

stratis pool create ishod7pool /dev/sdb

dobije:

stratisd is not running

rješenje
systemctl enable --now stratisd
🧠 super kratki ispitni checklist

Ako nešto ne radi:

LVM

pvs

vgs

lvs

mount
mount

df -h

NFS
exportfs -v
showmount -e servera
firewall
firewall-cmd --list-services
Stratis
stratis pool list
stratis filesystem list
🎯 Jedan vrlo koristan trik za RHCSA ispit

Ako mount ne radi, odmah probaj:

showmount -e servera

Ako vidiš:

/ishod-7/lv-1 *

/ishod-7/lv-2 *

NFS radi.

Ako ništa ne vidiš, problem je:

/etc/exports

exportfs

firewall

RHCSA Exam Notes – LAB 08 (NFS)

Source: Lab 08 – NFS

Based on RH134 Chapter 9 – Access Network-Attached Storage.

PART 1 – Configure NFS Server (SERVERA)
Install and enable NFS services

Lab Task: Prepare server to share directories

Script Reference: RH134 Chapter 9 – NFS server setup

dnf install nfs-utils
systemctl enable --now nfs-server

Explanation:

nfs-utils provides the NFS server and client tools.

📸 TAKE SCREENSHOT HERE:
systemctl status nfs-server
Create export directories

Lab Task: Directories that will be shared via NFS

Script Reference: RH134 Chapter 9

mkdir -p /data/nfs/share1
mkdir -p /data/nfs/share2
mkdir -p /data/nfs/share3
mkdir -p /data/nfs/share4

Explanation:

These directories will be exported to NFS clients.

📸 TAKE SCREENSHOT HERE:
ls -l /data/nfs
Configure NFS exports

Lab Task: Define sharing rules in /etc/exports

Script Reference: RH134 Chapter 9 – exports configuration

vi /etc/exports
/data/nfs/share1 172.25.250.0/24(rw,sync)
/data/nfs/share2 SERVERB_IP(rw,sync)
/data/nfs/share3 WORKSTATION_IP(rw,sync)
/data/nfs/share4 *(ro,sync)

Explanation:

share1: available to entire subnet.

share2: only SERVERB.

share3: only WORKSTATION.

share4: read-only for everyone.

exportfs -rav
📸 TAKE SCREENSHOT HERE:
exportfs -v showing exports
PART 2 – Configure NFS Client (SERVERB)
Install NFS client utilities

Lab Task: Required to mount NFS shares

Script Reference: RH134 Chapter 9 – NFS client

dnf install nfs-utils
Create mount points

Lab Task: Directories where NFS shares will be mounted

Script Reference: RH134 Chapter 9

mkdir -p /mnt/share1
mkdir -p /mnt/share2
mkdir -p /mnt/share4
📸 TAKE SCREENSHOT HERE:
ls -l /mnt
Configure persistent mounts

Lab Task: Add NFS mounts to /etc/fstab

Script Reference: RH134 Chapter 9 – persistent NFS mounts

vi /etc/fstab
SERVERA_IP:/data/nfs/share1 /mnt/share1 nfs defaults 0 0
SERVERA_IP:/data/nfs/share2 /mnt/share2 nfs defaults 0 0
SERVERA_IP:/data/nfs/share4 /mnt/share4 nfs defaults 0 0
mount -a
📸 TAKE SCREENSHOT HERE:

df -h showing mounted NFS shares

Test read-write shares

Lab Task: Create test files on share1 and share2

Script Reference: Lab instruction

touch /mnt/share1/test.txt
touch /mnt/share2/test.txt
📸 TAKE SCREENSHOT HERE:
ls /mnt/share1 /mnt/share2
Test read-only share

Lab Task: Attempt writing to share4 (should fail)

Script Reference: Lab instruction

touch /mnt/share4/test.txt

Explanation:

Command should fail because share4 is read-only.

📸 TAKE SCREENSHOT HERE:

error message from touch command

PART 3 – Configure AutoFS (WORKSTATION)
Install AutoFS

Lab Task: Automatic mounting of NFS shares

Script Reference: RH134 Chapter 9 – automount

dnf install autofs
systemctl enable --now autofs
📸 TAKE SCREENSHOT HERE:
systemctl status autofs
Create automount directory

Lab Task: Base path for automounted shares

Script Reference: RH134 Chapter 9

mkdir -p /shared-files
Configure AutoFS master map

Lab Task: Edit /etc/auto.master

Script Reference: RH134 Chapter 9

vi /etc/auto.master
/shared-files /etc/auto.nfs
Configure AutoFS map file

Lab Task: Define NFS automount entries

Script Reference: RH134 Chapter 9

vi /etc/auto.nfs
share1 SERVERA_IP:/data/nfs/share1
share3 SERVERA_IP:/data/nfs/share3
share4 SERVERA_IP:/data/nfs/share4
systemctl restart autofs

Explanation:

Directories will mount automatically when accessed.

📸 TAKE SCREENSHOT HERE:
systemctl status autofs
Test AutoFS mounts

Lab Task: Access directories to trigger automount

Script Reference: Lab instruction

ls /shared-files/share1
ls /shared-files/share3
ls /shared-files/share4
📸 TAKE SCREENSHOT HERE:
mount | grep nfs showing automounted shares
RHCSA Exam Notes – LAB 09 (Databases)

Source: Lab 09 – Databases

Based strictly on lab instructions and recommended links.

PART 1 – Initial Preparation (SERVERA and SERVERB)
Disable firewall (lab instruction)

Lab Task: Stop firewalld because firewall configuration is not part of this lab

Source / Reference: Lab 09 introduction

systemctl stop firewalld

Explanation:

MySQL uses TCP port 3306 and PostgreSQL uses TCP port 5432, but firewall configuration is intentionally skipped in this lab.

📸 TAKE SCREENSHOT HERE:
systemctl status firewalld
PART 2 – Configure MySQL / MariaDB (SERVERA)
Install database server

Lab Task: Install MySQL-compatible database server (MariaDB in RHEL)

Source / Reference: Lab instructions + recommended material

dnf install mariadb-server
systemctl enable --now mariadb

Explanation:

RHEL uses MariaDB as a drop-in replacement for MySQL. The mariadb service provides the MySQL-compatible server.

📸 TAKE SCREENSHOT HERE:
systemctl status mariadb
Create database db1

Lab Task: Database required by the lab

Source / Reference: Lab task description

mysql
CREATE DATABASE db1;
USE db1;

Explanation:

Enter the MariaDB interactive shell and create database db1.

Create table students

Lab Task: Table must contain id, fname, lname and grade

Source / Reference: Lab specification

CREATE TABLE students (
 id INT,
 fname VARCHAR(50),
 lname VARCHAR(50),
 grade INT
);

Explanation:

Create the table structure exactly as specified in the lab.

Insert sample records

Lab Task: Create 3 arbitrary entries

Source / Reference: Lab instruction

INSERT INTO students VALUES (1,'Ana','Horvat',5);
INSERT INTO students VALUES (2,'Marko','Ivic',4);
INSERT INTO students VALUES (3,'Petra','Kovac',5);
SELECT * FROM students;
📸 TAKE SCREENSHOT HERE:

SELECT * FROM students output

Backup database

Lab Task: Create SQL dump with date in filename

Source / Reference: Lab task requirement

mysqldump db1 > db1-students-backup-$(date +%F).sql

Explanation:

mysqldump creates a logical backup of the database. $(date +%F) inserts the current date automatically (YYYY-MM-DD).

📸 TAKE SCREENSHOT HERE:
ls showing backup file
EXAMPLE – MYSQL

Na SERVERA, podesite MySQL server koji ce se pokretati prilikom svakog boota operacijskog sustava.

Na SERVERA, kreirajte MySQL bazu imena „ishod8DB“.

Na SERVERA, korisniku ishod8User dodajte sva prava na bazi ishod8DB

Na SERVERA, korisniku ishod8DrugiUser dodajte sva prava na tablici ishod8Table unutar baze ishod8DB

Riješit ćemo zadatak točno kako se radi u RH labovima koristeći MariaDB (MySQL kompatibilan), jer je to standardni MySQL server na RHEL/CentOS.

Podijelit ćemo po koracima.

10️⃣ Instalirati MySQL server na SERVERA

Na SERVERA:

instalacija
dnf install mariadb-server
omogućiti pokretanje pri bootu
systemctl enable --now mariadb

Provjera:

systemctl status mariadb
📸 Screenshot: status servisa
11️⃣ Kreirati bazu ishod8DB

Ući u MySQL:

mysql

Napraviti bazu:

CREATE DATABASE ishod8DB;

Provjera:

SHOW DATABASES;

Treba se pojaviti:

ishod8DB

📸 Screenshot: SHOW DATABASES
12️⃣ Korisniku ishod8User dodati sva prava na bazi
kreirati korisnika

CREATE USER 'ishod8User'@'localhost' IDENTIFIED BY 'password';

dati prava

GRANT ALL PRIVILEGES ON ishod8DB.* TO 'ishod8User'@'localhost';

primijeniti promjene

FLUSH PRIVILEGES;

Provjera:

SHOW GRANTS FOR 'ishod8User'@'localhost';

📸 Screenshot: rezultat
13️⃣ Korisniku ishod8DrugiUser prava samo na tablicu

Prvo treba postojati tablica.

ući u bazu

USE ishod8DB;

kreirati tablicu

CREATE TABLE ishod8Table (

id INT PRIMARY KEY,

tekst VARCHAR(50)

);

kreirati korisnika

CREATE USER 'ishod8DrugiUser'@'localhost' IDENTIFIED BY 'password';

dati prava samo na tablicu

GRANT ALL PRIVILEGES ON ishod8DB.ishod8Table

TO 'ishod8DrugiUser'@'localhost';

primijeniti

FLUSH PRIVILEGES;

provjera

SHOW GRANTS FOR 'ishod8DrugiUser'@'localhost';

📸 Screenshot: rezultat
✔ Konačno stanje
baza

ishod8DB

korisnici
✔ Brzi pregled (ispitna verzija)
dnf install mariadb-server
systemctl enable --now mariadb
mysql

CREATE DATABASE ishod8DB;

CREATE USER 'ishod8User'@'localhost' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON ishod8DB.* TO 'ishod8User'@'localhost';

CREATE USER 'ishod8DrugiUser'@'localhost' IDENTIFIED BY 'password';

USE ishod8DB;

CREATE TABLE ishod8Table (id INT);

GRANT ALL PRIVILEGES ON ishod8DB.ishod8Table

TO 'ishod8DrugiUser'@'localhost';

FLUSH PRIVILEGES;

PART 3 – Install phpMyAdmin (SERVERA)
Install web server and phpMyAdmin

Lab Task: phpMyAdmin requires a web server

Source / Reference: Recommended materials in lab document

dnf install httpd php php-mysqlnd php-json php-mbstring
systemctl enable --now httpd
dnf install phpMyAdmin

Explanation:

phpMyAdmin is a web interface for managing MySQL/MariaDB databases.

Configure access URL

Lab Task: phpmyadmin.rhcsa.local/phpmyadmin

Source / Reference: Lab task requirement

mkdir -p /etc/httpd/conf.d
vi /etc/httpd/conf.d/phpmyadmin.conf
<VirtualHost *:80>
 ServerName phpmyadmin.rhcsa.local
 DocumentRoot /usr/share/phpMyAdmin
</VirtualHost>
systemctl restart httpd
📸 TAKE SCREENSHOT HERE:
systemctl status httpd

Explanation:

After configuration, phpMyAdmin should be reachable from the workstation browser using http://phpmyadmin.rhcsa.local/phpmyadmin

PART 4 – Configure PostgreSQL (SERVERB)
Install PostgreSQL

Lab Task: Install database server

Source / Reference: Recommended documentation

dnf install postgresql-server
postgresql-setup --initdb
systemctl enable --now postgresql

Explanation:

postgresql-setup initializes the database directory before first start.

📸 TAKE SCREENSHOT HERE:
systemctl status postgresql
Create database db2

Lab Task: Required by lab

Source / Reference: Lab instructions

sudo -i -u postgres
createdb db2
psql db2
Create table cities

Lab Task: Columns: id, name, postcode

Source / Reference: Lab specification

CREATE TABLE cities (
 id INT,
 name VARCHAR(50),
 postcode VARCHAR(20)
);
Insert sample data

Lab Task: Create 3 rows

Source / Reference: Lab requirement

INSERT INTO cities VALUES (1,'Zagreb','10000');
INSERT INTO cities VALUES (2,'Split','21000');
INSERT INTO cities VALUES (3,'Rijeka','51000');
SELECT * FROM cities;
📸 TAKE SCREENSHOT HERE:

SELECT * FROM cities output

Backup PostgreSQL database

Lab Task: Create SQL dump file

Source / Reference: Lab instruction

pg_dump db2 > db2-cities-backup-$(date +%F).sql

Explanation:

pg_dump exports PostgreSQL database structure and data into SQL file.

📸 TAKE SCREENSHOT HERE:
ls showing db2 backup file
LAB 09 ADDITION – Name Resolution Configuration

To access phpMyAdmin using the required URL http://phpmyadmin.rhcsa.local/phpmyadmin, the hostname must resolve correctly. In the lab environment this is typically done using the /etc/hosts file.

NAME RESOLUTION CONFIGURATION (/etc/hosts)

Configure static hostname resolution on SERVERA, SERVERB and WORKSTATION if DNS records are not already provided.

vi /etc/hosts
SERVERA_IP   servera.rhcsa.local servera
SERVERB_IP   serverb.rhcsa.local serverb
SERVERA_IP   phpmyadmin.rhcsa.local

Replace SERVERA_IP and SERVERB_IP with the correct addresses used in your lab environment. This allows the browser on WORKSTATION to resolve phpmyadmin.rhcsa.local.

📸 TAKE SCREENSHOT HERE:
cat /etc/hosts
VERIFY NAME RESOLUTION
ping phpmyadmin.rhcsa.local

If the hostname resolves correctly, it should return the IP address of SERVERA.

📸 TAKE SCREENSHOT HERE:

ping phpmyadmin.rhcsa.local

LAB 09 – phpMyAdmin Apache Troubleshooting (Add-on)

This section is an add-on to Lab 09. Use it only if your phpMyAdmin URL returns an error (e.g., 403 Forbidden or 404 Not Found).

COMMON ERROR: 403 Forbidden

Cause: Apache is serving the DocumentRoot, but access is blocked by Apache 2.4 authorization rules (Require directives).

FIX OPTION 1 – Add <Directory> with 'Require all granted' (Recommended)
vi /etc/httpd/conf.d/phpmyadmin.conf

Use this safe configuration (keeps the lab URL /phpmyadmin working):

<VirtualHost *:80>
 ServerName phpmyadmin.rhcsa.local

 Alias /phpmyadmin /usr/share/phpMyAdmin

 <Directory /usr/share/phpMyAdmin>
     Require all granted
 </Directory>
</VirtualHost>

Explanation:

- Alias ensures the URL /phpmyadmin maps to /usr/share/phpMyAdmin

- <Directory> + Require all granted explicitly allows access

systemctl restart httpd
📸 TAKE SCREENSHOT HERE:
apachectl configtest (must say: Syntax OK)
curl -I http://phpmyadmin.rhcsa.local/phpmyadmin
COMMON ERROR: 404 Not Found

Cause: The VirtualHost exists but /phpmyadmin is not mapped (missing Alias), or DocumentRoot does not contain /phpmyadmin path.

FIX OPTION 2 – Ensure Alias is present
grep -n "Alias /phpmyadmin" -n /etc/httpd/conf.d/phpmyadmin.conf

If missing, add:

Alias /phpmyadmin /usr/share/phpMyAdmin
VERIFY SERVICE AND LOGS
systemctl status httpd
journalctl -u httpd -n 50

If you still get errors, check Apache logs for the exact reason.

📸 TAKE SCREENSHOT HERE:
systemctl status httpd
journalctl -u httpd -n 20
EXAMPLE – APACHE (FIREWALLD DISABLED)

Na servera instalirajte apache web poslužitelj i podesite pokretanje apache servisa pri svakom pokretanju servera.

22. Na serverb instalirajte nginx web poslužitelj i podesite pokretanje nginx servisa pri svakom pokretanju servera.

Mikrokvalifikacija – program stručnog usavršavanja Sveučilište Algebra

3/3

Na servera podesite 2 odvojena virtualna hosta. Jedan koji će posluživati web stranicu dostupnu preko imena “web.apache.local”, drugu koja će biti dostupna preko imena “www.apache.local”. Otvaranjem svake od web stranica treba se prikazati sadržaj koji odgovara imenu web stranice. (Primjerice, otvaranjem “web.apache.local” web stranice prikazuje se tekst “web.apache.local”)

Na serverb podesite 2 odvojena server bloka. Jedan koji će posluživati web stranicu dostupnu preko imena “web.nginx.local”, drugu koja će biti dostupna preko imena “www.nginx.local”. Otvaranjem svake od web stranica treba se prikazati sadržaj koji odgovara imenu web stranice. (Primjerice, otvaranjem “web.nginx.local” web stranice prikazuje se tekst “web.nginx.local”).

Sa workstation mašine dokažite funkcionalnosti za sve web stranice konfigurirane u prethodnim zadacima.

Riješit ćemo zadatak u RHCSA / lab stilu (dnf, systemctl, httpd, nginx).

Podijelit ću po točkama 21–25.

21️⃣ Instalirati Apache na servera

Na servera:

instalacija
dnf install httpd
omogućiti pokretanje pri bootu
systemctl enable --now httpd

Provjera:

systemctl status httpd
📸 Screenshot: status servisa.
22️⃣ Instalirati nginx na serverb

Na serverb:

instalacija
dnf install nginx
omogućiti pokretanje
systemctl enable --now nginx

Provjera:

systemctl status nginx
📸 Screenshot: status servisa.
23️⃣ Apache virtual hostovi na servera

Treba napraviti:

web.apache.local

www.apache.local

1. direktoriji stranica
mkdir -p /var/www/web.apache.local
mkdir -p /var/www/www.apache.local
2. sadržaj stranica

echo "web.apache.local" > /var/www/web.apache.local/index.html

echo "www.apache.local" > /var/www/www.apache.local/index.html

3. permisije
chown -R apache:apache /var/www/web.apache.local
chown -R apache:apache /var/www/www.apache.local
4. Apache konfiguracija

Napraviti datoteku:

vi /etc/httpd/conf.d/apache-vhosts.conf
konfiguracija

<VirtualHost *:80>

ServerName web.apache.local

DocumentRoot /var/www/web.apache.local

<Directory /var/www/web.apache.local>

Require all granted

</Directory>

</VirtualHost>

<VirtualHost *:80>

ServerName www.apache.local

DocumentRoot /var/www/www.apache.local

<Directory /var/www/www.apache.local>

Require all granted

</Directory>

</VirtualHost>

5. restart apache
systemctl restart httpd

Provjera konfiguracije:

apachectl configtest
24️⃣ nginx server blokovi na serverb

Treba napraviti:

web.nginx.local

www.nginx.local

1. direktoriji
mkdir -p /usr/share/nginx/web.nginx.local
mkdir -p /usr/share/nginx/www.nginx.local
2. sadržaj

echo "web.nginx.local" > /usr/share/nginx/web.nginx.local/index.html

echo "www.nginx.local" > /usr/share/nginx/www.nginx.local/index.html

3. konfiguracija server blokova

Napraviti:

vi /etc/nginx/conf.d/nginx-vhosts.conf
konfiguracija

server {

listen 80;

server_name web.nginx.local;

root /usr/share/nginx/web.nginx.local;

}

server {

listen 80;

server_name www.nginx.local;

root /usr/share/nginx/www.nginx.local;

}

4. restart nginx
systemctl restart nginx

Provjera:

nginx -t
25️⃣ Test sa workstation

Workstation mora znati hostname.

Otvoriti:

vi /etc/hosts

Dodati:

IP_SERVERA web.apache.local www.apache.local

IP_SERVERB web.nginx.local www.nginx.local

Primjer:

192.168.1.10 web.apache.local www.apache.local

192.168.1.20 web.nginx.local www.nginx.local

test

Sa workstation:

curl web.apache.local

curl www.apache.local

curl web.nginx.local

curl www.nginx.local

Treba dobiti:

web.apache.local

www.apache.local

web.nginx.local

www.nginx.local

📸 Screenshot za dokaz

curl web.apache.local

curl www.apache.local

curl web.nginx.local

curl www.nginx.local

✔ konačni rezultat

svaka prikazuje svoje ime.

⚠️ dvije stvari koje često pokvare zadatak
firewall

ako ne radi web:

firewall-cmd --add-service=http --permanent
firewall-cmd --reload
LAB 10 – Databases and Applications

Source: Lab 10 – DBs and Applications. Configuration based strictly on lab instructions and referenced materials.

INITIAL LAB ENVIRONMENT PREPARATION
systemctl stop firewalld
setenforce 0

Firewall disabled and SELinux set to Permissive mode as required by the lab.

📸 TAKE SCREENSHOT HERE:
systemctl status firewalld
getenforce
MYSQL CONFIGURATION – SERVERA
dnf install mariadb-server
systemctl enable --now mariadb
mysql
CREATE DATABASE wordpress;
CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'wordpress';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost';
FLUSH PRIVILEGES;

Create Wordpress database and user with full permissions.

📸 TAKE SCREENSHOT HERE:
mysql -e "SHOW DATABASES;"
MYSQL ROOT PASSWORD CONFIGURATION – SERVERB
dnf install mariadb-server
systemctl enable --now mariadb
mysqladmin -u root password 'password'

Set MySQL root password to 'password' as required.

📸 TAKE SCREENSHOT HERE:
mysql -u root -p
WORDPRESS INSTALLATION – SERVERA
dnf install httpd php php-mysqlnd php-curl php-dom php-exif php-fileinfo php-hash php-igbinary php-imagick php-intl php-mbstring php-openssl php-pcre php-xml php-zip php-mysqli
systemctl enable --now httpd
cd /var/www/html
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
mv wordpress/* .
chown -R apache:apache /var/www/html

Download Wordpress into Apache web root and set correct permissions.

📸 TAKE SCREENSHOT HERE:
ls /var/www/html
NAME RESOLUTION CONFIGURATION FOR WORDPRESS
vi /etc/hosts
SERVERA_IP wordpress.rhcsa.local

Allows access to Wordpress using hostname wordpress.rhcsa.local.

📸 TAKE SCREENSHOT HERE:

ping wordpress.rhcsa.local

MEDIAWIKI INSTALLATION
dnf install httpd php php-mysqlnd php-intl php-gd php-xml mariadb-server
cd /var/www/html
wget https://releases.wikimedia.org/mediawiki/1.39/mediawiki-1.39.0.tar.gz
tar -xzf mediawiki-1.39.0.tar.gz
mv mediawiki-1.39.0 mediawiki
chown -R apache:apache /var/www/html/mediawiki

Install MediaWiki under Apache web root.

📸 TAKE SCREENSHOT HERE:
ls /var/www/html/mediawiki
TODO APPLICATION DEPLOYMENT – SERVERB
git clone https://github.com/azjishlay/todo-app.git

Clone Todo application referenced in lab.

📸 TAKE SCREENSHOT HERE:
ls todo-app
APPLICATION BACKUP PROCEDURE
mysqldump wordpress > wordpress-database-$(date +%F).sql
tar -czf wordpress-app-$(date +%F).tar.gz /var/www/html
tar -czf wordpress-backup.tar.gz wordpress-database-$(date +%F).sql wordpress-app-$(date +%F).tar.gz

Create database backup, application backup, then combine them into a final archive.

📸 TAKE SCREENSHOT HERE:
ls *.tar.gz
LAB 11 – SELinux and Firewall

Source: Lab 11 – SELinux and Firewall. Configuration based on RH124 Chapter 8 and RH134 Chapters 1,5,6,11 plus referenced materials.

INITIAL SECURITY ENVIRONMENT CONFIGURATION
systemctl enable --now firewalld
setenforce 1

Enable firewalld and switch SELinux to Enforcing mode as required by the lab.

📸 TAKE SCREENSHOT HERE:
systemctl status firewalld
getenforce
WEB SERVER CONFIGURATION – SERVERA
dnf install httpd
systemctl enable --now httpd
echo 'IT WORKS!!!' > /var/www/html/index.html

Install Apache and create simple test page.

📸 TAKE SCREENSHOT HERE:

curl http://servera

FIREWALL CONFIGURATION – ALLOW ONLY SSH AND HTTP
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=ssh
firewall-cmd --permanent --remove-service=dhcpv6-client
firewall-cmd --reload

Configure firewall so only HTTP and SSH traffic is allowed.

📸 TAKE SCREENSHOT HERE:
firewall-cmd --list-all
ENABLE FIREWALL LOGGING
firewall-cmd --set-log-denied=all

Enable logging of denied packets.

📸 TAKE SCREENSHOT HERE:
firewall-cmd --get-log-denied
FIREWALL TEST
curl http://servera:8080
journalctl -xe | grep -i firewalld

Access blocked port 8080 to confirm firewall denial and logging.

📸 TAKE SCREENSHOT HERE:
journalctl -xe | grep firewalld
SAVE FIREWALL CONFIGURATION
firewall-cmd --runtime-to-permanent

Ensure firewall configuration persists across reboots.

NEW WEBSITE CONFIGURATION (/app/website)
mkdir -p /app/website
echo 'NOT EVEN SELINUX CAN STOP ME!!!' > /app/website/index.html
chown -R apache:apache /app/website

Create new website content directory.

📸 TAKE SCREENSHOT HERE:
ls /app/website
SELINUX CONTEXT CONFIGURATION
semanage fcontext -a -t httpd_sys_content_t '/app/website(/.*)?'
restorecon -Rv /app/website

Allow Apache to read the custom directory using correct SELinux context.

📸 TAKE SCREENSHOT HERE:
ls -Z /app/website
APACHE VIRTUAL HOST – CUSTOM WEBSITE
vi /etc/httpd/conf.d/website.conf
<VirtualHost *:80>
DocumentRoot /app/website
</VirtualHost>
systemctl restart httpd

Configure Apache to serve the custom website directory.

📸 TAKE SCREENSHOT HERE:

curl http://servera

SELINUX DEMONSTRATION WEBSITE
mkdir -p /app/selinux
echo 'SELinux works!' > /app/selinux/index.html
chown -R apache:apache /app/selinux
semanage fcontext -a -t httpd_sys_content_t '/app/selinux(/.*)?'
restorecon -Rv /app/selinux

Create second site to demonstrate SELinux context configuration.

📸 TAKE SCREENSHOT HERE:
ls -Z /app/selinux
APACHE VIRTUAL HOST – SELINUX SITE (PORT 95)
vi /etc/httpd/conf.d/selinux.conf
<VirtualHost *:95>
ServerName selinux.mylab.local
DocumentRoot /app/selinux
</VirtualHost>
semanage port -a -t http_port_t -p tcp 95
firewall-cmd --permanent --add-port=95/tcp
firewall-cmd --reload
systemctl restart httpd

Allow Apache to bind to port 95 and open firewall for the port.

📸 TAKE SCREENSHOT HERE:

ss -tulpn | grep 95

APACHE ACCESS CONTROL – BEST PRACTICE NOTE

When configuring Apache VirtualHost files that serve content from directories outside the default /var/www directory (for example /app/website or /app/selinux), Apache may deny access unless explicit permission is granted. This often causes the error: 403 Forbidden.

RECOMMENDED VIRTUALHOST STRUCTURE
<VirtualHost *:80>
    ServerName example.local
    DocumentRoot /app/website

    <Directory /app/website>
        Require all granted
    </Directory>
</VirtualHost>

The <Directory> block explicitly allows Apache to serve files from the specified directory. Using this structure prevents common access issues during labs and exams.

SELINUX + APACHE + FIREWALL CHECKLIST

For a website to work correctly in RHEL environments, three layers must allow access:

1. Apache configuration (<Directory> Require all granted)
2. SELinux context (httpd_sys_content_t using semanage + restorecon)
3. Firewall rules (firewall-cmd allowing the port/service)
USEFUL VALIDATION COMMANDS
apachectl configtest
systemctl restart httpd
ls -Z /path/to/webroot
journalctl -xe | grep httpd

These commands help quickly identify whether Apache configuration, SELinux policy, or firewall rules are blocking access to the website.

EXAMPLE – SELINUX
Na SERVERB, postavite SELinux u Enforcing mode. Za vrijeme rjesavanja zadataka iz ovog ishoda potrebno je dokazati da je SELinux bio u Enforcing modeu.
15. Na SERVERB, podesite da se web stranica posluzuje koristeci Apache web server iz direktorija /webapp na portu 85.
16. Napravite sve sto je potrebno kako bi web server radio sa ukljucenim firewall – om.
17. Procesu web servera podesite prioritet na 12.
18. Podesite maksimalan broj datoteka koje korisnik „student“ moze otvoriti na 10000.
19. Podesite zadanu vrijednost prioriteta za sve procese pokrenute kao korisnik „student“ na 3.

Riješit ćemo zadatak po redoslijedu 14–19, koristeći komande koje se nalaze u RH124/RH134 skriptama (SELinux, firewall, process management, limits).

14️⃣ Postaviti SELinux u Enforcing mode (SERVERB)

Provjera trenutnog stanja:

getenforce

Ako nije Enforcing, postavi:

setenforce 1

Za trajno postavljanje:

vi /etc/selinux/config

promijeniti:

SELINUX=enforcing

Provjera:

getenforce

Treba pisati:

Enforcing

📸 Screenshot: getenforce
15️⃣ Apache web server iz direktorija /webapp na portu 85
instalacija apache
dnf install httpd
direktorij za web stranicu
mkdir /webapp

echo "WEBAPP SERVERB" > /webapp/index.html

permisije
chown -R apache:apache /webapp
SELinux kontekst

Apache smije čitati samo određene direktorije.

semanage fcontext -a -t httpd_sys_content_t "/webapp(/.*)?"
restorecon -Rv /webapp

Provjera:

ls -Z /webapp
Apache konfiguracija

Napraviti konfiguraciju:

vi /etc/httpd/conf.d/webapp.conf

sadržaj:

Listen 85

<VirtualHost *:85>

DocumentRoot /webapp

<Directory /webapp>

Require all granted

</Directory>

</VirtualHost>

pokretanje apache
systemctl enable --now httpd

Provjera:

apachectl configtest
16️⃣ omogućiti rad sa uključenim firewallom

Otvoriti port 85:

firewall-cmd --add-port=85/tcp --permanent
firewall-cmd --reload

Provjera:

firewall-cmd --list-ports
SELinux mora dopustiti port 85

Apache po defaultu koristi port 80/443.

Dodati port:

semanage port -a -t http_port_t -p tcp 85

Provjera:

semanage port -l | grep http
test

curl localhost:85

17️⃣ Podesiti prioritet web servera na 12

Pronaći PID:

pgrep httpd

Postaviti prioritet:

renice -n 12 -p PID

Primjer:

renice -n 12 -p 1234

Provjera:

ps -o pid,ni,pri,cmd -p 1234

18️⃣ Maksimalan broj datoteka za korisnika student

Koristi se limits.conf

Otvoriti:

vi /etc/security/limits.conf

Dodati:

student hard nofile 10000

student soft nofile 10000

Provjera:

su - student

ulimit -n

Treba pokazati:

10000

19️⃣ Zadani prioritet procesa za korisnika student

Također u limits.conf

Dodati:

student hard priority 3

student soft priority 3

Provjera:

ulimit -e

✔ Konačni pregled konfiguracija
SELinux

getenforce

→ Enforcing

Apache

/webapp

port 85

Firewall
firewall-cmd --list-ports

→ 85/tcp

Prioritet procesa

renice -n 12

limits.conf

student soft nofile 10000

student hard nofile 10000

student soft priority 3

student hard priority 3

LAB 12 – Process Management and Regular Expressions

Source: Lab 12 – Process management and Regular expressions. Based on RH124 Chapter 8 and RH134 Chapters 1,5,6,11 and referenced materials.

CONFIGURE WEBSERVER – SERVERA
dnf install httpd
systemctl enable --now httpd
echo 'IT WORKS!!!' > /var/www/html/index.html

Install Apache and configure simple test webpage.

📸 TAKE SCREENSHOT HERE:

curl http://servera

CHECK WEBSERVER PROCESS STATE
ps -ef | grep httpd

Check process state and identify parent process and worker processes.

📸 TAKE SCREENSHOT HERE:

ps -ef | grep httpd

CHANGE PROCESS PRIORITY – PR VALUE 8
renice -n -12 -p $(pgrep httpd | head -1)

Lower nice value increases priority. PR 8 approximately corresponds to nice -12.

📸 TAKE SCREENSHOT HERE:

ps -o pid,ni,pri,cmd -p $(pgrep httpd | head -1)

DEFAULT PRIORITY FOR STUDENT USER
vi ~/.bashrc
ulimit -e 10

Set default scheduling priority for processes started by student user.

📸 TAKE SCREENSHOT HERE:

ulimit -a

PROCESS INFORMATION QUERIES
ps -u root --sort=comm

List processes run by root in alphabetical order.

ps -u root -o comm

Show only process names.

ps -u root -o args

Show process names with parameters.

ps -u root -o args | tr '%' ' '

Replace % characters with whitespace.

ps -u root -o args

Confirm command output matches expected format.

ps -eo pid,comm,%cpu --sort=-%cpu | head

Find process using most CPU cycles.

ps -eo pid,comm,%mem --sort=-%mem | head -2

Find process with 2nd highest memory usage.

ps -eo pid,comm,etime --sort=etime | head

Find process running the longest.

📸 TAKE SCREENSHOT HERE:

ps -eo pid,comm,%cpu --sort=-%cpu | head

REGULAR EXPRESSIONS – /usr/share/dict/words
grep fish /usr/share/dict/words
grep -B2 -A1 cat /usr/share/dict/words
grep -c cat /usr/share/dict/words
grep -n cat /usr/share/dict/words
grep -E 't[aeiou].*sh$' /usr/share/dict/words
grep -E '^(abominable|abominate|anomie|atomize)$' /usr/share/dict/words
grep -Ec 't[aeiou].*sh$' /usr/share/dict/words
grep -E '^.{14}$' /usr/share/dict/words
grep -E '^bl[aeiou].*' /usr/share/dict/words
grep -E '[0-9]{2}' /usr/share/dict/words
grep -E '(^.e.*|^[0-9])' /usr/share/dict/words
grep -E '(Bank|Banking|Flunking|Walking)' /usr/share/dict/words

These commands demonstrate regex pattern matching required in the lab.

📸 TAKE SCREENSHOT HERE:
grep fish /usr/share/dict/words
FIND COMMAND – PASSWORD FILE SEARCH
find / -type f -name '*password' 2>/dev/null
find / -type f -name 'password*' 2>/dev/null
find / -type f -name 'password' 2>/dev/null
grep -r password / 2>/dev/null

Search filesystem for files with 'password' pattern or containing the word password.

📸 TAKE SCREENSHOT HERE:
find / -type f -name '*password'
LAB 12 – REGULAR EXPRESSIONS EXPLANATIONS

Detailed explanations for regex commands used in Lab 12 with /usr/share/dict/words.

1. Find rows containing 'fish'
grep fish /usr/share/dict/words

Searches for any line containing the substring 'fish'. Example matches: fish, fishing, catfish.

2. Show lines containing 'cat' plus context
grep -B2 -A1 cat /usr/share/dict/words

-B2 shows two lines BEFORE the match and -A1 shows one line AFTER the match. Useful for viewing surrounding context.

3. Count occurrences of 'cat'
grep -c cat /usr/share/dict/words

Counts how many lines in the file contain the word 'cat'.

4. Show line numbers for matches
grep -n cat /usr/share/dict/words

Displays matching lines and their line numbers. Useful to determine which line contains words like 'catalog'.

5. Words containing 't + vowel + anything + sh'
grep -E 't[aeiou].*sh$' /usr/share/dict/words

Matches words where 't' is followed by a vowel, then any characters, and ending with 'sh'.

6. Match only specific words
grep -E '^(abominable|abominate|anomie|atomize)$' /usr/share/dict/words

Matches exactly one of the listed words. '^' indicates start of line and '$' indicates end of line.

7. Count matches for regex pattern
grep -Ec 't[aeiou].*sh$' /usr/share/dict/words

Counts the number of words matching the pattern 't + vowel + anything + sh'.

8. Words exactly 14 characters long
grep -E '^.{14}$' /usr/share/dict/words

'.' means any character and '{14}' means exactly 14 occurrences. '^' and '$' ensure the entire word is exactly 14 characters.

9. Words beginning with 'bl' followed by vowel
grep -E '^bl[aeiou].*' /usr/share/dict/words

Matches words that start with 'bl', then a vowel, and any characters after that.

10. Words containing two-digit numbers
grep -E '[0-9]{2}' /usr/share/dict/words

Matches any word containing exactly two consecutive digits.

11. Words beginning with any letter followed by 'e', OR starting with a number
grep -E '(^.e.*|^[0-9])' /usr/share/dict/words

The '|' operator means OR. The command matches words where the second letter is 'e' OR words that start with a number.

12. Match specific words in one command
grep -E '(Bank|Banking|Flunking|Walking)' /usr/share/dict/words

Matches any of the listed words using the OR operator inside parentheses.