1、自建yum仓库,分别为网络源和本地源
(1), 在互联网上找到yum源网址,并把版本号和位数改为变量来增加通用性
https://mirrors.cloud.tencent.com/centos/$releasever/BaseOS/$basearch/os/
https://repo.huaweicloud.com/centos/$releasever/BaseOS/$basearch/os/
https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
(2), 执行rpm -q autofs || yum -y install autofs
systemctl enable --now autofs
ls /misc/cd 开启光盘并访问,挂载光盘后才能使用本地yum源
(3), 在/etc/yum.repos.d文件夹下创建一个新的文件夹,并把当前文件夹内的所有文件移动到新建的文件夹内
mkdir dir mv *.repo dir
(4), 在当前目录下创建一个以 任意名字.repo结尾的仓库配置文件 , 一个repo文件能创建多个仓库
vim base.repo
[AppStream] #ID
name=AppStream #描述
baseurl=file:///misc/cd/AppStream #地址
https://mirrors.cloud.tencent.com/centos/$releasever/BaseOS/$basearch/os/
https://repo.huaweicloud.com/centos/$releasever/BaseOS/$basearch/os/
https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=0 #检测
[extras]
name=extras
baseurl=https://mirrors.aliyun.com/centos/$releasever/extras/$basearch/os/
https://repo.huaweicloud.com/centos/$releasever/extras/$basearch/os/
https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/os/
gpgcheck=0
[epel]
name=EPEL
baseurl=https://mirrors.cloud.tencent.com/epel/$releasever/Everything/$basearch/
https://mirrors.huaweicloud.com/epel/$releasever/Everything/$basearch/
https://mirrors.aliyun.com/epel/$releasever/Everything/$basearch/
gpgcheck=0
注意网址对齐,centos8需要配两个库AppStream和BaseOS,centos7只需要配一个BaseOS
2、编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交。
答: (1)wget https://dlcdn.apache.org//httpd/httpd-2.4.52.tar.gz
(2)mv httpd-2.4.52.tar.gz /usr/local/src
cd /usr/local/src
tar xvf httpd-2.4.52.tar.gz
cd httpd-2.4.52
(3)./config.nice --prefix=/apps/http2.4 执行此命令后报错:checking for APR... no
yum -y install apr-devel
./config.nice --prefix=/apps/http2.4 继续执行此命令后报错:checking for APR-util... no
yum -y install apr-util-devel
./config.nice --prefix=/apps/http2.4 继续执行此命令后报错:checking for pcre-config... false
yum -y install pcre-devel
(4) make 执行此命令报错:error: /usr/lib/rpm/redhat/redhat-hardened-ld
yum provides /usr/lib/rpm/redhat/redhat-hardened-ld
yum -y install redhat-rpm-config-125-1.el8.noarch
make
(5) make install
(6) cat INSTALL 查看帮助文件
echo 'PATH=/appshttp2.4/bin/:$PATH' > /etc/profile.d/http2.4.sh
. /etc/profile.d/http2.4.sh
apachectl start
3、利用sed 取出ifconfig命令中本机的IPv4地址
答: ifconfig |sed -nr '2s/.*inet ([0-9.]+) netmask.*/\1/p' 注意空格
4、删除/etc/fstab文件中所有以#开头,后面至少跟一个空白字符的行的行首的#和空白字符
答: sed -i '/^#/d' /etc/fstab
5、处理/etc/fstab路径,使用sed命令取出其目录名和基名
答:echo /etc/fstab | sed -nr 's#^(.*)/([^/]+)/?$#\1#p'
echo /etc/fstab | sed -nr 's#^(.*)/([^/]+)/?$#\2#p'
6、列出ubuntu软件管理工具apt的一些用法(*总结)
答:apt update 索引更新
apt -y install xxx 安装软件
apt purge xxx 卸载包并卸载配置文件
apt rvmove xxx 卸载包保留配置文件
apt-file search -x '/sc$' 开启正则表达式查找以sc结尾的包 (类似centos的yum provides)
apt show xxx 显示包的详细信息