Rhel 8 Mock Paper I

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Do the following questions in the node1.server5.example.

com virtual machine

At first vim will not work so use vi instead of vim and once you setup the network and repos you can
install vim using below command
Yum install vim

Instructions:
• break root password and set a password as “thuctive”

mount –o remount,rw /sysroot


chroot /sysroot
passwd
touch /.autorelabel
exit
exit

Question 1. Configure the network


1. set the IP address 172.25.X.11/24
2. set the Gateway 172.25.X.254
3. set DNS 172.25.254.254

Execute ifconfig command and find the interface name, we assume that interface name is “eth0”
When you try to ping from host machine if its not responding which means the configurations are not
correct.

# vim /etc/syscofig/network-scripts/ifcfg-eth0(don’t trust existing


lines remove everything and only below lines should be there)

DEVICE=eth0
IPADDR=172.25.x.11
GATEWAY=172.25.x.254
DNS1=172.25.254.254
ONBOOT=yes
BOOTPROTO=static
NETMASK=255.255.255.0
Reboot the server after the network settings then u must be able to connect
from host machine.

Question 2.Configure the hostname


1. set the hostname as serverx.example.com

#hostnamectl --set-hostname serverx.example.com

Reboot to apply the changes

Question 3. Create the repository


1. create the BaseOS repository available at
“http://content.example.com/rhel8.0/x86_64/dvd/BaseOS”
2. create the AppStreme repository available at
“http://content.example.com/rhel8.0/x86_64/dvd/AppStreame”
# cd /etc/yum.repos.d

# vim BaseOS.repo
[abc]
name=BaseOS
baseurl=http://content.example.com/rhel8.0/x86_64/dvd/BaseOS
gpgcheck=0
enabled=1

# vim AppStream.repo

[cdf]
name=AppStream
baseurl=http://content.example.com/rhel8.0/x86_64/dvd/AppStream
gpgcheck=0
enabled=1

yum-config-manager is not working at the exam

Question 4. Create below users, group


1. create three users “Natasha” “Harry” “Sarah”
2. create a group named “materials” and Harry and Natasha must be members of this group
3. Sarah’s login shell must be non-interactive

# useradd Harry
# useradd Natasha
# useradd -s /sbin/nologin sarah
# groupadd materials
# usermod -aG materials Harry
# usermod -aG materials Natasha

Question 5. Configure the below schedule task.


1. Run a task every 3 mins by user paula “logger “this is rhcsa exam in progress””

# su - paula
# crontab -e
*/3 * * * * logger “rhcsa exam in progress”
# crontab -l (Verify)

Question6. Create a collaborative directory.


1) Create a collaborative dir /home/groupdata
2) Owner must be root and group must be materials
3) Files create under the dir must be owned by materials group.

# mkdir /home/groupdata
# chown :materials /home/groupdata
# chmod g+s /home/groupdata

Question 6. Find the files owned by a user


1. find the files owned by ira from the system, and copy it to catalog: /root/dir
# mkdir /root/dir
# find / -type f -user ira -exec cp -ar {} /root/dir/ \;
Question 7. Find the rows that contain the word “adcd” from a file.
1. find the rows that contain “abcde” from file /etc/testfile, and write it to the file/tmp/testfile,
and the sequence is requested as the same as /etc/testfile.

# cat /etc/testfile | grep “abcde” > /tmp/testfile


Or
# grep “abcde” /etc/testfile > /tmp/testfile

Question 8. Create a user and set a userid


1. create username Alex and user-id should be 3456
2. set “alex111” password to Alex

# useradd -u 3456 alex


# passwd alex alex111 alex111 OR echo alex111|passwd -stdin alex

Question 9. Copy /etc/fstab to /var/tmp/fstab and set the below configurations


1. user must be root
2. group ust be root
3. Natasha must be able to read n write to the file
4. Harry must not have write access nor read access.
5. Others should not have any access

#cp /etc/fstab /var/tmp/fstab


#setfacl -m u:natasha:rw /var/tmp/fstab
#setfacl –m u:harry:- /var/tmp/fstab
#setfacl –m o:- /var/tmp/fstab

Question 10. Create an archive


1. Create an archive of /usr/local with the name “archive” and zip it using gzip and save it
under root like archive.tgz

# tar –zcvf archive.tgz /usr/local

Question 11. Mount remoteuser from utility.node.example.com:/ruser/remoteuser5 to your server using autofs
1. mount remoteuser8 from utility.node.example.com:/ruser/remoteuser5 to this server
/ruser/remoteuser5
2. the user should have write permission create files
3. use the remoteuser password “thuctive”

#yum install autofs

#vim /etc/auto.master.d/shares.autofs
/ruser /etc/auto.demo

#vim /etc/auto.demo
Remoteuser5 -rw utility.node.example.com:/remote/remoteuser5

Question 12. There is a website not working correctly debug the issue and bring the site working on port 82
2. the site is hosted under /var/www/html
3. files under /var/www/html must remain same (file1 file2 and file3)
4. the website is http://node1.server5.example.com when access the site prompts error

man semanage-port (in this page you can get the below command to relabel a
port)

semanage port –l | grep http


man semanage-port
semanage port -a -t http_port_t -p tcp 82

must start n enable apache

systemctl enable –now [email protected] . ( it can be httpd@)

Question 13.Configure the ntp


1. the system should be sync time from utility.node.example.com

#vim /etc/chrony.conf
Remove pool line
And add below
server utilty.node.example.com iburst
#systemctl restart chronyd

Question 14 Managing Containers

Using William account run a container from the registry image contvc-temp-img
Container should start automatically at boot and service must be managed under
William and service name must be container-logserver.service

Get registry information from instructions page

Podman login utility.node.example.com (uname and password from instructions


page)
Podman run –d –name logserver utility.node.example.com/rhcsaexam/contvc-temp-
img

You must locate under William

Mkdir ~/.config/systemd/user
Cd ~/.config/systemd/user
Podman generate systemd –-name logserver –-files –new

Podman stop logserver


Podman rm logserver

Systemctl –-user enable –-now container-logserver.service

Loginctl enable-linger

Reboot the server and test

Question15 add persistent storage to container


Create a dir under William home container_journal and map that to container
path /var/log/journal

When u run below inside container it must appear inside container_journal dir
on host machine

Logger –p user.journal “this is ex200 in progress”

You must read this question first if so before running container in previous
question do below

As user William
Mkdir ~/container_journal

Podman run –d –name logserver –v ~/container_journal


:/var/log/journal:Z utility.node.example.com/rhcsaexam/contvc-temp-img

Question 16)

There is an executable ex200 and this must print “burah condest enchor abi”,
only user Pandora can execute this

Which ex200
There is a binary under /usr/local/bin/ex200 (backup and remove this )

Create a new file

Touch /usr/local/bin/ex200
Echo “burah condest enchor abi”
Setfacl –m u:Pandora:rwx /usr/local/bin/ex200

You might also like