Linux Node Configuration Documentation
Node 1
Question 1: Configure Static IP and Hostname
Show current connections:
nmcli con show
Add Ethernet connection with static IP:
nmcli con add con-name santhosh ifname eth0 type ethernet \ ipv4.addresses 172.25.250.10/24 ipv4.gateway 172.25.250.1 \ ipv4.dns 172.25.250.254 ipv4.method manual autoconnect yes
Reboot system to apply changes.
Set hostname:
hostnamectl set-hostname machine1.example.com
Question 2: Configure Repositories and Install HTTPD
Repository configuration example:
[BaseOS] name=BaseOS baseurl=http://<your_repo_url> enabled=1 gpgcheck=0 [AppStream] name=AppStream baseurl=http://<your_repo_url> enabled=1 gpgcheck=0
Clean DNF cache and install Apache HTTP server:
dnf clean all dnf install httpd
Question 3: User and Group Management, Directory Permissions, ACLs
useradd devuser id devuser groupadd devteam cat /etc/group mkdir -p /share/dev/ ls -ld /share/dev/ chown -R devuser:devteam /share/dev/ ls -ld /share/dev/ chmod g+rwx,o-rwx /share/dev/ setfacl -m u:john:r--- /share/dev/
Question 4: Add User to Group and Set Password
useradd redhat passwd redhat # enter password: redhat@123 groupadd IT-Team usermod -aG IT-Team redhat id redhat
Question 5: SSH Key Setup and Remote Login
ssh-keygen ssh-copy-id natasha@172.25.250.11 # Password: test@123 su - natasha
Question 6: Setup HTTPD on Custom Port 82, Configure Firewall & SELinux
dnf install httpd -y systemctl enable --now httpd systemctl start httpd systemctl status httpd firewall-cmd --permanent --add-port=82/tcp firewall-cmd --permanent --add-service=http firewall-cmd --reload semanage port -a -t http_port_t -p tcp 82 vim /etc/httpd/conf/httpd.conf # Add or modify line: Listen 82 # Save and exit systemctl restart httpd curl 172.25.250.10:82
Question 7: Create LVM Partition and Mount
fdisk /dev/nvme0n2 # commands: g n +700M t 8e # Linux LVM type w partprobe /dev/nvme0n2 pvcreate /dev/nvme0n2p1 vgcreate vgdata /dev/nvme0n2p1 lvcreate -L 500M -n lvdata vgdata mkfs.xfs /dev/vgdata/lvdata mkdir /mnt/data # Add to /etc/fstab: /dev/vgdata/lvdata /mnt/data xfs defaults 0 0 mount -a
Question 8: Setup Cron Job for devuser
dnf install cronie systemctl enable --now cronie crontab -e -u devuser # Add the line: */5 * * * * uptime >> /home/devuser/uptime.log
Question 9: Backup /etc Directory with tar
tar --gzip -cvf /root/etc_backup.tar.gz /etc file /root/etc_backup.tar.gz # Or using bzip2 tar --bzip2 -cvf /root/etc_backup.tar.bz2 /etc
Question 10 and 11: Add Users to Groups and Set Passwords
useradd -G IT-Team alex useradd -u 2245 john passwd john # Set password: Redhat@123
Question 12 and 13: Backup User Files
# For user tom
id tom
mkdir /root/tomfile
find / -user tom -exec cp -rp {} /root/tomfile/ \;
cd /root/tomfile
# For user jerry
id jerry
mkdir /root/jerryfiles
find / -user jerry -exec cp -rpvf {} /root/jerryfiles/ \;
cd /root/jerryfiles/
Question 14: Shared Directory with Sticky Bit
mkdir -p /shared/projects/ chown -R alex /shared/projects/ chmod a+rwx,+t /shared/projects/ su alex cd /shared/projects/ touch alexfile exit su - john cd /shared/projects/ rm alexfile # Should fail due to sticky bit
Question 15: Script to Copy Files of Certain Size
vim /bin/script.sh
#!/bin/bash
mkdir /root/d1
find /usr/local -size +3k -size -5k -exec cp -rpvf {} /root/d1 \;
chmod g+s /root/d1
chmod a+x /bin/script.sh
sh /bin/script.sh
cd /root/d1
ls
file man
Node 2
Question 16: Reset Root Password via Rescue Mode
# At boot prompt, add 'rd.break' or 'init=/bin/bash' and press Ctrl + X echo "Node2@123" | passwd --stdin root touch /.autorelabel exec /sbin/init
Question 17: Repository Configuration
(No details provided - configure as needed)
Question 18: Setup and Use Podman Container
id shophia dnf install podman container-tools -y systemctl enable --now podman systemctl start podman ssh shophia@172.25.250.15 vim Containerfile podman build -t image32 -f Containerfile podman images
Question 19: Create Rootless Podman Container
mkdir -p /opt/files /opt/processed chown -R shophia:shophia /opt/files /opt/processed ssh shophia@192.168.76.129 podman run -d --name container24 -v /opt/files:/opt/incoming:Z -v /opt/processed:/opt/outgoing:Z image32 podman ps loginctl enable-linger shophia mkdir -p /home/shophia/.config/systemd/user cd /home/shophia/.config/systemd/user podman generate systemd --name container24 --files --new systemctl --user daemon-reload systemctl --user enable container-container24.service systemctl --user start container-container24.service systemctl --user status container-container24.service # After reboot, verify status again: ssh shophia@172.25.250.15 systemctl --user status container-container24.service
Question 20: Create Swap Partition
fdisk /dev/nvme0n2 # commands: g n +400M t 82 # Linux swap w partprobe /dev/nvme0n2 mkswap /dev/nvme0n2p1 # Add to /etc/fstab: /dev/nvme0n2p1 swap swap defaults 0 0 swapon -a
Question 21: Create LVM with Specific Extents and Mount
bc 16*30 480 fdisk /dev/nvme0n3 # commands: g n +600M t 8e # Linux LVM w partprobe /dev/nvme0n3 pvcreate /dev/nvme0n3p1 vgcreate -s 16M VG1 /dev/nvme0n3p1 lvcreate -l 30 -n LV1 VG1 mkfs.ext4 /dev/VG1/LV1 mkdir /database # Add to /etc/fstab: /dev/VG1/LV1 /database ext4 defaults 0 0 mount -a systemctl daemon-reload
Question 22: Install and Use Tuned for Performance Tuning
dnf install tuned systemctl enable --now tuned tuned-adm recommend tuned-adm profile virtual-guest tuned-adm active
Tags:
Rhcsa
