Documente Academic
Documente Profesional
Documente Cultură
PRINCE BAJAJ
RHCSA-EX200
Task 1 . Install CentOS-7 Virtual machine on VMWare Workstation using image file with disk
space allocation as below :
Total Disk Space – 40 GiB
“/” - 15 GiB
“/home” - 10 GiB
“/boot” - 300 MiB
RAM Memory – 4 GiB
Procedure :
-Open VMWare Workstation Software and click on “Create a New Virtual Machine”
- Click Next and Browse the OS Image file from your local storage.
-Give Virtual Machine name and then Click Next.
-Give Maximum disk space = 40 GiB and click next.
-Customise hardware settings in case you need and click finish.
Then follow the instructions for installation.
PRINCE BAJAJ
RHCSA-EX200
Task 2. Interrupt the boot process to Set the root password as “password”.
Procedure :
- Reboot the system or start the system
- Wait for GRUB menu to appear and then press e to edit
- Find the line starting with linux16 and enter the rd.break at the end.
- Press Ctrl+x to boot the system with these options.
- At this stage, root file system is mounted in read only mode to /sysroot and must be
remounted with r/w permissions
mount -o remount,rw /sysroot -To mount the root file system with r/w permissions
chroot /sysroot -Switch
Commands :
getenforce -To check the of SELinux mode
vim /etc/selinux/config - Set the SELINUX =enforcing mode
:wq
systemctl reboot -Restart the system
sestatus or getenforce -To check status of SELinux
PRINCE BAJAJ
RHCSA-EX200
Commands :
yum install -y ipa-server bind-dyndb-ldap ipa-server-dns -To install all required packages
ipa-server-install -To install FreeIPA Server
Do you want to configure integrated DNS (BIND)? [no]: yes
Server host name [ipaserver.example.com]: ipaserver.example.com
Please confirm the domain name [example.com]: example.com
Please provide a realm name [EXAMPLE.COM]: EXAMPLE.COM
Directory Manager password :*********
Password (confirm): *********
IPA admin password: ********
Password (confirm): *********
Do you want to configure DNS forwarders? [yes]:no
Do you want to search for missing the reverse zone? [yes]: no
Continue to configure the system with these values? [no]: yes (approximate 15-20 minutes
firewall-cmd --permanent --add-service={ntp,http,https,ldap,ldaps,kerberos,dns} --
permanent -To allow inbound traffic
firewall-cmd --reload -To reload the firewall
PRINCE BAJAJ
RHCSA-EX200
PRINCE BAJAJ
RHCSA-EX200
PRINCE BAJAJ
RHCSA-EX200
Commands :
hostnamectl --To display the current hostname assigned to system
hostnamectl set-hostname system.example.com --To assign new hostname to machine
PRINCE BAJAJ
RHCSA-EX200
PRINCE BAJAJ
RHCSA-EX200
PRINCE BAJAJ
RHCSA-EX200
Task 6. Schedule a script /test.sh as user “riya” which should be executed every 15 minutes
Commands :
crontab -u riya -e -As root ,to make entry as riya user
*/15 * * * * /test.sh -Add this line in crontab file
:wq -Write to file and quit
crontab -u riya -l -List all the crontab entries for riya
PRINCE BAJAJ
RHCSA-EX200
Task 7. Schedule a script /test1.sh as user “bob” which should be executed 12:15 every
Monday.
- User “bob” should be able to create entry in crontab file.
Commands :
vim /etc/cron.allow -Open cron.allow as root and allow user bob
bob -Make Entry in cron.allow file
:wq
su - bob -To switch to user bob
crontab -l -List all the crontab entries created by bob
crontab -e -open the crontab file in editing mode
15 12 * * 1 /test1.sh -Add this line in crontab file
:wq -Write to file and quit
crontab -l -List the crontab entries to verify the changes done
PRINCE BAJAJ
RHCSA-EX200
PRINCE BAJAJ
RHCSA-EX200
Configuration file :
vim /etc/chrony.conf -Open the configuration file with vim edior
server ipaserver.example.com iburst -Add this line in file to Configure system to use NTP
server
:wq
chronyc sources -To verify the NTP server
PRINCE BAJAJ
RHCSA-EX200
Task 11. Upgrade system to new kernel and this should be default kernel.
- Use the kernel Package from Downloads directory.
Commands :
rpm -qa gpg-pubkey* -Query the PUBKEY to verify if it is present on system
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 -To import PUBKEY if not present
rpm --checksig package_name -Check the PGP signature of packages before installing
rpm -Uvh package_name - To install/Update kernel package
cat /boot/grub2/grubenv - To check the saved default menu entry
grub2-set-default 0 - To change the default menu entry
systemctl reboot - Restart the system to boot with new kernel
man rpm -To check manual page for rpm
man rpmkeys -To check manual page for rpmkeys
In the exam, you might need to download kernel package from webserver. You can
download by pasting http link on Firefox Web Browser or with wget command.
PRINCE BAJAJ
RHCSA-EX200
Task 12. Modify GRUB2(Bootloader) not to boot the system with GUI Mode booting
screen(rhgb).
-Also all boot messages should be shown on the screen
-Make sure interface names(eth*) should be used.
Commands :
vim /etc/default/grub -Open the GRUB settings file in editing mode
GRUB_CMDLINE_LINUX= “vconsole.keymap=us crashkernel=auto
vconsole.font=latarcyrheb-sun16 net.ifnames=0 biosdevname=0” -Edit the variable
GRUB_CMDLINE_LINUX – Remove rhgb and quiet and add net.ifnames=0 and
boisdevname=0
grub2-mkconfig -o /boot/grub2/grub.cfg -Rebuild the grub.cfg file every time when you
make changes to /etc/default/grub file.
PRINCE BAJAJ
RHCSA-EX200
PRINCE BAJAJ
RHCSA-EX200
Task 3. Copy all lines starting with word “Sed“ or “sed” from /file.txt and copy to file
"/word/file“
Commands :
man grep - Manual page for grep
more /file.txt | grep -i ^sed > /word/file
more /word/file
Task 4. Copy all lines not containing “sEd or SeD" from file /root/rhcsa.txt to /root/results.txt
file.
Commands :
more /root/rhcsa.txt | grep -v -i "sEd" > /root/results.txt - To copy lines not containing sed
or Sed
more /root/results.txt - To verify the results
PRINCE BAJAJ
RHCSA-EX200
Task 5. Find all the files owned by user “riya” and redirect the output to /root/riya_files
Commands :
find / -user riya -type f > /root/riya_files -To copy files owned by riya
Task 6. Locate the file “dummy.txt” searching through "/" file system and save the output in
/location file.
Commands :
find / -name “dummy.txt” -type f > /location -To find file with name “dummy.txt”
cat /location -To verify the results
Task 7. Locate the files with extension “.txt” searching through "/" file system and save the
output in /text file.
Commands :
find / -name “*.txt” -type f > /text -To find file with extension “.txt”
cat /text -To verify the results
Task 8. Find all the directories owned by user “bob” and save the output to /bob_dir.
Commands :
find / -user bob -type d > /bob_dir -To copy directories owned by bob
cat /bob_dir -To verify the results
PRINCE BAJAJ
RHCSA-EX200
Task 9. Find all the directories and files owned by user with userid 1002 and save the
output to /uid1002.
Commands :
find / -uid 1002 > /uid1002 -To copy all files and directories owned by user with uid 1002
cat /uid1002 -To verify the results
Task 10. Use tar command to archive all contents of /home directory in /root/home.tar file.
- Compress the archived files using bzip2
Commands :
tar -cjvf home.tar.bz2 /home -To archive all the contents of /home directory in home.tar file
ls -l --block-size=MB -To display the output in MB to check gain after compressing the
archive
Task 11. Use tar command to extract the contents of home.tar.bz2 to / directory.
- Delete contents of /home directory before extracting the data.
Commands :
tar -xvf home.tar.bz2 -C / -To extract all the contents from home.tar.bz2 directory in /
directory
cd /home -Change to home Directory
ls -l - List the contents ,Contents should be recovered
Task 12. Use tar command to archive all contents of /etc directory in /root/etc.tar file.
- Compress the archived files using gzip
Commands :
tar -czvf etc.tar.gz /etc -To archive all the contents of /etc directory in /root/etc.tar file
PRINCE BAJAJ
RHCSA-EX200
Task 14. Create directory /test and set the user ownership to riya and Group ownership to
sys.
-Remove all the permissions for others on this directory
-Give full permissions at group level
Commands :
mkdir /test- To create directory /test
chown riya:sys /test - To change user ownership and group ownership
chmod 770 /test -To remove all permissions for others and giving full permissions at group
level
chmod g+w,o-rx /test - Alternate method to removing permissions for others and assigning
permissions as group level
ls -ld /test -To verify the permissions
man chown -To check man for chown,search for EXAMPLES
Task 15. Create symbolic link for file “/test/sys/link/file” in /root directory.
Commands :
cd /root -Change directory to /root
ln -s /test/sys/link/file - To Create sym link
PRINCE BAJAJ
RHCSA-EX200
Task 1. CPU intensive Process with name dd is running on system with NICE value of -5 and
taking more CPU attention than default.
Adjust the niceness value to 5 so that CPU pays less attention to this process.
Commands :
top - To check the NICE value and priority
renice -n 5 -p PID - To adjust nice value
NICE value can be between -20 to 19. Lesser the NICE value, more CPU resources will be
used. Higher the NICE value, Less CPU attention will be given.
-Never run process with nice value of -20 ,CPU will give highest priority and no other jobs
will be able to run.
Task 2 . Run the below command in back ground with NICE value of 10.
sleep 3600
Commands :
nice -n 10 sleep 3600 & - To start a process with pre-defined nice value
PRINCE BAJAJ
RHCSA-EX200
PRINCE BAJAJ
RHCSA-EX200
PRINCE BAJAJ
RHCSA-EX200
Task 2 . Create a user “lara” with home directory /lara/private and set password “access”
- At first login, it should prompt to change the password.
- Password should be set to expire after every one month.
Commands :
mkdir -p /lara/private -To create the home directory for user
useradd -d /lara/private lara -To create user with non-default home directory /lara/private
chown lara:lara /lara/private -To set User and Group Owner as lara on this directory
chmod 700 /lara/private – To restrict the access to lara for her home directory
passwd lara -To set the password for user lara
chage lara -To set the Maximum password age and Password change after first login
Related files :
/etc/passwd - Contains the user account information i.e. login name ,home
directory,UID,GID Shell
/etc/shadow - Contains the encrypted password information and Password aging and
account expirations info
/etc/group - Contains the group related information
Task 3. Create a group named “sys” and assign this group to user “lara” as secondary group.
- GID 555 should be used.
Commands :
groupadd -g 555 sys - To Create group sys with GID 555
usermod -aG sys lara -To assign sys group to user lara as supplementary group
Related files :
/etc/group - Contains the group related information
PRINCE BAJAJ
RHCSA-EX200
Related files :
/etc/passwd - Contains the user account information i.e. login name ,home
directory,UID,GID Shell
/etc/shadow - Contains the encrypted password information and Password aging and
account expirations info
/etc/group - Contains the group related information
Task 5. Create the directory /home and set the group and user ownership to “sys” and “lisa”
respectively.
- Give read only access to group “sys” and ‘rwx’ access to “lisa”.
Commands :
mkdir /home -To create directory /home
chown lisa:sys /home-To set lisa as user owner and sys as group owner
PRINCE BAJAJ
RHCSA-EX200
PRINCE BAJAJ
RHCSA-EX200
PRINCE BAJAJ
RHCSA-EX200
PRINCE BAJAJ
RHCSA-EX200
Task 11. Modify user harry account so that harry should be able to use root permissions with
sudo.
- Create a test user with user name TEST as harry user
Commands:
vim /etc/group - Find the group wheel and add user harry to this group
wheel:x:10:harry
:wq
su - harry -Switch to user harry
sudo useradd TEST - Add user TEST as user harry with sudo and it should be created
PRINCE BAJAJ
RHCSA-EX200
Task 1. Create a disk partition of 2 GiB size and mount this on /partition directory.
- Partition should use xfs file system.
- Mount should be persistent.
Commands :
fdisk /dev/sda -To create partition (We will create extended partition)
First input : n , Second input : e , Two times Enter(to assign remaining space for Logical
partitions) ,
Third input : n , Enter (Default First sector),Fourth input: +2G ,wq (to save and quit)
partprobe -To inform kernel about this partition
mkdir /partition -To create the mount directory
mkfs.xfs /dev/sda5 -To create xfs File System on partition
mkdir /partition -To create the mount directory
mount /dev/sda5 /partition -To mount partition on directory /partition
mount -To check the mounted File system
lsblk -To list block devices
PRINCE BAJAJ
RHCSA-EX200
Task 2. Create a disk partition of size 1 GiB and mount this for read only access on /fat
directory.
-Use vfat file system for the partition
- Mount should be persistent
Commands :
fdisk /dev/sda -To create partition (We will create logical partition)
First input : n ,Enter(Default First sector), Second input : +1G ,wq (to save and quit)
partprobe -To inform kernel about this partition
mkdir /fat -To create the mount directory
mkfs -t vfat /dev/sda6 -To create vfat File System on partition
mount /dev/sda6 /fat -To mount partition on directory /partition
mount -To check the mounted File system
lsblk -To list block devices
vim /etc/fstab
/dev/sda6 /fat vfat ro 0 0 (make entry in fstab file)
PRINCE BAJAJ
RHCSA-EX200
Task 4. Configure logical volume with name “lv_volume” which should use 200 MiB from
volume group vg_group.
-ext4 file system should be used
- Mount this on /log_vol directory and mount should be persistent.
Commands :
fdisk /dev/sda -To create partition (We will create logical partition)
First input : n ,Enter, Second input :+300M ,Third input : t,Enter( for default
Partition),Fourth input : 8e ,wq (to save and quit)
partprobe -To inform kernel about this partition
pvcreate /dev/sda8 - To create physical volume
vgcreate vg_group /dev/sda8 -To create volume group
lvcreate -n lv_volume -L 200M vg_group -To create logical volume on volume group
mkdir /log_vol - To create mount directory
mkfs -t ext4 /dev/vg_group/lv_volume -To create ext4 File System for logical volume
mount /dev/vg_group/lv_volume /log_vol -To mount logical volume on directory /vol_log
mount -To check the mounted File system
lsblk -To list block devices
vim /etc/fstab
/dev/vg_group/lv_volume /log_vol ext4 defaults 0 0 (make
entry in fstab file)
mount -a -To mount persistently through fstab file
PRINCE BAJAJ
RHCSA-EX200
Task 5. Configure logical volume with name “volume” which should use 20 PE’s from
volume group “group”.
-Size of PE should be 16 MiB and file system used must be ext4 file system.
- Mount this on /volume directory and mount should be persistent.
- Use UUID to mount this.
Commands :
fdisk /dev/sda -To create partition (We will create logical partition)
First input : n ,Enter, Second input : +400M , Third input : t, Enter( for default
Partition),Fourth input : 8e ,wq (to save and quit)
partprobe -To inform kernel about this partition
pvcreate /dev/sda9 - To create physical volume
vgcreate -s 16M group /dev/sda9 -To create volume group with PE size of 16 MiB
lvcreate -n volume -l 20 group -To create logical volume on volume group using 20 PE’s
mkdir /volume - To create mount directory
mkfs -t ext4 /dev/home/volume -To create ext4 File System for logical volume
mount /dev/home/volume /volume -To mount logical volume on directory /volume
mount -To check the mounted File system
lsblk -To list block devices
vim /etc/fstab
/dev/home/volume /volume ext4 defaults 0 0 (make entry
in fstab file)
mount -a -To mount persistently through fstab file
PRINCE BAJAJ
RHCSA-EX200
Task 6. Configure LVM with name “lvm” from volume group “vgroup” of size 1 GiB.
-Logical volume should use complete free space on volume group.
- Create ext4 file system on this volume.
Commands :
fdisk /dev/sda -To create partition (We will create logical partition)
First input : n ,Enter, Second input : +1G , Third input : t ,Enter, Fourth input : 8e ,wq (to
save and quit)
pvcreate /dev/sda11 - To create physical volume
vgcreate vgroup /dev/sda11 -To create volume group
lvcreate -n lvm -l 100%FREE vgroup -To create logical volume using all free space on
volume group
mkfs.ext4 /dev/vgroup/lvm -To create ext4 File System for logical volume
Task 7. Resize the lvm “log" so that after reboot size should be in between 217MiB to
245MiB.
-Make sure complete logical volume should be usable.
Commands :
lvdisplay -To display logical volumes
lvextend -r -L +130M /dev/vg/log -To extend the logical volume and resize file system
PRINCE BAJAJ
RHCSA-EX200
Task 9. Create a standard partition of size 200 MiB and format this with ext4 file system.
- Change the file system to xfs and verify same.
Commands :
fdisk /dev/sda -To create partition (We will create logical partition)
First input : n ,Enter(To select default first sector), Second input : +200MiB ,wq (to save and
quit)
partprobe -To inform kernel about the partition
mkfs.ext4 /dev/sda13 -Create ext4 file system for partition
mkfs.xfs -f /dev/sda13 -Force the file system change to xfs
blkid - To verify
PRINCE BAJAJ
RHCSA-EX200
Task 11. Create a directory /system and configure the access as per below conditions :
-User “harry” should have full access on directory.
- User “bob” should have read-only access on this directory.
- User “lisa” have no access on this directory.
- Same access rules should be applicable to future files created under this directory.
Commands :
mkdir /system -To create directory
yum install acl -To install the package for acl if not already installed
setfacl -R -m u:harry:rwx /system -To configure acl for harry
setfacl -R -m d:u:harry:rwx /system -Default acl for harry
setfacl -R -m u:bob:rx /system -To configure acl for bob
setfacl -R -m d:u:bob:rx /system -Default acl for bob
setfacl -R -m u:lisa:- /system -To configure acl for lisa
sefacl -R -m d:u:lisa:- /system -Default acl for lisa
getfacl /system -Display acls
PRINCE BAJAJ
RHCSA-EX200
Task 12. Discover the NFS share exported by NFS server “ipaserver.example.com”
-Mount the share /nfsshare on directory /share and mount should be persistent.
- NFS version 3 should be used
Commands:
yum install “Network File System Client” -To install NFS Client
showmount -e ipaserver.example.com - To discover NFS exports
mkdir /share -To create directory
mount -o nfsvers=3 ipaserver.example.com:/nfshare /share -To mount NFS export with
NFSv3 to test if it works
umount /share -Unmounting NFS export
vim /etc/fstab -Mounting persistently through fstab file
ipaserver.example.com:/nfsshare /share nfs _netdev,nfsvers=3 0 0
:wq
mount -a -To mount through fstab file
mount -To display the mounted file systems
PRINCE BAJAJ
RHCSA-EX200
Task 13. Discover the samba share and mount share “samba” on /smb1 directory with
“smb1” user.
- Use the password “password” to mount this share.
Commands:
yum install samba-client cifs-utils -Install required Packages for Samba-Client
smbclient -L ipaserver.example.com -To Discover Samba Share
mkdir /smb -To create mount Directory
mount -o username=smb1 //ipaserver.example.com/samba /smb1 -To mount the samba
share to test if it works
Enter the Samba user password : *********
umount /smb1 -To Umount the Samba Share
vim /etc/fstab -Make entry in fstab file to make mount persistent
//ipaserver.example.com/samba /smb1 cifs
_netdev,username=smb1,password=password 0 0
:wq
mount –a - To mount through fstab file
mount -To verify the mounted file systems
PRINCE BAJAJ
RHCSA-EX200
Task 1. Web server (httpd) needs to access the files in /web directory. Set the correct
SELinux context type on /web directory to make this possible.
-Restore the SELinux context.
-Changes done should be persistent.
Commands :
chcon -t httpd_sys_content_t /web -To Set the Selinux Context Type for run time,not
permanent
semanage fcontext -a -t httpd_sys_content_t "/web(/.*)?” -To set the Selinux Context Type
persistently
restorecon -R -v /web -To restore the Selinux context
ls -ldZ /web -To vefify the SELinux Context
PRINCE BAJAJ
RHCSA-EX200
Commands :
systemctl status firewalld -To check the status of firewalld service
firewall-config -To use Graphical user interface for firewall settings
firewall-cmd --list-all - To Display all firewall settings
Commands :
systemctl status firewalld -To check the status of firewalld service
firewall-config -To use Graphical user interface for firewall settings
firewall-cmd --list-all - To Display all firewall settings
PRINCE BAJAJ
RHCSA-EX200
Task 5. List all SELinux booleans and set the SELinux boolean samba_export_all_rw to 1 to
allow Samba server to share exports with r/w permissions.
- Changes should be persistent.
Commands:
getsebool -a -To list all SELinux Booleans
setsebool -P samba_export_all_rw 1 -To set the Boolean persistently
PRINCE BAJAJ
RHCSA-EX200
PRINCE BAJAJ