الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

معمل 20.1RH124, الفصل 20

RH124 review lab — set up a new server from start to end

المستوى
صعب
90 دقيقة
الأجهزة
server1, server2
الحالة
لم يبدأ

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

الهدف

A new colleague needs a ready server. Do all tasks on server1 without looking at the summaries. Use only man, --help and /usr/share/doc. Then reboot and check that everything still works.

قبل أن تبدأ

  • server1 and server2 with RHEL 10 (or CentOS Stream 10 / AlmaLinux 10) on the network 192.168.122.0/24, gateway and DNS 192.168.122.1; server2 has 192.168.122.20.
  • Work as student (member of wheel) on the console of server1. Use sudo for root tasks.
  • A repository for software must work (registered system, or the DVD as a local repository).

المهام

  1. Network: give the active profile of server1 the fixed address 192.168.122.10/24, gateway and DNS 192.168.122.1. Set the host name server1.example.com. Make server2 and server2.example.com work by name without DNS.
  2. Users: create the group devops with GID 4000. Create the users mia and leo with devops as extra group, and the user guest with no login shell. All three get the password RedHat-2026.
  3. Passwords: mia and leo must change their password every 60 days and get a warning 5 days before. guest must expire on 2026-12-31.
  4. sudo: members of devops may run systemctl and journalctl as root — nothing else.
  5. Shared folder: make /srv/devops. Members of devops may create and change files there, new files get the group devops, users can not delete files of others, other users have no access at all.
  6. Software and service: install the web server httpd. Put the text server1 works into /var/www/html/index.html. The service must run now and after every reboot. Open the firewall for http permanently.
  7. Process: as leo, start sleep 3000 in the background. As student, find the PID and stop it with SIGTERM.
  8. SSH: as student on server1, make an ed25519 key and log in to student@server2 without a password. On server1, root must not log in over SSH any more.
  9. Report: write the output of ip -br a, ss -tln and systemctl is-enabled httpd into /root/report.txt; errors must go into /root/report.err.
  10. Reboot server1 and check all tasks again.

تحقّق من عملك

hostnamectl --static
ip -br -4 a
getent hosts server2
id mia ; id leo ; getent passwd guest
sudo chage -l mia | grep -E 'Maximum|warning'
sudo chage -l guest | grep 'Account expires'
sudo -l -U mia
ls -ld /srv/devops
curl -s http://localhost/
systemctl is-active httpd ; systemctl is-enabled httpd
sudo firewall-cmd --list-services
ssh student@server2 hostname
sudo sshd -T | grep -i permitrootlogin
sudo cat /root/report.txt

تلميحات

اعرض التلميحات

الحل

اعرض الحل
  1. Network.
    nmcli con show
    sudo nmcli con mod enp1s0 ipv4.method manual ipv4.addresses 192.168.122.10/24 ipv4.gateway 192.168.122.1 ipv4.dns 192.168.122.1
    sudo nmcli con up enp1s0
    sudo hostnamectl hostname server1.example.com
    echo "192.168.122.20  server2.example.com server2" | sudo tee -a /etc/hosts
  2. Users and group.
    sudo groupadd -g 4000 devops
    sudo useradd -G devops mia
    sudo useradd -G devops leo
    sudo useradd -s /sbin/nologin guest
    for u in mia leo guest; do echo "$u:RedHat-2026" | sudo chpasswd; done
  3. Password rules.
    sudo chage -M 60 -W 5 mia
    sudo chage -M 60 -W 5 leo
    sudo chage -E 2026-12-31 guest
  4. sudo rule (check the syntax before you leave visudo).
    sudo visudo -f /etc/sudoers.d/devops
    sudo cat /etc/sudoers.d/devops
    %devops ALL=(root) /usr/bin/systemctl, /usr/bin/journalctl
    sudo visudo -c
  5. Shared folder.
    sudo mkdir /srv/devops
    sudo chgrp devops /srv/devops
    sudo chmod 3770 /srv/devops
  6. Web server.
    sudo dnf install -y httpd
    echo "server1 works" | sudo tee /var/www/html/index.html
    sudo systemctl enable --now httpd
    sudo firewall-cmd --add-service=http --permanent
    sudo firewall-cmd --reload
  7. Find and stop the process (start it as leo in a second terminal: su - leo, then sleep 3000 &).
    pgrep -u leo -a sleep
    sudo kill -TERM $(pgrep -u leo sleep)
  8. SSH key and root login.
    ssh-keygen -t ed25519
    ssh-copy-id student@server2
    ssh student@server2 hostname
    echo "PermitRootLogin no" | sudo tee /etc/ssh/sshd_config.d/50-noroot.conf
    sudo sshd -t
    sudo systemctl reload sshd
  9. The report.
    sudo bash -c '{ ip -br a; ss -tln; systemctl is-enabled httpd; } > /root/report.txt 2> /root/report.err'
  10. Reboot and run the checks above again.
    sudo systemctl reboot

ملاحظاتي

لا توجد ملاحظات بعد.

دروس هذا المعمل

الأوامر في هذا المعمل