1.自建yum仓库,分别为网络源和本地源
[base]
name=CDRom
baseurl=file:///mnt/yum
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[CentOS]
name=CentOS.org
baseurl=http://vault.centos.org/7.4.1708/os/x86_64/
enabled=1
gpgcheck=0
gpgkey=http://vault.centos.org/7.4.1708/os/x86_64/RPM-GPG-KEY-CentOS-7
2.编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交
- 安装依赖包
[root@centos7 data]#yum install gcc openssl-devel pcre-devel apr-devel apr-util-devel -y
- 解压http2.4源码包
[root@centos7 data]#tar -xvf httpd-2.4.25
- 指定http2.4路径
./configure --prefix=/apps/httpd2/
- 编译
[root@centos7 httpd-2.4.25]#make
- 安装
[root@centos7 httpd-2.4.25]#make install
- 启动
[root@centos7 httpd-2.4.25]#/apps/httpd24/bin/apachectl start
3.利用sed 取出ifconfig命令中本机的IPv4地址
ifconfig ens33 | sed -n '/inet /s#\(.*inet \)\(.*\)\( n.*\)#\2#gp'
4.删除/etc/fstab文件中所有以#开头,后面至少跟一个空白字符的行的行首的#和空白字符
cat /etc/fstab |sed -r 's/^#\ ?(.*)/\1/'|sed '/^$/d'
5.处理/etc/fstab路径,使用sed命令取出其目录名和基名
#目录名
echo "/etc/fstab" |sed -r 's#^/(.*)/(.*)#\1#'
#基名
echo "/etc/fstab" |sed -r 's#^/(.*)/(.*)#\2#'