EX200試験無料問題集「RedHat Red Hat Certified System Administrator - RHCSA 認定」
Create a backup file named /root/backup.tar.bz2, which contains the contents of /usr/local, bar must use the bzip2 compression.
正解:
cd /usr/local
tar -jcvf /root/backup.tar.bz2*
mkdir /test
tar -jxvf /root/backup.tar.bz2 -C /test/
tar -jcvf /root/backup.tar.bz2*
mkdir /test
tar -jxvf /root/backup.tar.bz2 -C /test/
Part 2 (on Node2 Server)
Task 4 [Managing Logical Volumes]
Resize the logical volume, lvrz and reduce filesystem to 4600 MiB. Make sure the the filesystem contents remain intact with mount point /datarz (Note: partitions are seldom exactly the size requested, so anything within the range of 4200MiB to 4900MiB is acceptable)
Task 4 [Managing Logical Volumes]
Resize the logical volume, lvrz and reduce filesystem to 4600 MiB. Make sure the the filesystem contents remain intact with mount point /datarz (Note: partitions are seldom exactly the size requested, so anything within the range of 4200MiB to 4900MiB is acceptable)
正解:
* [root@node2 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vdb 252:16 0 5G 0 disk
└─vdb1 252:17 0 4.2G 0 part
└─vgrz-lvrz 253:2 0 4.1G 0 lvm /datarz
vdc 252:32 0 5G 0 disk
└─vdc1 252:33 0 4.4G 0 part
└─datavg-datalv 253:3 0 3.9G 0 lvm /data
vdd 252:48 0 5G 0 disk
vde 252:64 0 10G 0 disk
[root@node2 ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lvrz vgrz -wi-ao---- 4.10g
[root@node2 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vgrz 1 1 0 wz--n- <4.15g 48.00m
[root@node2 ~]# parted /dev/vdb print
Number Start End Size Type File system Flags
1 1049kB 4456MB 4455MB primary lvm
* [root@node2 ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/vgrz-lvrz ext4 4.0G 17M 3.8G 1% /datarz
[root@node2 ~]# parted /dev/vdb mkpart primary 4456MiB 5100MiB
[root@node2 ~]# parted /dev/vdb set 2 lvm on
[root@node2 ~]# udevadm settle
[root@node2 ~]# pvcreate /dev/vdb2
Physical volume "/dev/vdb2" successfully created.
* [root@node2 ~]# vgextend vgrz /dev/vdb2
Volume group "vgrz" successfully extended
[root@node2 ~]# lvextend -r -L 4600M /dev/vgrz/lvrz
Size of logical volume vgrz/lvrz changed from 4.10 GiB (1050 extents) to 4.49 GiB (1150 extents).
Logical volume vgrz/lvrz successfully resized.
[root@node2 ~]# resize2fs /dev/vgrz/lvrz
[root@node2 ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/vgrz-lvrz ext4 4.4G 17M 4.2G 1% /datarz
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vdb 252:16 0 5G 0 disk
└─vdb1 252:17 0 4.2G 0 part
└─vgrz-lvrz 253:2 0 4.1G 0 lvm /datarz
vdc 252:32 0 5G 0 disk
└─vdc1 252:33 0 4.4G 0 part
└─datavg-datalv 253:3 0 3.9G 0 lvm /data
vdd 252:48 0 5G 0 disk
vde 252:64 0 10G 0 disk
[root@node2 ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lvrz vgrz -wi-ao---- 4.10g
[root@node2 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vgrz 1 1 0 wz--n- <4.15g 48.00m
[root@node2 ~]# parted /dev/vdb print
Number Start End Size Type File system Flags
1 1049kB 4456MB 4455MB primary lvm
* [root@node2 ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/vgrz-lvrz ext4 4.0G 17M 3.8G 1% /datarz
[root@node2 ~]# parted /dev/vdb mkpart primary 4456MiB 5100MiB
[root@node2 ~]# parted /dev/vdb set 2 lvm on
[root@node2 ~]# udevadm settle
[root@node2 ~]# pvcreate /dev/vdb2
Physical volume "/dev/vdb2" successfully created.
* [root@node2 ~]# vgextend vgrz /dev/vdb2
Volume group "vgrz" successfully extended
[root@node2 ~]# lvextend -r -L 4600M /dev/vgrz/lvrz
Size of logical volume vgrz/lvrz changed from 4.10 GiB (1050 extents) to 4.49 GiB (1150 extents).
Logical volume vgrz/lvrz successfully resized.
[root@node2 ~]# resize2fs /dev/vgrz/lvrz
[root@node2 ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/vgrz-lvrz ext4 4.4G 17M 4.2G 1% /datarz
According the following requirements, configure autofs service and automatically mount to user's home directory in the ldap domain.
- Instructor.example.com (192.168.0.254) has shared /home/guests/ldapuserX home directory to your system by over NFS export, X is your hostname number.
- LdapuserX's home directory is exist in the instructor.example.com: /home/ guests/ldapuserX
- LdapuserX's home directory must be able to automatically mount to /home/ guests/ldapuserX in your system.
- Home directory have write permissions for the corresponding user.
However, you can log on to the ldapuser1 - ldapuser99 users after verification. But you can only get your corresponding ldapuser users. If your system's hostname is server1.example.com, you can only get ldapuser1's home directory.
- Instructor.example.com (192.168.0.254) has shared /home/guests/ldapuserX home directory to your system by over NFS export, X is your hostname number.
- LdapuserX's home directory is exist in the instructor.example.com: /home/ guests/ldapuserX
- LdapuserX's home directory must be able to automatically mount to /home/ guests/ldapuserX in your system.
- Home directory have write permissions for the corresponding user.
However, you can log on to the ldapuser1 - ldapuser99 users after verification. But you can only get your corresponding ldapuser users. If your system's hostname is server1.example.com, you can only get ldapuser1's home directory.
正解:
mkdir -p /home/guests
cat /etc/auto.master:
/home/guests /etc/auto.ldap
cat /etc/auto.ldap:
ldapuser1 -rw instructor.example.com:/home/guests/ldapuser1
automatically mount all the user's home directory #* -rw instructor.example.com:/home/guests/&
cat /etc/auto.master:
/home/guests /etc/auto.ldap
cat /etc/auto.ldap:
ldapuser1 -rw instructor.example.com:/home/guests/ldapuser1
automatically mount all the user's home directory #* -rw instructor.example.com:/home/guests/&
Change the logical volume capacity named vo from 190M to 300M. and the size of the floating range should set between 280 and 320. (This logical volume has been mounted in advance.)
正解:
# vgdisplay
(Check the capacity of vg, if the capacity is not enough, need to create pv , vgextend , lvextend)
# lvdisplay (Check lv)
# lvextend -L +110M /dev/vg2/lv2
# resize2fs /dev/vg2/lv2
mount -a
(Verify)
------------------------------------------------------------------------------- (Decrease lvm)
# umount /media
# fsck -f /dev/vg2/lv2
# resize2fs -f /dev/vg2/lv2 100M
# lvreduce -L 100M /dev/vg2/lv2
# mount -a
# lvdisplay (Verify)
OR
# e2fsck -f /dev/vg1/lvm02
# resize2fs -f /dev/vg1/lvm02
# mount /dev/vg1/lvm01 /mnt
# lvreduce -L 1G -n /dev/vg1/lvm02
# lvdisplay (Verify)
(Check the capacity of vg, if the capacity is not enough, need to create pv , vgextend , lvextend)
# lvdisplay (Check lv)
# lvextend -L +110M /dev/vg2/lv2
# resize2fs /dev/vg2/lv2
mount -a
(Verify)
------------------------------------------------------------------------------- (Decrease lvm)
# umount /media
# fsck -f /dev/vg2/lv2
# resize2fs -f /dev/vg2/lv2 100M
# lvreduce -L 100M /dev/vg2/lv2
# mount -a
# lvdisplay (Verify)
OR
# e2fsck -f /dev/vg1/lvm02
# resize2fs -f /dev/vg1/lvm02
# mount /dev/vg1/lvm01 /mnt
# lvreduce -L 1G -n /dev/vg1/lvm02
# lvdisplay (Verify)
Debugging SELinux
A web server running on non-standard port 82 encounters issues while serving content. Debug and resolve the problem to meet the following conditions:
- The web server on the system can serve HTML files hosted in /var/www/html (Note: Do not delete or modify existing file contents)
- The web server can serve content on port 82
- The web server can start automatically at system boot
A web server running on non-standard port 82 encounters issues while serving content. Debug and resolve the problem to meet the following conditions:
- The web server on the system can serve HTML files hosted in /var/www/html (Note: Do not delete or modify existing file contents)
- The web server can serve content on port 82
- The web server can start automatically at system boot
正解:
# Check which package provides the semanage command
[root@node1 ~]# yum provides "*/semanage"
# Install the semanage command
[root@node1 ~]# yum -y install policycoreutils-python-utils
[root@node1 ~]# semanage port -l |grep http
[root@node1 ~]# semanage port -a -t http_port_t -p tcp 82
# Alternatively, you can use man semanage port, then search for EXAMPLE.
[root@node1 ~]# systemctl restart httpd
[root@node1 ~]# systemctl enable httpd
# Verification, seeing the source code indicates correctness (mandatory operation)
[root@node1 ~]# curl http://node1.domain250.example.com:82
[root@node1 ~]# yum provides "*/semanage"
# Install the semanage command
[root@node1 ~]# yum -y install policycoreutils-python-utils
[root@node1 ~]# semanage port -l |grep http
[root@node1 ~]# semanage port -a -t http_port_t -p tcp 82
# Alternatively, you can use man semanage port, then search for EXAMPLE.
[root@node1 ~]# systemctl restart httpd
[root@node1 ~]# systemctl enable httpd
# Verification, seeing the source code indicates correctness (mandatory operation)
[root@node1 ~]# curl http://node1.domain250.example.com:82
System Optimization Configuration
Choose the recommended tuned configuration set for your system and set it as default.
Choose the recommended tuned configuration set for your system and set it as default.
正解:
# Install and enable tuned
[root@node2 ~]# yum -y install tuned
[root@node2 ~]# systemctl enable tuned
[root@node2 ~]# systemctl restart tuned
# Check the recommended configuration scheme for the system
[root@node2 ~]# tuned-adm recommend
virtual-guest
# Switch to the specified configuration scheme
[root@node2 ~]# tuned-adm profile virtual-guest
# Check the current configuration scheme
[root@node2 ~]# tuned-adm active
Current active profile: virtual-guest
[root@node2 ~]# yum -y install tuned
[root@node2 ~]# systemctl enable tuned
[root@node2 ~]# systemctl restart tuned
# Check the recommended configuration scheme for the system
[root@node2 ~]# tuned-adm recommend
virtual-guest
# Switch to the specified configuration scheme
[root@node2 ~]# tuned-adm profile virtual-guest
# Check the current configuration scheme
[root@node2 ~]# tuned-adm active
Current active profile: virtual-guest
Copy /etc/fstab document to /var/TMP directory. According the following requirements to configure the permission of this document.
The owner of this document must be root.
This document belongs to root group.
User mary have read and write permissions for this document.
User alice have read and execute permissions for this document.
Create user named bob, set uid is 1000. Bob have read and write permissions for this document.
All users has read permission for this document in the system.
The owner of this document must be root.
This document belongs to root group.
User mary have read and write permissions for this document.
User alice have read and execute permissions for this document.
Create user named bob, set uid is 1000. Bob have read and write permissions for this document.
All users has read permission for this document in the system.
正解:
cp /etc/fstab /var/tmp
chown root:root /var/tmp/fstab
chmod a-x /var/tmp/fstab
setfacl -m u:mary:rw /var/tmp/fstab
setfacl -m u:alice:rx /var/tmp/fstab
useradd -u 1000 bob
chown root:root /var/tmp/fstab
chmod a-x /var/tmp/fstab
setfacl -m u:mary:rw /var/tmp/fstab
setfacl -m u:alice:rx /var/tmp/fstab
useradd -u 1000 bob
We are working on /data initially the size is 2GB. The /dev/test0/lvtestvolume is mount on /dat a. Now you required more space on /data but you already added all disks belong to physical volume. You saw that you have unallocated space around 5 GB on your harddisk. Increase the size of lvtestvolume by 5GB.
正解:
Create a partition having size 5 GB and change the syste id '8e'.
use partprobe command
pvcreate /dev/hda9 Suppose your partition number is hda9.
vgextend test0 /dev/hda9 vgextend command add the physical disk on volume group.
lvextend -L+5120M /dev/test0/lvtestvolume
verify using lvdisplay /dev/test0/lvtestvolume.
use partprobe command
pvcreate /dev/hda9 Suppose your partition number is hda9.
vgextend test0 /dev/hda9 vgextend command add the physical disk on volume group.
lvextend -L+5120M /dev/test0/lvtestvolume
verify using lvdisplay /dev/test0/lvtestvolume.
Create a 2G swap partition which take effect automatically at boot-start, and it should not affect the original swap partition.
正解:
# fdisk /dev/sda
p
(check Partition table)
n
(create new partition: press e to create extended partition, press p to create the main partition, and the extended partition is further divided into logical partitions) Enter
+2G
t
l
W
partx -a /dev/sda
partprobe
mkswap /dev/sda8
Copy UUID
swapon -a
vim /etc/fstab
UUID=XXXXX swap swap defaults 0 0
(swapon -s)
p
(check Partition table)
n
(create new partition: press e to create extended partition, press p to create the main partition, and the extended partition is further divided into logical partitions) Enter
+2G
t
l
W
partx -a /dev/sda
partprobe
mkswap /dev/sda8
Copy UUID
swapon -a
vim /etc/fstab
UUID=XXXXX swap swap defaults 0 0
(swapon -s)
Create a swap space, set the size is 600 MB, and make it be mounted automatically after rebooting the system (permanent mount).
正解:
if=/dev/zero of=/swapfile bs=1M count=600 mkswap /swapfile
/etc/fstab:
/swapfile swap swap defaults 0 0 mount -a
/etc/fstab:
/swapfile swap swap defaults 0 0 mount -a