Sei sulla pagina 1di 6

RHCSA 7 Exam Preparation

Set root password to testNato.


reboot your system
use up and down arrow key
press e to edit in main kernel file
go to linux16 line and press end key
(space) rd.break
ctrl+x
#mount -o remount,rw /sysroot
#chroot /sysroot
#passwd root
testNato
testNato
#touch /.autorelabel
#exit
#exit

Set your system host name to station.domain1.example.com.


#vim /etc/hostname
or
#hostnamectl set-hostname station.domain1.example.com
for verify:
#hostnamectl OR #hostname

Insert manually IP address to 172.24.1.5/24 and your gateway address is 172.24.1.254 and dns address
is 172.24.1.250.
#nm-connection-editor
Click on IPV4 and Manually
ip 172.24.1.5 subnet 255.255.255.0 gw 172.24.1.254 dns 172.24.1.250
Click on Apply and Restart network service.

Click on Link of Exam paper.

**************************************************************************************
01. Set your system to enforcing mode permanently.
Answer-
#vim /etc/selinux/config
SELINUX=enforcing
(Esc):wq
reboot your system
for verify:
#cat /etc/selinux/config OR #getenforce

02. Resize your LVM /mnt/volume to 280 MB will range to (250M-290M).


Answer-
#df -hT /mnt/volume (/mnt/volume partition size is 256MB)
#lvs
#lvresize -L +24M /dev/vg_name/lv_name
#resize2fs /dev/vg_name/lv_name
#mount -a
#partprobe /dev/vda

03. Create a repo file using this baseurl=http://gls.domain1.example.com/materials/rhel7_servers


Answer-
#vim /etc/yum.repos.d/rhel.repo
[local]
name=local system
baseurl= http://gls.domain1.example.com/materials/rhel7_servers
enabled=1
gpgcheck=0
(Esc):wq
#yum clean all
#yum repolist all (to verify your repo file)

04. Install new kernal on station machine boot the system with new kernel using this
baseurl=http://gls.domain1.example.com/kernel/errata.
Answer-
#uname -r
#vim /etc/yum.repos.d/rhel1.repo
[local1]
name=rhel kernel
baseurl= http://gls.domain1.example.com/kernel/errata
enabled=1
gpgcheck=0
(Esc):wq
#yum clean all
#yum repolist all (to verify your repo file)
#yum install -y kernel-*
for verify:
Restart and press up n down key to go to new kernel
#uname -r
05. Create a group network, Create users susan, natasha & robert, Users susan & natasha should be a
part of the network group, robert should not be a part of that group and she is given an non interactive
shell, password of all users are shAre@143.
Answer-
#groupadd network
#useradd susan
#useradd natasha
#useradd robert
#passwd susan (same for remaining users)
shAre@143
shAre@143
#usermod -G network susan
#usermod -G network natasha
#usermod -s /sbin/nologin robert
for verify:
#id susan
#id natasha
#su - robert

06. Syncronize your machine with ntp server host.domain1.example.com.


Answer-
#vim /etc/chrony.conf (all servers # check)
server host.domain1.example.com iburst
(Esc):wq
#systemctl restart chronyd.service
#systemctl enable chronyd.service
for verify:
#systemctl status chronyd.service
#chronyc sources -v
#timedatectl set-ntp true
#timedatectl (ntp must synchronize yes)

07. Create directory /secure on station machine, only group network can access it. Group owner should
be network & all child directories & files by default should have group network.
Answer-
#mkdir /secure
#chown :network /secure
#chmod 070 /secure
#chmod g+s /secure
for verify:
#ls -ld /secure
08. Configure an ldap client on station machine. Where your ldap server is host.domain1.example.com.
LDAP Base DN :(dc=domain1,dc=example,dc=com). Authenticate your ldap server using the certificate
(http://host.domain1.example.com/secure/Certs_TLS/example-ca.crt).
You should be able to login as ldapuser1 via LDAP. Ldap user password is password.
Answer-
# yum install -y openldap-clients nss-pam-ldapd sssd authconfig-gtk
# yum install nfs-utils rpcbind autofs

# system-config-authentication OR #authconfig-gtk

LDAP Search Base DN: dc=domain1,dc=example,dc=com


LDAP Server: ldap://host.domain1.example.com

Click on TLS Certificate and enter TLS URL

# getent passwd ldapuser1


# su - ldapuser1

09. Copy /etc/fstab to /var/tmp/fstab. The user & group owner of that file should be root. All users
should be able to read the file. No one should be able to execute. susan should not be able to read nor
write. natasha should be able to read & write.
Answer-
#cp /etc/fstab /var/tmp/
#setfacl -m u:susan:--- /var/tmp/fstab
#setfacl -m u:natasha:rw- /var/tmp/fstab
for verify:
#getfacl /var/tmp/fstab

10. Configure automount in such a way that the ldapuser1 home directory in
host.domain1.example.com:/rhome/ ldapuser1 should be mounted as local directory /rhome when
ldapuser1 login .This configuration must be persistant after restart. Ldapuser home directory mounted
using latest version of Nfs v3.
Answer-
#vim /etc/auto.master
/rhome /etc/auto.misc
# vim /etc/auto.misc
ldapuser1 -nfs,-rw,vers=3 host.domain1.example.com:/rhome/ldapuser1
# systemctl restart autofs
# systemctl enable autofs
# su - ldapuser1
#pwd
11. Add a cron job for the user natasha /bin/echo hiya. This job should run every day at 04:50.
Answer-
#crontab -eu natasha
50 04 * * * /bin/echo hiya
(Esc):wq
#systemctl restart crond.service
#systemctl enable crond.service
for verify:
#crontab -lu natasha

12. Create a Swap partition of 700MB.


Answer-
#fdisk /dev/vda
n (for new create)
First Sector- Leave
Last Sector- +700M
t
7 (It's partition no.)
82
w (for save)
#partprobe /dev/vda
#mkswap /dev/vda7
#vim /etc/fstab
UUID=........... swap swap defaults 00
(Esc):wq
#swapoff -a
#swapon /dev/vda7
#swapon -a
for verify:
#free -m
#swapon
#swapon -s

13. Create a user deepak, set user id of this user should be 2556.
Answer-
#useradd deepak
#usermod -u 2556 deepak
for verify:
#id deepak

14. Locate all files owned by user student & copy them to /var/info.
Answer-
#mkdir /var/info
#find / -user student -exec cp -rfp {} /var/info \;
for verify:
#ls /var/info
15. Search for the text 'strato' in the file /usr/share/dict/words & copy this to a file /root/line.txt.
Answer-
#grep strato /usr/share/dict/words > /root/line.txt
for verify:
#cat /root/lines.txt

16. Create a logical volume name attrib from the volume group name object. The volume group should
have extents of size 8M. The logical volume should have 50 extents. Mount this lvm as /mnt/block.
make it as vfat file system
Answer-
#fdisk /dev/vda
n (for new create)
First Sector- Leave
Last Sector- +500M
t (for label type)
8 (partition no.)
8e (for make label to LVM)
w (for save)
#partprobe /dev/vda
#mkdir /mnt/block
#pvcreate /dev/vda8 (here is partition no.)
#vgcreate -s 8 object /dev/vda8
#lvcreate -l 50 -n attrib object
#mkfs.vfat /dev/object/attrib
#blkid /dev/object/attrib (copy the UUID)
#vim /etc/fstab
UUID=........... /mnt/block vfat defaults 12
(Esc):wq
#mount -a
#partprobe /dev/vda
for verify:
#df -hT
#vgdisplay and #lvdisplay

17. Create an archive file by using extension /root/system.tar.bz2 of /usr/sbin.


Answer-
#tar cjvf /root/system.tar.bz2 /usr/sbin
for verify:
#tar tjvf /root/system.tar.bz2

*******************************************Best of Luck*****************************************

Potrebbero piacerti anche