Linux RHCSA Preparation

RHCSA

1. Start classroom-rh124; 
2. Set environment: tar xvf rhcsaexam.tar -C /
3. Start server-rh124
4. Set lab environment: lab examrhcsa setup
5. Check result: lab examrhcsa grade

Questions
1. Reset root password
A. Restrat the system;
B. In the login page, choose the first line and input "e"
C. Go to line start with "Linux16";
D. Add "rd.break" at the end of the line
E. If there is no "console=tty0" in the line, need to add it before "rd.break"
F. Press "Ctrl+x"
G. If screen shows "switch_root:/#", please do following steps
H. re mount the file system: mount -o remount,rw /sysroot
I. Go to /sysroot: chroot /sysroot
J. Change password: echo 'ooxx9527' | passwd --stdin root
K. Create file: touch /.autorelabel
L. Input "exit" twice to restart the system

2. Change hostname, network config
A. Change hostname: hostnamectl set-hostname server0.example.com
B. Check hostname: hostnamectl
C. Use graphic to change network config: nm-connection-editor
D. Use command to restart the network: nmcli connection down eth0 / nmcli connection up eth0
E. Check network config: nmcli connection show eth0

3. Set selinux
A. Check selinux: getenforce
B. Change selinux config file: vim /etc/sysconfig/selinux
From "SELINUX=permissive" to "SELINUX=enforcing"
C. After restart the system will using enforcing
D. Temporary change to enforcing: set enforce 1

4. Set Yum source
A. Verify the link 
B. Add yum source: yum-config-manager --add-repo="<url>"
C. Verify the repo: yum repolist

5. Change LV size
Check device: lsblk
A. Check the lv information: lvs
B. Check the vg information: vgs
C. Check the pv information: pvs
D. Check the mount point: df -h
E.  Create new PV: 
i. Create new partition: fdisk /dev/sdb --> p --> n --> p --> enter --> enter --> +500M --> P --> t --> 2 --> 8e --> w
ii. Check new partition: ll /dev/sdb2
iii. If not available, input command: partx -a /dev/sdb
iv. Create PV: pvcreate /dev/sdb2
F.  Add PV to VG: vgextend vg1 /dev/sdb2
G. Extend lv: lvextend -L 770M /dev/vg1/lvm1
H. Extend filesystem: 
i. Check the type of lv: blkid
ii. If the type is xfs, use command to extend filesystem: xfs_growfs /vg1/lvm1
iii. If the type is ext4, use command to extend filesystem: resize2fs /dev/vg1/lvm1
I. Check the filesystem ls /vg1/lvm1

6. Create user and usergroup
A. Create group: groupadd -g 40000 adminuser
B. Create user: useradd -G adminuser natasha
C. Create user: useradd -G adminuser harry
D. Create user: useradd -s /sbin/nologin sarah
E. Change password: echo 'glegunge' | passwd --stdin natasha
F. Change password: echo 'glegunge' | passwd --stdin harry
G. Change password: echo 'glegunge' | passwd --stdin sarah

7. File Privilege
A. Copy file: cp /etc/fstab /var/tmp
B. Check file: ll /var/tmp/fstab
C. Change owner: chown root:root /var/tmp/fstab
D. Remove execute: chmod u-x,g-x,o-x /var/tmp/fstab
E. Give natasha read and write: setfacl -m user:natasha:rw-,user:harry:---,other::r-- /var/tmp/fstab
F. Check facl: getfacl /var/tmp/fstab

8. Create task
A. Set crond automatic start: systemctl enable crond
B. Create task based on natasha: crontab -u natasha -e
23 14 * * * /bin/echo "rhcsa"
C. Check: crontab -u natasha -l

9. Speical File Privilege
A. Create folder: mkdir /home/admins
B. Change owner: chgrp adminuser /home/admins
C. Check the result: ll -d !$
D. Change privilege: chmod g=rwx,o=--- /home/admins
E. Change privilege: chmod g+s /home/admins
F. Check
i. touch /home/admins/1.txt 
ii. ll /home/admins/1.txt

10. Upgrade Kernel
A. Check the version before upgrade: uname -r
B. Install package: rpm -ivh <path in introduction>
C. Check the version after upgrade: uname -r
D. Restart the system: init 6

11. LDAP Client Config
A. edit the yum config file: vim /etc/yum.repos.d/classroom.example.com_content_rhel7.0_x86_64_dvd.repo
Add: gpgcheck=0
B. Install package: yum install sssd authconfig-gtk krb5-workstation -y
C. Config: authconfig-gtk
D. Follow the question to config the LDAP
E. Use username to verify: getent pwd ldapuser0
F. Use ssh to verify with password "kerberos": ssh ldapuser0@localhost 
G. Use command to exit: logout

12. Config LDAP auto mount
A. Install package: yum install autofs -y
B. Enable autofs service: systemctl enable autofs
C. Start autofs service: systemctl start autofs
D. Check the NFS folder: showmount -e classroom.example.com
E. Set the auto mount: 
i. Change file: vim /etc/auto.master
Add: /home/guests /etc/auto.master.d/ldapusers.autofs
ii. Create file: vim /etc/auto.master.d/ldapusers.autofs
Add: * -rw    classroom.example.com:/home/guests/&
F. Create local folder: mkdir /home/guests
G. Change privilege: chmod 777 /home/guests
H. Restart the service: systmctl restart autofs
I. Verify the setting with password "kerberos": ssh ldapuser0@localhost
Show [ldapuser0@server0 ~]$
J. Verify the setting with: mount

K. Use command to exit: exit

13. Time Sync
A. Install package: yum install chrony -y
B. Check time setting: timedatectl
C. Enable the service: systemctl enable chronyd
D. Start the service: systemctl start chronyd
E. Enable the ntp: timedatectl set-ntp true
F. Modify the time server: vim /etc/chrony.conf
i. Add: server classroom.example.com iburst
ii. Add # before all other time server
G. Restart the time: systemctl restart chronyd
H. Manually sync: chronyc --> waitsync
I. Verify the setting: timedatectl

14. Tar files
A. tar file: tar cvf /root/sysconfig.tar.bz2 /etc/sysconfig
B. Check file: ll /root/sysconfig.tar.bz2
C. Check file: tar tf /root/sysconfig.tar.bz2

15. Add user
A. Create user: useradd -u 3456 alex
B. Set password: echo "glegunge" | passwd --stdin alex

16. Create SWAP 
A. Check partition: lsblk
B. Create partition: fdisk /dev/sdb --> p --> n --> p --> enter --> enter --> +512M --> p --> t --> L --> 82 --> w
C. Check partitino: ll /dev/sdb3
D. If not exist, input command: partx -a /dev/sdb
E. Make swap partition: mkswap /dev/sdb3
F. Set auto mount: 
i. copy the <UUID>
ii. vim /etc/fstab
Add: <UUID> swap swap defaults 0 0
G. Manually start swap:  swapon -a
H. Check swap: free -m
I. Restart the system to verify the swap

17. Find files
A. Create destination folder: mkdir /root/findfiles
B. Find files: find / -user ira -exec cp -a {} /root/findfiles/ \;
C. Check result: ll /root/findfiles

18. Filter files
A. Find keywords and input into file: grep "seismic" /usr/share/dict/words > /root/wordlist
B. Check file: cat /root/wordlist

19. Create Logical Volumn
A. Check partition: lsblk
B. Create partition: fdisk /dev/sdb --> p --> n --> p --> enter --> enter --> enter --> p --> t --> 8e -> w
C. Check partitino: ll /dev/sdb4
D. If not exist, input command: partx -a /dev/sdb
E. Create PV: pvcreate /dev/sdb4
F. Create VG: vgcreate -s 16M exam /dev/sdb4
G. Check VG: vgdisplay exam
H. Create LV: lvcreate -l 8 -n lvm2 exam
I. Check LV: lvs / lvdisplay /dev/exam/lvm2
J. Format LV: mkfs.xfs /dev/exam/lvm2
K. Auto Mount: 
i. Create folder:  mkdir -p /exam/lvm2
ii. find UUID for lv: blkid
iii. vim /etc/fstab
Add: <UUID>  /exam/lvm2 xfs defaults 0 0 
L. Check fs: mount /exam/lvm2 

Comments

  1. Hej

    thank you for this helpful infos. But, are this the original tasks from the exam? or only to use for preparation?
    thx
    greets uwe

    ReplyDelete
  2. I learned the course from http://edu.51cto.com/course/course_id-3053.html
    The blog is my course notes. I am not sure whether it is really coming from exam since I never took it.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. very useful information thank you but how to can i get the lab setup environment?

    ReplyDelete

Post a Comment

Popular posts from this blog

Nginx Proxy & Load Balance & LNMP

Snort+barnyard2+Snorby CentOS 6.5_64 Installation

ORACLE Error