1、自建yum仓库,分别为网络源和本地源
[root@dingchao ~]# cat /etc/yum.repos.d/tunxun.repo [tenxun] name=tunweb baseurl=https://mirrors.cloud.tencent.com/centos/$releasever/os/$basearch/ enable=1 gpgcheck=0 [root@dingchao ~]# cat /etc/yum.repos.d/iso.repo [iso] name=local-iso baseurl=file:///misc/cd enable=1 gpgcheck=0
2、编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交。
[root@dingchao ~]# tar xvf httpd-2.4.46.tar.gz [root@dingchao ~]# cd httpd-2.4.46 [root@localhost httpd-2.4.46]#./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util [root@localhost httpd-2.4.46]#make & make install [root@localhost httpd-2.4.46]#echo 'PATH=/usr/local/httpd/bin:$PATH' > /etc/profile.d/httpd2.46.sh [root@localhost httpd-2.4.46]#source /etc/profile.d/httpd2.46.sh [root@localhost httpd-2.4.46]#apachectl
3、利用sed 取出ifconfig命令中本机的IPv4地址
[root@dingchao ~]# ifconfig eth0 | sed -rn '2s/^.*inet//p'| sed -rn 's/netmask.*//p' 掐头去尾 192.168.1.48 [root@dingchao ~]# ifconfig eth0 | sed -rn '2s/(inet )([0-9].*)(netmask.*)/\2/p' 直接替换 192.168.1.48
4、删除/etc/fstab文件中所有以#开头,后面至少跟一个空白字符的行的行首的#和空白字符
[root@dingchao ~]# sed -rin 's/(^# )//' /etc/fstab [root@dingchao ~]# cat /etc/fstab # /etc/fstab Created by anaconda on Fri Mar 12 10:15:50 2021 # Accessible filesystems, by reference, are maintained under '/dev/disk' See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/centos-root / xfs defaults 0 0 UUID=6ee4ae05-bbad-4a78-8859-420f5c83538d /boot xfs defaults 0 0 /dev/mapper/centos-home /home xfs defaults 0 0 /dev/mapper/centos-swap swap swap defaults 0 0
5、处理/etc/fstab路径,使用sed命令取出其目录名和基名
[root@dingchao ~]# echo "/etc/fstab" | sed -rn 's@^/(.*)/(.*)$@\1@p' etc [root@dingchao ~]# echo "/etc/fstab" | sed -rn 's@^/(.*)/(.*)$@\2@p' fstab