• 主机名称:westos_rh124_101. westos. com
• Ip 地址:172. 25. 254. 101
• 子网掩码:255. 255. 255. 0
• 网关:172. 25. 254. 250
• DNS :172. 25. 254. 250
• 虚拟机的 root 密码修改成 modtweed
方法一:
nmcli connection show
nmcli connection add type ethernet con- name ens3 ifname ens3 ipv4. method manual ipv4. addresses 172. 25. 254. 111/ 24
nmcli connection reload
nmcli connection down ens3
nmcli connection up ens3
ifconfig
ip route add default via 172. 25. 254. 250 ( 临时设定)
route - n
方法二:
cd / etc/ sysconfig/ network- scripts/
ls
vim ifcfg- ens3
vim /
nmcli connection reload
nmcli connection down westos
nmcli connection up westos
DEVICE=ens3
ONBOOT=yes
BOOTPROTO=none
IPADDR=172. 25. 254. 111
PREFIX=24
GATEWAY=172. 25. 254. 250
NAME=westos
ifconfig
route - n
vim / etc/ resolv. conf
search westos. org
nameserver 172. 25. 254. 250
方法三:
nm- connection- editor
hostnamectl set - hostname westos_rh124_111. westos. com
hosttname
su -
echo modtweed | passwd -- stdin root
• 配置一下地址:
• / var / www/ html/ rhel8
• 将此配置为您的系统默认软件仓库
• 确保此仓库可以通过
http:/ / 172. 25. 254. 101/ rhel8访问
cd / etc/ yum. repos. d/
ls
rm - fr / etc/ yum. repos. d/*
cd
mkdir / westos
mount / iso/ rhel- 8. 2- x86_64- dvd. iso / westos/
df
vim / etc/ yum. repos. d/ westos. repo
curl file:/ // westos/ AppStream
curl file:/ // westos/ BaseOS
dnf install httpd - y
[AppStream]
name=Appstream
baseurl=file:/ // westos/ AppStream
gpgcheck=0
enabled=1
[BaseOS]
name=BaseOS
baseurl=file:/ // westos/ BaseOS
gpgcheck=0
enabled=1
systemctl disable -- now firewalld
systemctl enable -- now httpd
mkdir / var / www/ html/ rhel8
umount / westos
cd
mount / iso/ rhel- 8. 2- x86_64- dvd. iso / var / www/ html/ rhel8
mv / etc/ yum. repos. d/ westos. repo / mnt/
cd / etc/ yum. repos. d/
vim westos. repo
dnf repolist
[AppStream]
name=Appstream
baseurl=http:/ / 172. 25. 254. 111/ rhel8/ AppStream
gpgcheck=0
enabled=1
[BaseOS]
name=BaseOS
baseurl=http:/ / 172. 25. 254. 111/ rhel8/ BaseOS
gpgcheck=0
enabled=1
创建下列用户, 组, 和组的成员关系(servera)
• 创建组sysmgrs
• 一个名为 natasha 的用户, 其属于 sysmgrs, 这个组是该用户的从属组
• 一个名为 harry 的用户, 属于 sysmgrs, 这个组是该用户的从属组
• 一个名为 sarah 的用户, 其在系统汇总没有可以交互的 shell
• 用户 natsha, harry, sarah 的秘密吗都要设定为:modteed
groupadd sysmgrs
useradd - G sysmgrs natasha
useradd - G sysmgrs harry
useradd - s / sbin/ nologin sarah
echo modteed | passwd -- stdin natasha
echo modteed | passwd -- stdin harry
echo modteed | passwd -- stdin sarah
拷贝文件/ etc/ fstab 到/ var / tmp/ fstab 配置文件/ var / tmp/ fstab 的权限
• 文件/ var / tmp/ fstab 的拥有者是 root 文件/ var / tmp/ fstab 属于 root 组
• 文件/ var / tmp/ fstab 对任何用户不可执行
• 用户 natasha 能够对文件/ var / tmp/ fstab/ 具有读写权限
• 用户 harry 对文件/ var / tmp/ fstab 既不能读也不能写
• 其他用户( 当前和将来的) 能对文件/ var / tmp/ fstab 进行读操作
watch - n 1 'getfacl /var/tmp/fstab;echo ""; ls -l /var/tmp/fstab'
cp / etc/ fstab / var / tmp/ fstab
setfacl - m u:natasha:rw / var / tmp/ fstab
setfacl - m u:harry:0 / var / tmp/ fstab
setfacl - m o:r / var / tmp/ fstab
setfacl - m d:o:r / var / tmp/
• / home/ managers 目录的所有权时 sysmgrs
• sysmgrs 组成员对目录有读写和执行的权限。除此之外的其他用户没有任何权限( root 用户除外)
• 在/ home/ managers 目录中创建的文件, 其组所有权会自动设置为属于 sysmgrs组
mkdir / home/ managers
chgrp sysmgrs / home/ managers
chmod 3770 / home/ managers
touch / home/ managers/ file1
ls - ld / home/ managers
• 配置您的系统, 让其作为一个 exam_ntp. westos. com 的 ntp 客户端
• exam_ntp. westos. com对应的ip地址为172. 25. 254. 250
服务端:共享时间,设定谁能看我的时间
systemctl disable -- now firewalld
vim / etc/ chrony. conf
systemctl enable -- now chronyd
systemctl status chronyd. service
allow 0. 0. 0. 0/ 0
local stratum 10
客户端:同步服务端时间过来
dnf install chrony. x86_64 - y
systemctl disable -- now firewalld
systemctl enable -- now chronyd
vim / etc/ chrony. conf
pool 172. 25. 254. 250 iburst
vim / etc/ hosts
127. 0. 0. 1 localhost localhost. localdomain localhost4 localhost4. localdomain4
::1 localhost localhost. localdomain localhost6 localhost6. localdomain6
172. 25. 254. 250 exam_ntp. westos. com
systemctl restart chronyd. service
• 创建一个名为 manalo 的用户, 用户 id3533 密码时 modteed
watch - n 1 "tail -n 3 /etc/passwd"
useradd - u 3533 manalo
echo modteed | passwd -- stdin manalo
• 创建一个名为/ root/ backup. tar. gz 的归档文件, 其中包含/ usr/ local 目录中的内容,
tar 归档文件必须使用 gzip 进行压缩
tar - zPcf / root/ backup. tar. gz / usr/ local
ls
• 在文件/ usr/ share/ xml/ iso- codes/ iso_639_3. xml 中查找到所有包含字符 ng 的行
• 将找出的行按照先后顺序复制到/ root/ list 文件中
• / root/ list 文件中无意义的空格请去除掉
• 其中的所有行的内容必须时源文件中原始的标准副本
grep ng / usr/ share/ xml/ iso- codes/ iso_639_3. xml > / root/ list
vim / root/ list
esc 退出键
:% s/ \t// g
:% s/ / / g
:/ lp / , / halt/ s/ :/
• 用manalo用户建立用户级crontab任务
• 要求此用户每周五09- 17点每隔半小时清理/ tmp目录中自己的文件
crontab - u manalo - e
* / 30 09- 17 * * 5 rm - fr / tmp/*
在VM虚拟机中为系统配置一个默认的软件仓库
df
cd / etc/ yum. repos. d/
vim westos. repo
dnf install httpd - y
[AppStream]
name=Appstream
baseurl=file:/ // run/ media/ root/ RHEL- 8- 2- 0- BaseOS- x86_64/ Appstream
gpgcheck=0
enabled=1
[BaseOS]
name=BaseOS
baseurl=file:/ // run/ media/ root/ RHEL- 8- 2- 0- BaseOS- x86_64/ BaseOS
gpgcheck=0
enabled=1
systemctl disable -- now firewalld
systemctl enable -- now httpd
mkdir / var / www/ html/ rhel8
umount / dev/ sr0
mount / dev/ sr0 / var / www/ html/ westos