1、自建yum仓库,分别为网络源和本地源
1)仓库服务器配置
[root@centos8 ~]#yum -y install httpd
[root@centos8 ~]#systemctl enable --now httpd
[root@centos8 ~]#mkdir /var/www/html/centos/8 -pv
[root@centos8 ~]#mount /dev/sr1 /var/www/html/cenos/8
2)yum客户端配置
[root@centos8 ~]#vim /etc/yum.repos.d/test.repo
[BaseOS]
name=BaseOS
baseurl=http://192.168.203.132/centos/8/BaseOS
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosoffical
[AppStream]
name=AppStream
baseurl=http://192.168.203.132/centos/8/AppStream
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosoffical
#下载相关仓库包和元数据
[root@centos8 ~]#dnf reposync --repoid=epel --download-metadata-p /var/www/html
#下载相关的key文件
[root@repo-server ~]#wget -P /var/www/html/epel/ http://mirrors.aliyun.com/epel.RPM-GPG-KEY-EPEL-8
[root@centos8 ~]#ls /var/www/html/epel/
Packages repodata
[root@centos8 ~]#systemctl start httpd
[root@centos8 ~]#cat /etc/yum.repos.d/test.repo
[BaseOS]
name=BaseOS
baseurl=http://192.168.203.132/centos/8/BaseOS
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosoffical
[AppStream]
name=AppStream
baseurl=http://192.168.203.132/centos/8/AppStream/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosoffical
[epel]
name=epel
baseurl=http://192.168.203.132/epel/
gpgcheck=1
gpgkey=http:// 192.168.203.132/epel/RPM-GPG-KEY-EPEL-8
[root@centos8 ~]#yum repolist
2、编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交。
#安装前准备:关闭防火墙和SELinux
#1 安装相关包
[root@centos8 ~]#dnf install gcc make autoconf apr-devel apr-util-devel pcre-devel openssl-devel redhat-rpm-config
#2 下载并解压缩包
[root@centos8~]#wget https://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.46.tar.bz2
[root@centos8 ~]#tar xvf httpd-2.4.46.tar.bz2 -C /usr/local/src
#3 配置
[root@centos8 ~]#cd /usr/local/src/httpd-2.4.46/
[root@centos8 httpd-2.4.46]#./configure --prefix=/apps/httpd --sysconfdir=/etc/httpd --enable -ssl
#4 编译并安装
[root@centos8 httpd-2.4.46]#make -j 2 && make install
#5 配置环境
[root@centos8 ~]#echo 'PATH=/apps/httpd/bin:$PATH' > /etc/profile.d/httpd.sh
[root@centos8 ~]#. /etc/profile.d/httpd.sh
#6 运行
[root@centos8 ~]#apachectl start
#7 指定用apache用户运行
[root@centos8 ~]#useradd -r -g apache -s /sbin/nologin -d /var/www -c Apache -u 48 apache
[root@centos8 ~]#vim /etc/httpd/httpd.conf
#8 配置生效和验证
[root@centos8 ~]#apachectl restart
#9 查看进程
[root@centos8 ~]#ps aux
#10 用浏览器打开以下地址,看页面It works即可
3、利用sed 取出ifconfig命令中本机的IPv4地址
ifconfig | sed -nr '2s@^[^0-9]+([0-9.]+).*@\1@p'
4、删除/etc/fstab文件中所有以#开头,后面至少跟一个空白字符的行的行首的#和空白字符
sed -nr 's@^#[[:space:]]+(.*)@\1@p' /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 install 安装软件包
apt remove 删除软件包
apt purge 移除软件包及配置文件
apt update 刷新存储库索引
apt upgrade 升级所有可升级的软件包
apt autoremove 自动删除不需要的包
apt full-upgrade 在升级软件包时自动处理依赖关系
apt search 搜索应用程序
apt show 显示安装细节
apt特有的命令
apt list 列出包含条件的包(已安装,可升级等)
apt edit-sources 编辑源列表