1.at 配置在5小时后,将 "This is a at task" 写入 root家目录中的at_test文件中
作业1
[root@localhost ~]# at now + 5 hours
warning: commands will be executed using /bin/sh
at> echo"This is a at task">/root/at_test
at> <EOT>
[root@localhost ~]# atq
4 Sat Nov 27 11:17:00 2021 a root
2.crontab配置,每周六,周日 9点半,14点 提醒我上RHCE课 写入root家目录中的cron_test文件中
作业2:
[root@localhost etc]# crontab -e
30 9 * * 6-7 root ehco"记得上RHCE课">>/root/cron_test
0 14 * * 6-7 root echo"记得上RHCE课">>/root/cron_test
3.安装httpd,并将访问apache服务器的首页修改为hello.html, 且内容为: "My Home Page is hello"
第三题
[root@localhost yum.repos.d]# wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum makecache
[root@localhost yum.repos.d]# yum intall httpd -y
[root@localhost yum.repos.d]# rpm -ql httpd
[root@localhost yum.repos.d]# systemctl stop firewalld
[root@localhost yum.repos.d]# setenforce 0
[root@localhost yum.repos.d]# cd /var/www/html
[root@localhost html]# vim hello.html
"My Home Page is hello"
[root@localhost html]# cd /etc/httpd/conf.d
[root@localhost conf.d]# ls
autoindex.conf host.conf README userdir.conf welcome.conf
[root@localhost conf.d]# vim welcome.conf
修改为Alias /.noindex.html /usr/share/httpd/noindex/hello.html
[root@localhost html]# cd /etc/httpd/conf
[root@localhost conf]# vim httpd.conf
DirectoryIndex hello.html
[root@localhost conf]# systemctl restart httpd
4.虚拟主机:虚拟两台主机ip为100,200, 对应访问目录:/www/ip/100, /www/ip/200,并创建首页文件index.html
[root@localhost ~]#nmcli connection modify eno160 +ipv4.addresses 192.168.126.100/24 ipv4.gateway 192.168.126.1 ipv4.method manual connection.autoconnect yes
[root@localhost ~]# nmcli connection modify eno160 +ipv4.addresses 192.168.126.200/24
[root@localhost ~]# nmcli connection up eno160
[root@localhost ~]# mkdir -pv /www/ip/{100,200}
[root@localhost ~]# echo this is 100 > /www/ip/100/index.html
[root@localhost ~]# echo this is 200 > /www/ip/200/index.html
[root@server html]# setenforce 0
[root@server html]# getenforce
[root@localhost ~]# vim /etc/httpd/conf.d/host.conf
<Directory "/www/ip">
AllowOverride None
Require all granted
</Directory>
#Listen 80
<VirtualHost 192.168.220.100:80>
DocumentRoot /www/ip/100
ServerName 192.168.220.100
</VirtualHost>
#Listen 80
<VirtualHost 192.168.220.200:80>
DocumentRoot /www/ip/200
ServerName 192.168.220.200
</VirtualHost>
[root@localhost conf.d]# systemctl restart httpd