EX200試験無料問題集「RedHat Red Hat Certified System Administrator - RHCSA 認定」
Part 1 (on Node1 Server)
Task 13 [Archiving and Transferring Files & SELinux]
Create a backup file named /root/backup.tar.bz2. The backup file should contain the content of /usr/local and should be zipped with bzip2 compression format.
Furthermore, ensure SELinux is in enforcing mode. If it is not, change SELinux to enforcing mode.
Task 13 [Archiving and Transferring Files & SELinux]
Create a backup file named /root/backup.tar.bz2. The backup file should contain the content of /usr/local and should be zipped with bzip2 compression format.
Furthermore, ensure SELinux is in enforcing mode. If it is not, change SELinux to enforcing mode.
正解:
* [root@node1 ~]# tar cvf /root/backup.tar /usr/local/
tar: Removing leading `/' from member names
/usr/local/
/usr/local/bin/
/usr/local/etc/
[root@node1 ~]# ls
backup.tar
[root@node1 ~]# file backup.tar
backup.tar: POSIX tar archive (GNU)
[root@node1 ~]# bzip2 backup.tar
[root@node1 ~]# ls
backup.tar.bz2
[root@node1 ~]# file backup.tar.bz2
backup.tar.bz2: bzip2 compressed data, block size = 900k
*
[root@node1 ~]# sestatus
SELinux status: enabled
[root@node1 ~]# cat /etc/selinux/config
SELINUX=enforcing
SELINUXTYPE=targeted
[root@node1 ~]# reboot
### For Checking ###
[root@node1 ~]# sestatus
SELinux status: enabled
tar: Removing leading `/' from member names
/usr/local/
/usr/local/bin/
/usr/local/etc/
[root@node1 ~]# ls
backup.tar
[root@node1 ~]# file backup.tar
backup.tar: POSIX tar archive (GNU)
[root@node1 ~]# bzip2 backup.tar
[root@node1 ~]# ls
backup.tar.bz2
[root@node1 ~]# file backup.tar.bz2
backup.tar.bz2: bzip2 compressed data, block size = 900k
*
[root@node1 ~]# sestatus
SELinux status: enabled
[root@node1 ~]# cat /etc/selinux/config
SELINUX=enforcing
SELINUXTYPE=targeted
[root@node1 ~]# reboot
### For Checking ###
[root@node1 ~]# sestatus
SELinux status: enabled
Part 2 (on Node2 Server)
Task 6 [Implementing Advanced Storage Features]
Add a new disk to your virtual machine with a ize of 10 GiB
On this disk, create a VDO volume with a size of 50 GiB and mount it persistently on /vbread with xfs filesystem
Task 6 [Implementing Advanced Storage Features]
Add a new disk to your virtual machine with a ize of 10 GiB
On this disk, create a VDO volume with a size of 50 GiB and mount it persistently on /vbread with xfs filesystem
正解:
* [root@node2 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vdd 252:48 0 5G 0 disk
vde 252:64 0 10G 0 disk
[root@node2 ~]# yum install kmod-kvdo vdo
[root@node2 ~]# systemctl enable --now vdo
[root@node2 ~]# systemctl start vdo
[root@node2 ~]# systemctl status vdo
[root@node2 ~]# vdo create --name=vdo1 --device=/dev/vde --vdoLogicalSize=50G
[root@node2 ~]# vdostats --hu
Device Size Used Available Use% Space saving%
/dev/mapper/vdo1 10.0G 4.0G 6.0G 40% N/A
[root@node2 ~]# mkfs.xfs -K /dev/mapper/vdo1
* [root@node2 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vde 252:64 0 10G 0 disk
└─vdo1 253:4 0 50G 0 vdo
[root@node2 ~]# mkdir /vbread
[root@node2 ~]# blkid
/dev/mapper/vdo1: UUID="1ec7a341-6051-4aed-8a2c-4d2d61833227" BLOCK_SIZE="4096" TYPE="xfs"
[root@node2 ~]# vim /etc/fstab
UUID=1ec7a341-6051-4aed-8a2c-4d2d61833227 /vbread xfs defaults,x-systemd.requires=vdo.service 0 0
[root@node2 ~]# mount /dev/mapper/vdo1 /vbread/
[root@node2 ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/vdo1 xfs 50G 390M 50G 1% /vbread
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vdd 252:48 0 5G 0 disk
vde 252:64 0 10G 0 disk
[root@node2 ~]# yum install kmod-kvdo vdo
[root@node2 ~]# systemctl enable --now vdo
[root@node2 ~]# systemctl start vdo
[root@node2 ~]# systemctl status vdo
[root@node2 ~]# vdo create --name=vdo1 --device=/dev/vde --vdoLogicalSize=50G
[root@node2 ~]# vdostats --hu
Device Size Used Available Use% Space saving%
/dev/mapper/vdo1 10.0G 4.0G 6.0G 40% N/A
[root@node2 ~]# mkfs.xfs -K /dev/mapper/vdo1
* [root@node2 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vde 252:64 0 10G 0 disk
└─vdo1 253:4 0 50G 0 vdo
[root@node2 ~]# mkdir /vbread
[root@node2 ~]# blkid
/dev/mapper/vdo1: UUID="1ec7a341-6051-4aed-8a2c-4d2d61833227" BLOCK_SIZE="4096" TYPE="xfs"
[root@node2 ~]# vim /etc/fstab
UUID=1ec7a341-6051-4aed-8a2c-4d2d61833227 /vbread xfs defaults,x-systemd.requires=vdo.service 0 0
[root@node2 ~]# mount /dev/mapper/vdo1 /vbread/
[root@node2 ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/vdo1 xfs 50G 390M 50G 1% /vbread
The user authentication has been provided by ldap domain in 192.168.0.254. According the following requirements to get ldapuser.
-LdapuserX must be able to login your system, X is your hostname number. But the ldapuser's home directory cannot be mounted, until you realize automatically mount by autofs server.
- All ldap user's password is "password".
-LdapuserX must be able to login your system, X is your hostname number. But the ldapuser's home directory cannot be mounted, until you realize automatically mount by autofs server.
- All ldap user's password is "password".
正解:
system-config-authentication &
Configure a task: plan to run echo hello command at 14:23 every day.
正解:
# which echo
# crontab -e
23 14 * * * /bin/echo hello
# crontab -l (Verify)
# crontab -e
23 14 * * * /bin/echo hello
# crontab -l (Verify)
Configure autofs
Configure autofs to automatically mount the home directory of a remote user as described below:
- materials.example.com (172.25.254.254) exports /rhome via NFS to your system. This filesystem contains a pre-configured home directory for the user remoteuser1.
- The home directory of remoteuser1 is materials.example.com:/rhome/remoteuser1.
- The home directory of remoteuser1 should be automatically mounted locally at /rhome/remoteuser1.
- The home directory must be writable by the user.
- The password for remoteuser1 is "flectrag".
Configure autofs to automatically mount the home directory of a remote user as described below:
- materials.example.com (172.25.254.254) exports /rhome via NFS to your system. This filesystem contains a pre-configured home directory for the user remoteuser1.
- The home directory of remoteuser1 is materials.example.com:/rhome/remoteuser1.
- The home directory of remoteuser1 should be automatically mounted locally at /rhome/remoteuser1.
- The home directory must be writable by the user.
- The password for remoteuser1 is "flectrag".
正解:
# Preparations (not required for the exam)
# Go back to foundation0, remote into classroom, create the remoteuser1 user and directory.
# This step is necessary to avoid issues with autofs mounting during testing.
[kiosk@foundation0 ~]$ ssh root@classroom 'useradd -u 1010 remoteuser1 && mkdir -p /rhome/remoteuser1 && chown remoteuser1: /rhome/remoteuser1'
# Install nfs-utils and autofs
[root@node1 ~]# yum -y install nfs-utils autofs
[root@node1 ~]# vim /etc/auto.master
/rhome /etc/auto.rhome
[root@node1 ~]# vim /etc/auto.rhome
remoteuser1 -rw materials.example.com:/rhome/remoteuser1
[root@node1 ~]# systemctl enable --now autofs
# Verification
[root@node1 ~]# ll /rhome/
[root@node1 ~]# ssh remoteuser1@localhost
remoteuser1@localhost\'s password: `flectrag`
$ pwd
/rhome/remoteuser1
$ touch my.file
$ mount | grep rhome
...
materials.example.com:/rhome/remoteuser1 on /rhome/remoteuser1 type nfs4 (`rw`,relatime,vers=4.2,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=172.25.250.100,local_lock=none,addr=172.25.254.254)
# Go back to foundation0, remote into classroom, create the remoteuser1 user and directory.
# This step is necessary to avoid issues with autofs mounting during testing.
[kiosk@foundation0 ~]$ ssh root@classroom 'useradd -u 1010 remoteuser1 && mkdir -p /rhome/remoteuser1 && chown remoteuser1: /rhome/remoteuser1'
# Install nfs-utils and autofs
[root@node1 ~]# yum -y install nfs-utils autofs
[root@node1 ~]# vim /etc/auto.master
/rhome /etc/auto.rhome
[root@node1 ~]# vim /etc/auto.rhome
remoteuser1 -rw materials.example.com:/rhome/remoteuser1
[root@node1 ~]# systemctl enable --now autofs
# Verification
[root@node1 ~]# ll /rhome/
[root@node1 ~]# ssh remoteuser1@localhost
remoteuser1@localhost\'s password: `flectrag`
$ pwd
/rhome/remoteuser1
$ touch my.file
$ mount | grep rhome
...
materials.example.com:/rhome/remoteuser1 on /rhome/remoteuser1 type nfs4 (`rw`,relatime,vers=4.2,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=172.25.250.100,local_lock=none,addr=172.25.254.254)
One Package named zsh is dump on ftp://server1.example.com under /pub/updates directory and your FTP server is 192.168.0.254. Install the package zsh.
正解:
rpm -ivh ftp://server1/example.com/pub/updates/zsh-*
or
Login to ftp server : ftp ftp://server1.example.com using anonymous user.
Change the directory: cd pub and cd updates
Download the package: mget zsh-*
Quit from the ftp prompt : bye
Install the package
rpm -ivh zsh-*
Verify either package is installed or not : rpm -q zsh
or
Login to ftp server : ftp ftp://server1.example.com using anonymous user.
Change the directory: cd pub and cd updates
Download the package: mget zsh-*
Quit from the ftp prompt : bye
Install the package
rpm -ivh zsh-*
Verify either package is installed or not : rpm -q zsh
Create the following users, groups, and group memberships:
A group named adminuser.
A user natasha who belongs to adminuser as a secondary group A user harry who also belongs to adminuser as a secondary group.
A user sarah who does not have access to an interactive shell on the system, and who is not a member of adminuser, natasha, harry, and sarah should all have the password of redhat.
A group named adminuser.
A user natasha who belongs to adminuser as a secondary group A user harry who also belongs to adminuser as a secondary group.
A user sarah who does not have access to an interactive shell on the system, and who is not a member of adminuser, natasha, harry, and sarah should all have the password of redhat.
正解:
groupadd sysmgrs
useradd -G sysmgrs Natasha
We can verify the newly created user by cat /etc/passwd)
# useradd -G sysmgrs harry
# useradd -s /sbin/nologin sarrh
# passwd Natasha
# passwd harry
# passwd sarrah
useradd -G sysmgrs Natasha
We can verify the newly created user by cat /etc/passwd)
# useradd -G sysmgrs harry
# useradd -s /sbin/nologin sarrh
# passwd Natasha
# passwd harry
# passwd sarrah
One Logical Volume is created named as myvol under vo volume group and is mounted. The Initial Size of that Logical Volume is 400MB. Make successfully that the size of Logical Volume 200MB without losing any dat a. The size of logical volume 200MB to 210MB will be acceptable.
正解:
First check the size of Logical Volume: lvdisplay /dev/vo/myvol
Make sure that the filesystem is in a consistent state before reducing:
# fsck -f /dev/vo/myvol
Now reduce the filesystem by 200MB.
# resize2fs /dev/vo/myvol 200M
It is now possible to reduce the logical volume. #lvreduce /dev/vo/myvol -L 200M Verify the Size of Logical Volume: lvdisplay /dev/vo/myvol Verify that the size comes in online or not: df -h
Make sure that the filesystem is in a consistent state before reducing:
# fsck -f /dev/vo/myvol
Now reduce the filesystem by 200MB.
# resize2fs /dev/vo/myvol 200M
It is now possible to reduce the logical volume. #lvreduce /dev/vo/myvol -L 200M Verify the Size of Logical Volume: lvdisplay /dev/vo/myvol Verify that the size comes in online or not: df -h
Configure Your System to Use Default Repositories
The YUM repositories are available at http://content/rhel9.0/x86_64/dvd/BaseOS and http://content/rhel9.0/x86_64/dvd/AppStream. Configure your system to use these locations as the default repositories.
The YUM repositories are available at http://content/rhel9.0/x86_64/dvd/BaseOS and http://content/rhel9.0/x86_64/dvd/AppStream. Configure your system to use these locations as the default repositories.
正解:
Method 1:
# Copy the yum configuration file from node1.
[root@node2 ~]# scp root@node1:/etc/yum.repos.d/rhcsa.repo /etc/yum.repos.d/
Method 2:
[root@node2 ~]# vim /etc/yum.repos.d/rhcsa.repo
[Base]
name=Base
baseurl=http://content/rhel9.0/x86_64/dvd/BaseOS
enabled=1
gpgcheck=no
[App]
name=App
baseurl=http://content/rhel9.0/x86_64/dvd/AppStream
enabled=1
gpgcheck=no
# Verification
[root@node2 ~]# yum repoinfo
[root@node2 ~]# yum -y install ftp
# Copy the yum configuration file from node1.
[root@node2 ~]# scp root@node1:/etc/yum.repos.d/rhcsa.repo /etc/yum.repos.d/
Method 2:
[root@node2 ~]# vim /etc/yum.repos.d/rhcsa.repo
[Base]
name=Base
baseurl=http://content/rhel9.0/x86_64/dvd/BaseOS
enabled=1
gpgcheck=no
[App]
name=App
baseurl=http://content/rhel9.0/x86_64/dvd/AppStream
enabled=1
gpgcheck=no
# Verification
[root@node2 ~]# yum repoinfo
[root@node2 ~]# yum -y install ftp
Create Archive
Create a tar archive named /root/backup.tar.bz2, which should contain the contents of /usr/local. The tar archive must be compressed using bzip2.
Create a tar archive named /root/backup.tar.bz2, which should contain the contents of /usr/local. The tar archive must be compressed using bzip2.
正解:
[root@node1 ~]# yum -y install bzip2
[root@node1 ~]# tar -jcvPf /root/backup.tar.bz2 /usr/local
# Verification
[root@node1 ~]# file /root/backup.tar.bz
[root@node1 ~]# tar -jcvPf /root/backup.tar.bz2 /usr/local
# Verification
[root@node1 ~]# file /root/backup.tar.bz