Ctrl+d # 用ctrl+d既可以执行配置,也可以退出at> 模式
1.at 配置在5小时后,将 “This is a at task” 写入 root家目录中的at_test文件中
[root@localhost ~]# at now +5hour
warning: commands will be executed using /bin/sh
at> vim /
at> echo "This is a at task">>/root/home/at_test
at> <EOT>
job 7 at Sun Nov 28 01:23:00 2021
2.crontab配置,每周六,周日 9点半,14点 提醒我上RHCE课 写入root家目录中的cron_test文件中
[root@localhost ~]# crontab
30 9, * * 6-7 echo "提醒我上RHCE课 ">>/root/home/cron_test
0 14, * * 6-7 echo "提醒我上RHCE课 ">>/root/home/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