1、自建yum仓库,分别为网络源和本地源
1):安装httpd服务并且启动httpd服务
yum - y install httpd systemctl enabled --now httpd 立即启动并且设置为开机自启动
2): 创建http文件夹,挂载光盘到http文件夹
mkdir -p /var/www/html/centos/{7,8}/os/x86_64
mount /dev/sr0 /var/www/centos/8/os/x86_64
mount /dev/sr0 /var/www/centos/7/os/x86_64
3):修改yum域
cd /etc/yum.repo/
mkdir bak; mv *.repo bak;
touch server.repo
vim server.repo
[AppStream]
name=AppStream
baseurl=file:///var/www/html/Centos/8/os/x86_64/AppStream
baseurl=https://mirrors.cloud.tencent.com/centos/8/AppStream/x86_64/os/
https://repo.huaweicloud.com/centos/8/AppStream/x86_64/os/
gpgcheck=0
[Baseos]
name=Baseos
baseurl=file:///var/www/html/Centos/8/os/x86_64/BaseOS
baseurl=https://mirrors.cloud.tencent.com/centos/8/BaseOS/x86_64/os/
https://repo.huaweicloud.com/centos/8/BaseOS/x86_64/os/
gpgcheck=1
gpgkey=/etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[epel]
name=EPEL
baseurl=https://mirrors.cloud.tencent.com/epel/8/Everything/x86_64/
gpgcheck=0
enadled=1
[extras]
name=extras
baseurl=https://mirrors.cloud.tencent.com/centos/8/extras/x86_64/os/
gpgcheck=0
enable=1
2、编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交。
编译步骤脚本文件
wget https://dlcdn.apache.org//httpd/httpd-2.4.51.tar.gz || { echo "donload error";exit; }
tar xvf httpd-2.4.51.tar.gz -C /usr/local/src
cd /usr/local/src/httpd-2.4.51/
yum -y install apr-devel apr-util-devel gcc pcre-devel openssl-devel redhat-rpm-config-125-1.el8.noarch pcre-devel make
./configure --prefix=/apps/httpd --sysconfdir=/etc/httpd --enable-ssl
make -j 2
make install
groupadd -r -g 88 apache
useradd -r -u 88 -g apache -s /sbin/nologin -d /var/www apache
sed -ri -e '/^User/c User apache' -e '/^Group/c Group apache' /etc/httpd/httpd.conf
echo 'PATH=/apps/httpd/bin:$PATH' > /etc/profile.d/http.sh
source /etc/profile.d/http.sh
apachectl start
运行图片:
3、利用sed 取出ifconfig命令中本机的IPv4地址
ifconfig|sed -nr"2s/[^0-9]+([0-9.]+).*/\1/p"
4、删除/etc/fstab文件中所有以#开头,后面至少跟一个空白字符的行的行首的#和空白字符
sed -i.bak '/^# */d;/^$/d' /etc/fstab
5、处理/etc/fstab路径,使用sed命令取出其目录名和基名
目录名:
echo "/etc/fstab" |sed -r 's#(^/.*/)([^/]+/?)#\1#'
基名:
echo "/etc/fstab" |sed -r 's#(^/.*/)([^/]+/?)#\2#'
6、列出ubuntu软件管理工具apt的一些用法(自由总结)
install 安装
remove 卸载 不会删除配置文件
updata 更新
show 显示细节 apt -show 已安装的包 可以查看详细的包
purge 删除所有包和配置文件