Exam Rhel 9
Exam Rhel 9
Exam Rhel 9
reboot vm then during boot press esc then point to rescue kernel then press "e"
then put the pointer to word "linux" then press "end key on keyboard" then put space then right
rd.break then press "ctrl+x"
press enter to get into maintinance shell , then write the below
#chroot /sysroot
#touch /.autorelabel
#ls -a (to verify the file created with the correct name)
#exit
#exit
after that it takes time to relabel then it will boot to normal kernal (os level) , login with root to verify.
----------------------------------------------------------------------------------------------------------------------------------
2-configure the below (consol mode)
hostname =statio.domain101.example.com
ip address=192.168.29.101
netmask=255.255.255.0
gateway=192.168.29.1
dns server=192.168.29.1
dns-search domain=domain26.example.com
#nmtui (this will run a ui interface to configure the network and hostname)
edit connection -> point on the connection name as listed above -> edit -> go to "IPv4 CONFIGURATION"
then press enter and change it to manual then go to show then press on it
enter the configuration as required then press ok then back to previous screen then point to activate ->
activate it "it will show * mark on the left side of the connection name" then go back then press on "set
system hostname"
----------------------------------------------------------------------------------------------------------------------------------
3-configure yum repositories on both system and use the following details (from now on check on ssh
service and give permission to root to ssh directly to systems)
#vi /etc/ssh/sshd_config
uncomment the line start with "PermiRootLogin" then change the paramaeter beside from "prohibit-
password" to "yes" then save using wq!
#vi /etc/yum.repos.d/local.repo
[BaseOS]
name=BaseOS
gpgcheck=0
enable=1
[AppStream]
name=AppStream
gpgcheck=0
enable=1
then save it using wq! , you can copy it all and use on the other server to save time as you will be
required to configure on it too
#dnf repolist
----------------------------------------------------------------------------------------------------------------------------------
4-check your system's default tuning profile and set it as per recommended for the system
#tuned-adm active
#tuned-adm recommend
#tuned-adm off
----------------------------------------------------------------------------------------------------------------------------------
creaate user alex belongs to sysadmin as a secondry group also create another user alice who also
belongs to sysadmin
create another user "robin" who does not have interactive shell on the system , and who is not
member of sysadmin
----------------------------------------------------------------------------------------------------------------------------------
6-create user called sarah with UID 6001 and password redhat@123
----------------------------------------------------------------------------------------------------------------------------------
7-create a directory /backup . group ownership of /backup is sysadmin . the directory
should be readable,writeable and accessible to members of sysadmin , but not to any other users ,
files
also ensure only file owners can delete their own files /backup
#mkdir /backup
----------------------------------------------------------------------------------------------------------------------------------
8-locate all files which are owned by user alex and place them into /root/found directory
#mkdire /root/found
#ls /root/found/
----------------------------------------------------------------------------------------------------------------------------------
9-create a compressed archive file called /root/usrlocal.tgz for the directory /usr/local.
#file usrlocal.tgz
----------------------------------------------------------------------------------------------------------------------------------
#file /root/etc.tar.bz2
----------------------------------------------------------------------------------------------------------------------------------
11-search all lines from /usr/share/dict/words which are having the word "command" .
copy the lines in the file named /root/command.txt without disturbing the original order display
#grep "command" /user/share/dict/words > /root/command.txt
12-classroom.example.com
is exporting as an NFS share the /rhome directory. The expected mount point for
station.domain101.example.com
is also /rhome. User natasha should have her home directory automatically mounted as
/rhome/natasha under the local system. Configure automounter service in such a way, so that when
user natasha login to the system, her local home directory automatically gets mounted to
classroom.example.com:/rhome/natasha. You can login to the system as user natasha with password
redhat@123.
#vi /etc/auto.master.d/rhome.autofs
/rhome /etc/auto.rhome
wq!
#vi /etc/auto.rhome
wq!
----------------------------------------------------------------------------------------------------------------------------------
13- your orgnization is deploying a new custom web application , the web application is running
on a nonstandard port 82/tcp , one of your junior administrator has already configured
the application on your system , you need to deploy httpd package in the local system
which must run even after reboot and ensure that the application is accessible from the
#firewall-cmd --reload
----------------------------------------------------------------------------------------------------------------------------------
14- user must configure a cron job that runs daily in between 17:00 to 18:00 localtime
#su - natasha
#crontab -e
wq!
----------------------------------------------------------------------------------------------------------------------------------
15- bash script myscript
need to search file in /usr and store under /root/filefound with below condition
1. file size should be more that 30k and less that 50k
#touch /usr/local/bin/myscript
#chmod +x /usr/local/bin/myscript
#vi /usr/local/bin/myscript
#!/bin/bash
mkdir /root/filefound
file -type f -size +30k -size -50k -perm -2000 -exec cp -p {} /root/filefound \;
wq!
----------------------------------------------------------------------------------------------------------------------------------
#vi /etc/chrony.conf
just comment out the line started with pool at the top of the file and under it write the below
wq!
#timedatectl
----------------------------------------------------------------------------------------------------------------------------------
17- create a logical volume called database under the volume group called datastore and should have
15 extents ,
logical extent size should be 32 MiB in the logical volume , format the logical
and in our situation its : (15+2) * 32 = 544 , but the exact size we want to use is 15*32 = 480
#gdisk /dev/sdb
press enter
press enter
+544
8e00
#partprobe /dev/sdb
#udevadm settle
#pvcrate /dev/sdb2
#mkfs.ext3 dev/datastore/database
#mkdire /database
#vi /etc/fstab
wq!
#mount -a
#df -h
18- you have a logical volume which is mounted with /image file system , extend /image filesystem by
1 GiB.
#df -h
----------------------------------------------------------------------------------------------------------------------------------
19-create a swap partition of 700MiB without disturbing the current swap volume , it should be
#free -h
#gdisk /dev/sdb
press enter
press enter
+700M
8200
#partprobe /dev/sdb
#udevadm settle
#mkswap /dev/sdb3
#vi /etc/fstab
wq!
#swapoff -a
#swapon -a
----------------------------------------------------------------------------------------------------------------------------------
20- container part
1. need to download the container file from a link provided and build container image
3. container will run an webserver , default document root of the container need to be
mounted with ~/webserver/html directory , the index.html file kept in the directory
4. container should got published through port 8080 of the local system
5. container will run as a service named container-webserver and controller by user named alex
#su - alex
#mkdir container-tools
#cd container-tools/
#podman images
#mkdir -p ~/webserver/html
#podman ps -a
#mkdir -p ~/.config/systemd/user
#cd ~/.config/systemd/user
#loginctl enable-linger