zero Linux Basic assault RHCSA Certification examination — A fool’s summary
Preparation steps
- Before entering the examination system , You need to register first , Fill in your own information , The name to be filled in at the time of registration is the name on the certificate , Please fill in the email address QQ mailbox .
Additional questions
- Enter the exam system
// Click on Manage VMS---> Turn on classroom---> Turn on desktop
// Click on view desktop Get into redhat page choice notlist Use the user name root password redhat land
// Right click after entering the page open terminal Input exam_rhcsa So you're in the exam system
- Will virtual machine root Change the password to modtweed
// Type in terminal exam_rhcsa after , Pay attention to using the up and down keys to stop in the selection system page , Select the first system , Press e Get into
// After entering the page , Key words found ro, take ro Delete everything in the following paragraph
// stay ro Type after rw rd.break
//ctrl+x restart
// After restart , Type the following code under the page
chroot /sysroot
echo modtweed | passwd --stdin root
touch /.autorelabel
exit
exit
// After restart, you can log in with the password you just set
- configure network
The network configuration of virtual machine is as follows :
Host name :serverx.example.com
Ip Address :172.25.x.11
Subnet mask netmask:255.255.255.0
gateway Gateway:172.25.x.254
Server name DNS servers:172.25.254.254
nmtui // Enter the graphical interface and configure according to the title requirements IPv4 The Internet
// Delete the previous Ethernet connection ,add New Ethernet connection
// It should be noted that IPv4 configuration Choose to be manul
Addresses:172.25.1.11/24 //IP Address and subnet mask x Modify according to the number of the examination machine , Here we use 1 For example
Gateway:172.25.1.254 // gateway
DNS servers:172.25.254.254 // Server name
// Once created , Exit the graphical interface .
systemctl restart newwork // Restart network configuration
ifconfig // See if the configuration is successful
hostnamectl set-hostname server1.example.com // Set host name
This completes the additional questions of the exam , The official question to enter the examination
After the network is configured , We can use it on a real machine ssh Connected . Open… In the real machine terminal, Enter the following code
ssh [email protected] -X// enter , Then enter the password you changed before , You can use the real machine to connect to the virtual machine of the examination -X Be careful X As the capital
Official title
- To configure SELinux Subject requirements :SELinux It has to be for enforcing
getenforce // see SElinux state , If it is enforcing You don't need to configure , If it is disabled You need to type the following code to reconfigure
vim /etc/sysconfig/selinux
// Press i Start editing
// take SELINUX=disabled Change it to SELINUX=enforcing
// Press Esc Exit the editor
:wq// Save and exit
reboot
ssh [email protected]
modtweed // Input root password
getenforce// See if the configuration is successful
-
Configure a default software repository for your system
Subject requirements :Yum Software for http://content.example.com/rhel7.0/x86_64/dvd Configure this as your system
Default software warehouse
rm -fr /etc/yum.repo.d/* // Delete the previous yum Source
vim /etc/yum.repo.d/yum.repo // Add new yum Source
// Press i Start editing
// The editorial content is :
[exam]
name=exam
baseurl=http://content.example.com/rhel7.0/x86_64/dvd
gpgcheck=0
// Press Esc Exit the editor
:wq// Save and exit
vim /etc/hosts // See if the resolution is correct ,content.example.com The address of should be the same as classroom.example.com The same address as
yum clean all // Clear installation package
yum repolist // see yum Source
- Resize logical volume
a) Put the logic volume vo And its file system size to 230M , Make sure that the contents of the file system remain intact .
b) Please note that : The partition size is rarely exactly the size required , So in 217M and 243M Between
It’s all right
blkid // Use blkid View file type , With ext4 Format as an example
df -h // Look at the logical partition size , Determine whether the adjustment method is to reduce or expand the capacity
umount /dev/mapper/vg0-vo // Unload mount
e2fsck -f /dev/mapper/vg0-vo // Safety inspection
resize2fs /dev/mapper/vg0-vo 230M // Resize logical volume
lvreduce -L 230M /dev/mapper/vg0-vo // adjustment lv size
mount -a // Re mount
df -h // Look at the logical partition size , Is the modification successful
// With ext4 The expansion of the format to 400M Operation as an example Expansion requires the use of mount Check out the file system , But you don't need to unmount , There is no need to enforce file system detection
mount
lvextend -L 400M /dev/mapper/vg0-vo //
resize2fs /dev/mapper/vg0-vo // to update
// With xfs For example, format expansion
mount
lvextend -L 400M /dev/mapper/vg0-vo
xfs.growfs /dev/mapper/vg0-vo
//xfs A downsizing operation on logical volume is not supported , So you need to change the disk format to ext4 And then reduce the volume
mkfs.ext4 /dev/mapper/vg0-vo
umount /dev/mapper/vg0-vo // Unload mount
e2fsck -f /dev/mapper/vg0-vo // Safety inspection
resize2fs /dev/mapper/vg0-vo 230M // Resize logical volume
lvreduce -L 230M /dev/mapper/vg0-vo
mount -a // Re mount
- Create user account
a) Create the following users , Group , Membership with group
b) A group called sysmgrs Group
c) A group called natasha Users of , It belongs to sysmgrs, This group is the subordinate group of this user
d) A group called harry Users of , Belong to sysmgrs, This group is the subordinate group of this user
e) A group called sarah Users of , There is no interaction in the system summary shell, And the user is not
sysmgrs Group members of
f) user natsha,harry,sarah It’s all set to :modteed
groupadd sysmgrs
useradd -G sysmgrs natasha
useradd -G sysmgrs harry
useradd -s /sbin/nologin sarah
echo modtweed | passwd --stdin natasha
echo modtweed | passwd --stdin harry
echo modtweed | passwd --stdin sarah
- The configuration file /var/tmp/fstab Authority
a) Copy files /etc/fstab To /var/tmp/fstab The configuration file /var/tmp/fstab Authority
b) file /var/tmp/fstab The owner of root
c) file /var/tmp/fstab Belong to root Group
d) file /var/tmp/fstab Not executable for any user
e) user natasha Be able to /var/tmp/fstab/ Have read and write permission
f) user harry The file /var/tmp/fstab Neither read nor write
g) Other users ( Present and future ) Can you check the file /var/tmp/fstab Read it
cp /etc/fstab /var/tmp/fstab // Copy
// Modify file owners can use chown user_name File path To modify the The title here requires the owner to be root So there's no need to change
// To modify a file dependency group, you can use chgrp group_name File path To modify the The subject requires that the subordinate group be root So there's no need to change
// The default file is not executable for any user No need to modify
setfacl -m u:natasha:rw /var/tmp/fstab // Set up natasha Read and write access to the file
setfacl -m u:harry:0 /var/tmp/fstab // Set up harry You can't read or write to the file
// Default to other users ( Present and future ) Be able to read a file So there's no need to modify
- To configure a cron Mission
a) user natasha A timed task must be configured , Local time every day 14:23 To execute an order /bin/echo hiya
crontab -u natasha -e// Go to the edit page
// Press i Start editing
23 14 * * * /bin/echo hiya // Format : branch when God month Zhou command
// Press Esc Exit the editor
:wq // Save and exit
cat /var/spool/cron/natasha // Check whether the task is configured successfully
systemctl status crond // See if the task is on
systemctl enable crond // By default, it starts automatically
- Create a shared directory
a) Create a shared directory /home/managers
b) /home/managers The ownership of the catalog is sysmgrs
c) sysmgrs Group members have read, write and execute permissions on the directory . All the other users don’t have any
What authority (root Except for users )
d) stay /home/managers Files created in the directory , Its group ownership is automatically set to belong to sysmgrs
Group
mkdir -p /home/managers // Create shared directory
chgrp sysmgrs /home/managers // Modify file dependency group
chmod 770 /home/managers // Modify file permissions 770 They correspond to each other user group Permissions of other users 1 representative x 2 representative w 4 representative r 7=1+2+4 For readable, writable, executable
chmod g+s /home/managers // Add... To the directory setgid sign , After the directory is set to this bit , Any file created by a user in this directory has the same group as the group to which the directory belongs .
ls -ld /home/managers // Check if the setting is successful
- Install kernel upgrade
a) from http://172.25.x.254/update Upgrade the correct kernel
b) When the system restarts, the upgraded kernel will be used as the default kernel
c) The original kernel will be preserved , And it can still start normally
// Open Firefox Input http://172.25.1.254/update Check the kernel version to be installed as kernel-3.10.0-123.1.2.el7.x86_64.rpm
wget http://172.25.1.254/update/kernel-3.10.0-123.1.2.el7.x86_64.rpm // download
rpm -ivh kernel-3.10.0-123.1.2.el7.x86_64.rpm // install
vim /boot/grub2/grub.cfg // Check the sort of the kernel version you just installed Drop down file In keywords menuentry Then check the installed (3.10.0-123.1.2.el7.x86_64) edition
grub2-set-default 0 // Set the default boot level of the system to the installed kernel version according to the sort
- a) Bind to external authentication service
b) System classroom.example.com Provides a ldap The validation service
Authentication server dn yes :dc=example,dc=com
c) Account information and verification information are ldap Provide
Links need to be encrypted with a certificate , The certificate can be downloaded in the link below :
http://classroom.example.com/pub/example-ca.crt
d) When the configuration is completed correctly , user ldapuser1 You should be able to log in to your system , But there’s no home directory , When finished autofs After the title of the user ldapuser1 The password for is password
ping classroom.example.com //ping The system domain name provided below If it doesn't work , explain dns There's something wrong with the settings
//ctrl+c sign out
yum install authconfig-gtk.x86_64 sssd -y // Install package
autuconfig-gtk // Jump to the graphic page of the software
// Set up on the graphics page
user account database: LDAP
LDAP Search Base DN: dc=example,dc=com ( The authentication server given in the title )
LDAP Server:classroom.example.com // The system domain name given in the title
Check User TLS to encrypt connections
Authentication Method:LDAP password
Click on Download CA Certificate
Click on Apply
Test it after the setup is successful
su - ldapuser1
appear bash-4.2$ Description of successful binding
exit // sign out
- To configure ntp
a) Configure your system , Let it be a classroom.example.com Of ntp client
vim /etc/chrony.conf
// Press i Start editing
server classroom.example.com( The domain name given by the title )iburst ( Start editing from the first line at the end of the comment Delete the other three lines of code Just keep this line of code )
// Press Esc Exit the editor
:wq // Save and exit
systemctl restart chronyd // restart
systemctl enable chronyd // By default, it starts automatically
chronyc sources -v // See if the configuration is successful When the last line of code sources(classroom.example.com) The front display is ^* Success
- To configure autofs
a) To configure autofs Realization ldap The user’s home directory is automatically mounted
b)Classroom.example.com(172.25.254.254) adopt nfs Output /home/guests Directory to your system. This directory contains users ldapuser1 The home directory , And it’s pre-set
c)ldapuser1 Our home directory is classroom.example.com:/home/guests/ldapuser1
d) ldapuser1 The home directory should be mounted to the local /home/guests/ldapuse1 Directory and read write mount ,nfs The mount version is 3
e) Users must be able to write to their home directory
f) ldapuser1 The user password is password
yum install autofs.x86_64 -y // install autofs
systemctl enable autofs // Set power on self start
getent passwd ldapuser1 // Check your home directory
vim /etc/auto.master // Open the editor
// Press i Start editing stay /misc /etc/auto/misc Add the following to the next line
/home/guests /etc/auto.ldap
( Format : The system goes through nfs Output directory /etc/auto.ldap )
// Press Esc Exit the editor
:wq // Save and exit
vim /etc/auto.ldap
// Press i Start editing , Add content : user name - jurisdiction ,vers=nfs Mount version System domain name : Home directory
ldapuser1 -rw,vers=3 classroom.example.com:/home/guests/ldapuser1
// Press Esc Exit the editor
:wq // Save and exit
systemctl restart autofs // Restart the service
systemctl enable autofs.service // The service must be set to boot automatically
// Test whether it can be mounted automatically :
su - ldapuser1 // Switching users
df // see classroom.example.com:/home/guests/ldapusers1 Whether there is
mount // mount , see classroom.example.com:/home/guests/ldapusers1 after nfs Whether the permission displayed after the keyword is rw as well as vers Whether it is in the requirements of the topic 3
logout // Exit current user
- Configure a user
a) Create a file called manalo Users of , user id3533 Password time modteed
useradd -u 3533 manalo
echo modtweed | passwd --stdin manalo
- Add one swap Partition
a) Add a size of… To the system 756M Of swap Partition , When your system starts automatically ,swap Can automatically mount
dd if=/dev/zero of=/swapfile bs=1M count=756 // Create a size of 756M The file of
du -sh /swapfile // View size When the command is not accurate , have access to ls -l View size
partprobe // Update partition
mkswap /swapfile // hold swapfile become swap file
vim /etc/fstab // Edit profile Add command
// Press i edit , Add the following
/swapfile swap swap defaults 0 0
// Press Esc Exit the editor
:wq // Save and exit
// test
swapon -a
swapon -s
- Find files
a) Find the user jacques All the documents you have , And copy them to /root/findfiles Directory
mkdir /root/findfiles // Create directory
find / -user jacques -exec cp -rp {} /root/findfiles \; // Find the file and copy it Pay attention to the semicolon
Knowledge point expansion :find / -name "*.txt" -exec rm {} \; In the current directory ( Include subdirectories ), Delete all txt File format
- Find a string
a) In the file /usr/share/xml/iso-codes/iso_639_3.xml Find all containing characters in ng The line of
b) Copy the found lines to /root/list In file ./root/list Do not include blank lines in the file
c) The contents of all lines must be the original standard copy in the source file
grep ng /usr/share/xml/iso-codes/iso_639_3.xml | sed 's/^$//g' >/root/list// Find the containing ng Remove the empty lines and copy them to /root/list Next
- File a file
a) Create a file called /root/backup.tar.gz Archive file , It includes /usr/local Contents of the catalog ,tar Archive files must use gzip Compress
tar zcf /root/backup.tar.gz /usr/local/ #tar File with gzip Compress
tar jcf /root/backup.tar.bz2 /usr/local/ #tar File with bz2 Compress
tar Jcf /root/backup.tar.xz /usr/local/ #tar File with xz Compress
- Create a logical volume
a) The logical volume name is qa, Belong to qagroup The volume group , And the size of the logical volume is 60 Physical expansion units
b)qagroup The physical expansion unit of logical volume in volume group is 16M
c) Use ext3 File system format and auto mount to /mnt/qa Under the table of contents
fdisk /dev/vdb // Enter the create partition interface
n // You can enter m View help command n:add a new partition
Press enter Key until Command: appear
t // t:change a partition's system id
2 //partiton number(1,2 default 2): Input here 2 Or press enter
8e // Hex code:8e This is the most critical step Through this step, modify the format to linux lvm
p // View partition table
wq // Save and exit
partprobe // to update
pvcreate /dev/vdb2 // Create a physical volume
vgcreate -s 16M qagroup /dev/vdb2 // Create the logical volume, and the physical expansion unit is 16M The volume group
lvcreate -l 60 -n qa qagroup // Create size as 60 Logical volume of physical expansion units qa qa Belong to qagroup -l Indicates the number of physical expansion units ,-L Denotes the size of the capacity with M In units of -n For the name
mkfs.ext3 /dev/qagroup/qa // Formatted as ext3 file
mkdir /mnt/qa // Create a directory to mount
vim /etc/fstab // Edit file system configuration
// Format :<file system> <dir> <type> <option> <dump> <pass>
// Press i Start editing
/dev/qagroup/qa /mnt/qa ext3 defaults 0 0
// Press Esc Exit the editor
:wq // Save and exit
mount -a // Mount all
df // Check if the setting is successful