第四周学习作业

【第四周学习作业】今日长缨在手,何时缚住苍龙。这篇文章主要讲述第四周学习作业相关的知识,希望能为你提供帮助。
1.自建yum仓库,分别为网络源和本地源  配置网络源:

##备份系统自带的yum源文件
[root@centos84 yum.repos.d]# mkdir ~/yum_bak
[root@centos84 yum.repos.d]# mv* ~/yum_bak

##通过wget命令直接下载阿里云yum源
[root@centos84 yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
--2021-12-12 06:28:20--https://mirrors.aliyun.com/repo/Centos-8.repo
Connecting to 172.30.232.251:3128... connected.
Proxy request sent, awaiting response... 200 OK
Length: 2595 (2.5K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’

/etc/yum.repos.d/CentOS-Base.repo100%[==================================================================================> ]2.53K--.-KB/sin 0s

2021-12-12 06:28:20 (48.6 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2595/2595]
##清理缓存,加载缓存
[root@centos84 yum.repos.d]# yum clean all
[root@centos84 yum.repos.d]# yum makecache
CentOS-8 - Base - mirrors.aliyun.com12 MB/s | 3.5 MB00:00
CentOS-8 - Extras - mirrors.aliyun.com72 kB/s |10 kB00:00
CentOS-8 - AppStream - mirrors.aliyun.com15 MB/s | 8.2 MB00:00
Metadata cache created.
##列出可用的yum源
[root@centos84 ~]# yum repolist
repo idrepo name
AppStreamCentOS-8 - AppStream - mirrors.aliyun.com
baseCentOS-8 - Base - mirrors.aliyun.com
extrasCentOS-8 - Extras - mirrors.aliyun.com

  配置本地源
##挂在光盘到/mnt 下
[root@centos84 ~]# mount /dev/sr0 /mnt
mount: /mnt: WARNING: device write-protected, mounted read-only.
[root@centos84 ~]# vi /etc/yum.repos.d/cl8.repo
[BaseOS]
name=BaseOS
baseurl=file:///mnt/BaseOS
enbale=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

[AppStream]
name=AppStream
baseurl=file:///mnt/AppStream
enable=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[root@centos84 yum.repos.d]# yum clean all
Repository AppStream is listed more than once in the configuration
13 files removed
[root@centos84 yum.repos.d]# yum makecache
Repository AppStream is listed more than once in the configuration
CentOS-8 - Base - mirrors.aliyun.com3.7 MB/s | 3.5 MB00:00
CentOS-8 - Extras - mirrors.aliyun.com39 kB/s |10 kB00:00
CentOS-8 - AppStream - mirrors.aliyun.com20 MB/s | 8.2 MB00:00
BaseOS195 MB/s | 2.5 MB00:00
Metadata cache created.
[root@centos84 yum.repos.d]#
[root@centos84 yum.repos.d]# yum repolist
Repository AppStream is listed more than once in the configuration
repo idrepo name
AppStreamCentOS-8 - AppStream - mirrors.aliyun.com
BaseOSBaseOS
baseCentOS-8 - Base - mirrors.aliyun.com
extrasCentOS-8 - Extras - mirrors.aliyun.com

2、编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交
##使用wget 下载Apache httpd 2.4.51 Released源码包
[root@centos84 data]# wget https://dlcdn.apache.org//httpd/httpd-2.4.51.tar.bz2
--2021-12-12 07:00:42--https://dlcdn.apache.org//httpd/httpd-2.4.51.tar.bz2
Connecting to 172.30.232.251:3128... connected.
Proxy request sent, awaiting response... 200 OK
Length: 7653609 (7.3M) [application/x-bzip2]
Saving to: ‘httpd-2.4.51.tar.bz2’

httpd-2.4.51.tar.bz2100%[==================================================================================> ]7.30M111KB/sin 84s

2021-12-12 07:02:07 (88.6 KB/s) - ‘httpd-2.4.51.tar.bz2’ saved [7653609/7653609]
##安装编译环境依赖包
yum install gcc make autoconf apr-devel apr-util-devel pcre-devel openssl-devel redhat-rpm-config
##临时关闭selinux
[root@centos84 ~]# setenforce 0
##解压httpd 2.4.51
[root@centos84 data]# tar -jxvf httpd-2.4.51.tar.bz2
httpd-2.4.51/
httpd-2.4.51/acinclude.m4
httpd-2.4.51/README.cmake
httpd-2.4.51/INSTALL
……
httpd-2.4.51/test/modules/http2/htdocs/noh2/index.html
httpd-2.4.51/test/modules/http2/htdocs/noh2/alive.json
httpd-2.4.51/test/modules/http2/mod_h2test/mod_h2test.c
httpd-2.4.51/test/modules/http2/mod_h2test/mod_h2test.h
[root@centos84 data]# cd httpd-2.4.51/
##配置
[root@centos84 httpd-2.4.51]# ./configure --prefix=/usr/local/http24 --sysconfdir=/etc/httpd --enable-ssl
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking build system type... x86_64-pc-linux-gnu
……
configure: summary of build options:

Server Version: 2.4.51
Install prefix: /usr/local/http24
C compiler:gcc
CFLAGS:-pthread
CPPFLAGS:-DLINUX -D_REENTRANT -D_GNU_SOURCE
LDFLAGS:
LIBS:
C preprocessor: gcc -E
##编译并发4个任务执行
[root@centos84 httpd-2.4.51]# make -j 4
Making all in srclib
make[1]: Entering directory /data/httpd-2.4.51/srclib
make[1]: Leaving directory /data/httpd-2.4.51/srclib
Making all in os
make[1]: Entering directory /data/httpd-2.4.51/os
Making all in unix

    推荐阅读