RHCSA Containers
RHCSA Containers
========================================================================
================================
Important_Instructions: Please read carefully.
Server-a:
`````````
#Q1. Configure network and set the static hostname.
IP ADDRESS = 172.25.X.11
NETMASK = 255.255.255.0
GATEWAY = 172.25.X.254
DNS = 172.25.254.254
Hostname = serverX.lab.example.com
Answer:
#nmcli connection
[optional]
#nmcli connection modify Wired\ connection\ 1 ipv4.addresses 172.25.0.11/24 ipv4.gateway
172.25.0.254 ipv4.dns 172.25.254.254 ipv4.dns-search lab.example.com ipv4.method manual
========================================================================
================================
#Q2. Configure YUM repos with the given link ( 2 repos: 1st is Base and 2nd is AppStream )
base_url= http://content.example.com/rhel8.0/x86_64/dvd/BaseOS
AppSterm_url= http://content.example.com/rhel8.0/x86_64/dvd/AppStream
Answer:
#yum repolist
#cd /etc/yum.repo.d
#vi RHEL.repo
[baseOS]
Name=baseOS
baseurl=http://content.example.com/rhel8.0/x86_64/dvd/BaseOS
enable=1
gpgcheck=0
[AppStream]
Name=AppSream
baseurl=http://content.example.com/rhel8.0/x86_64/dvd/AppStream
enable=1
gpgcheck=0
--save--
#yum repolist
========================================================================
================================
#Q3. Debug SELinux:
- A web server running on non standard port 82 is having issues serving content.
Debug and fix the issues.
- The web server on your system can server all the existing HTML files from
/var/www/html
( NOTE: Do not make any changes
to these files )
* Web service should automatically start at boot time.
Answer:
#vim /etc/httpd/conf/httpd.conf
#systemctl restart httpd
========================================================================
================================#
Q4. Create User accounts with supplementry group.
Answer:
#groupadd sysadmin
#passwd username
========================================================================
================================
#Q5. Configure a cron job that runs every 14:23 minutes and executes:
Answer:
- save-
#crontab -lu Natasha
========================================================================
================================
#Q6. Create a collaborative Directory.
Answer:
#mkdir /home/manager
========================================================================
================================
#Q7. Configure NTP
- Synchronize time of your system with the server classroom.example.com.
Answer:
#vi /etc/chrony.conf
#Commit active server and add below line with nap server name
--save--
#chronyc sources -v
========================================================================
================================
#Q8. Configure AutoFS
Answer:
#vim /etc/auto.master
/home/guests /etc/auto.misc
#vi /etc/auto.misc
Ldapuser10 -fstype=nfs,rw classroom.lab.example.com:/home/guests/&
========================================================================
================================
#Q9. ACL.
- Copy the file /etc/fstab to /var/tmp/ and configure the "ACL" as mention following.
- The file /var/tmp/fstab should owned by the "root".
- The file /var/tmp/fstab should belongs to the group "root".
- The file /var/tmp/fstab should not be executable by any one.
- The user "sarah" should able to read and wril
- The user "harry" can neither read nor write to the file.
- Other users (future and current) shuold be able to read /var/tmp/fstab.
Answer:
========================================================================
================================
#Q10. Create user 'bob' with 2112 uid and set the password 'trootent'
Answer:
#passwd bob
========================================================================
================================
#Q11. Locate all files owned by user "harry" and copy it under /root/harry-files
Answer:
#mkdir /root/harry-files
========================================================================
================================
#Q12. Find a string 'ich' from "/usr/share/dict/words" and put it into /root/lines file.
Answer:
========================================================================
================================
#Q13. create an archive '/root/backup.tar.bz2' of /usr/local directory and compress it with
bzip2.
Answer:
========================================================================
================================
========================================================================
================================
Server-2:
`````````
NOTE: In this Server 3 Disks will be given.
1. /dev/vda : for ROOT filesystem ( don't do anything under this Disk )
Answer
#root the Vm
#ctrl+x
#chroot /sysroot
#passwd
#touch /.autorelabel
#reboot -f
========================================================================
================================
#Q15. Configure YUM Repos
base_url= "http://content.example.com/rhel8.0/x86_64/dvd/BaseOS"
AppStrem_url= "http://content.example.com/rhel8.0/x86_64/dvd/AppStream"
Answer:
#vi RHEL.repo
[baseOS]
Name=baseOS
baseurl=http://content.example.com/rhel8.0/x86_64/dvd/BaseOS
enable=1
gpgcheck=0
[AppStream]
Name=AppStream
baseurl=http://content.example.com/rhel8.0/x86_64/dvd/AppStream
enable=1
gpgcheck=0
--save--
#yum repolist
========================================================================
================================
#Q16. Resize a logical Volume
- Resize the logical volume "mylv" so that after reboot size should be in between 200MB
to 300MB.
Answer:
#lvs
#vgs
#df -h
#lvs
========================================================================
================================
#Q17. Add additional swap partition of 512MB and mount it permanently.
[Note: already swap partition is existed with 512Mi, its lvm partation]
Answer:
#lsblk
#fdisk /dev/vdb
#n new partition
#P primary
#t type [82]
#wq!
#partprobe
#mkswap /dev/vdb1
#swapon /dev/vdb1
#vi /etc/fstab
#free -h
========================================================================
================================
#Q18. Create a Logical Volume and mount it permanently.
- Create the logical volume with the name "wshare" by using 50PE's from the volume
group "wgroup".
- Consider each PE size of volume group as "8 MB".
- Mount it on /mnt/wshare with file system vfat.
Answer:
#mkdir /mnt/wshare
#fdisk /dev/vdb
#partprobe
#lsblk
#pvcreate /dev/vdb2
#mkfs.vfat /dev/mapper/wgroup/wshare
#vi /etc/fstab
#mount -a
========================================================================
================================
#Q19. Create a new vdo volume according to following requirements:
Answer:
#mkdir /vdodata
#man vdo
#mkfs.xfs /dev/mapper/vdovol
#vim /etc/fstab
#mount -a
========================================================================
================================
#Q20. Configure System Tuning:
- Choose the recommended 'tuned' profile for your system and set it as the default.
Answer:
#tuned-adm --help
#tuned-adm active
#tuned-adm recommand
========================================================================
================================================================
Container Questions:
========================================================================
=
1. Launch a container in the background with the image in the private registry.
NOTE: registry URL , name and password is given in the instructions
NOTE: But you don’t have to launch the container from root account
Answer:
first login with the user from which you have to launch the container
# ssh student@serverb
#ssh <user>@serverb
(NOTE: DON’T LAUNCH THIS CONTAINER HERE , BUT LAUNCH THE CONTAINER IN THE
NEXT QUESTION)
# mkdir -p ~/.config/systemd/user/
# cd ~/.config/systemd/user
# loginctl enable-linger
TO CHECK:
# systemctl –user status container-inventorydb.service
# systemctl –user start container-inventorydb.service
# systemctl –user stop container-inventorydb.service
========================================================================
=
2. Mount the folder /home/student/data into the above container destination path is /var/lib/
Answer:
# mkdir /home/student/data