`[root@centos ~]# yum info httpd
上次元数据过期检查:0:19:34 前,执行于 2022年01月29日 星期六 18时00分59秒。
已安装的软件包
名称 : httpd
版本 : 2.4.37
发布 : 43.module_el8.5.0+1022+b541f3b1
架构 : x86_64
大小 : 4.3 M
源 : httpd-2.4.37-43.module_el8.5.0+1022+b541f3b1.src.rpm
仓库 : @System
来自仓库 : appstream
概况 : Apache HTTP Server
URL : https://httpd.apache.org/
协议 : ASL 2.0
描述 : The Apache HTTP Server is a powerful, efficient, and extensible
: web server.
[root@centos ~]# wget https://dlcdn.apache.org//httpd/httpd-2.4.52.tar.bz2
--2022-01-29 18:30:58-- https://dlcdn.apache.org//httpd/httpd-2.4.52.tar.bz2
正在解析主机 dlcdn.apache.org (dlcdn.apache.org)... 151.101.2.132, 2a04:4e42::644
正在连接 dlcdn.apache.org (dlcdn.apache.org)|151.101.2.132|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:7439184 (7.1M) [application/x-bzip2]
正在保存至: “httpd-2.4.52.tar.bz2”
httpd-2.4.52.tar.bz2 100%[======================================================>] 7.09M 2.16MB/s 用时 3.3s
2022-01-29 18:31:02 (2.16 MB/s) - 已保存 “httpd-2.4.52.tar.bz2” [7439184/7439184])
[root@centos ~]# ls
1.txt 视频 下载 anaconda-ks.cfg disk.sh fileTtFMj run.sh
公共 图片 音乐 check_score.sh download.cgi httpd-2.4.52.tar.bz2 select.sh
模板 文档 桌面 check_score.txt download.cgi.1 initial-setup-ks.cfg systeminfo.sh
[root@centos ~]# mv httpd-2.4.52.tar.bz2 /usr/local/src
[root@centos ~]# ls
1.txt 模板 图片 下载 桌面 check_score.sh disk.sh download.cgi.1 initial-setup-ks.cfg select.sh
公共 视频 文档 音乐 anaconda-ks.cfg check_score.txt download.cgi fileTtFMj run.sh systeminfo.sh
[root@centos ~]# cd /usr/local/src
[root@centos src]# ls
httpd-2.4.52.tar.bz2
[root@centos src]# tar xvf httpd-2.4.52.tar.bz2 #进行解压
[root@centos src]# ls
httpd-2.4.52 httpd-2.4.52.tar.bz2
[root@centos src]# cd httpd-2.4.52/
[root@centos httpd-2.4.52]# ls
ABOUT_APACHE build CMakeLists.txt httpd.dep InstallBin.dsp Makefile.in README srclib
acinclude.m4 BuildAll.dsp config.layout httpd.dsp LAYOUT Makefile.win README.CHANGES support
Apache-apr2.dsw BuildBin.dsp configure httpd.mak libhttpd.dep modules README.cmake test
Apache.dsw buildconf configure.in httpd.spec libhttpd.dsp NOTICE README.platforms VERSIONING
apache_probes.d CHANGES docs include libhttpd.mak NWGNUmakefile ROADMAP
ap.d changes-entries emacs-style INSTALL LICENSE os server
[root@centos httpd-2.4.52]# ./configure --prefix=/apps/httpd --sysconfdir=/etc/httpd --enable-ssl #一定要进入解压后的文件夹里面执行这条命令
--prefix 指定安装路径 --sysconfdir 指定文件放到哪个路径--enable 指定特定属性
[root@centos httpd-2.4.52]# ./configure --prefix=/apps/httpd --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
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found. Please read the documentation.
一般上面报错提示APR 一般需要安装相关的devel后缀包
[root@centos httpd-2.4.52]# yum install apr-devel
然后再重复执行./configure的那条命令,看是否报错
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
[root@centos httpd-2.4.52]# yum install pcre-devel
checking whether to enable mod_ssl... configure: error: mod_ssl has been requested but can not be built due to prerequisite failures
[root@centos httpd-2.4.52]# yum list openssl*
上次元数据过期检查:0:48:20 前,执行于 2022年01月29日 星期六 18时00分59秒。
已安装的软件包
openssl.x86_64 1:1.1.1g-15.el8_3 @anaconda
openssl-libs.x86_64 1:1.1.1g-15.el8_3 @anaconda
openssl-pkcs11.x86_64 0.4.10-2.el8 @anaconda
可安装的软件包
openssl-devel.i686 1:1.1.1g-15.el8_3 BaseOS
openssl-devel.x86_64 1:1.1.1g-15.el8_3 BaseOS
openssl-ibmpkcs11.x86_64 1.0.2-1.el8 BaseOS
openssl-libs.i686 1:1.1.1g-15.el8_3 BaseOS
openssl-perl.x86_64 1:1.1.1g-15.el8_3 BaseOS
openssl-pkcs11.i686 0.4.10-2.el8 BaseOS
openssl3.x86_64 3.0.0-3.el8.1 EPEL
openssl3-devel.x86_64 3.0.0-3.el8.1 EPEL
openssl3-libs.x86_64 3.0.0-3.el8.1 EPEL
[root@centos httpd-2.4.52]# yum install openssl-devel
Server Version: 2.4.52
Install prefix: /apps/httpd
C compiler: gcc
CFLAGS: -pthread
CPPFLAGS: -DLINUX -D_REENTRANT -D_GNU_SOURCE
LDFLAGS:
LIBS:
C preprocessor: gcc -E
[root@centos httpd-2.4.52]# make -j 2
[root@centos httpd-2.4.52]# make install
[root@centos httpd-2.4.52]# ls
ABOUT_APACHE build changes-entries configure httpd.dsp LAYOUT Makefile.in NOTICE README.platforms VERSIONING
acinclude.m4 BuildAll.dsp CMakeLists.txt configure.in httpd.mak libhttpd.dep Makefile.win NWGNUmakefile ROADMAP
Apache-apr2.dsw BuildBin.dsp config.layout docs httpd.spec libhttpd.dsp modules os server
Apache.dsw buildconf config.log emacs-style include libhttpd.mak modules.c README srclib
apache_probes.d buildmark.o config.nice httpd INSTALL LICENSE modules.lo README.CHANGES support
ap.d CHANGES config.status httpd.dep InstallBin.dsp Makefile modules.o README.cmake test
[root@centos httpd-2.4.52]# ll /apps/httpd/bin/
总用量 1384
-rwxr-xr-x 1 root root 85408 1月 29 19:38 ab
-rwxr-xr-x 1 root root 3416 1月 29 18:50 apachectl
-rwxr-xr-x 1 root root 23865 1月 29 18:50 apxs
-rwxr-xr-x 1 root root 17688 1月 29 19:38 checkgid
-rwxr-xr-x 1 root root 8925 1月 29 18:50 dbmmanage
-rw-r--r-- 1 root root 1059 1月 29 18:50 envvars
-rw-r--r-- 1 root root 1059 1月 29 18:50 envvars-std
-rwxr-xr-x 1 root root 25624 1月 29 19:38 fcgistarter
-rwxr-xr-x 1 root root 52768 1月 29 19:38 htcacheclean
-rwxr-xr-x 1 root root 39880 1月 29 19:38 htdbm
-rwxr-xr-x 1 root root 29992 1月 29 19:38 htdigest
-rwxr-xr-x 1 root root 39328 1月 29 19:38 htpasswd
-rwxr-xr-x 1 root root 963176 1月 29 19:38 httpd
-rwxr-xr-x 1 root root 25576 1月 29 19:38 httxt2dbm
-rwxr-xr-x 1 root root 26224 1月 29 19:38 logresolve
-rwxr-xr-x 1 root root 39216 1月 29 19:38 rotatelogs
[root@centos httpd-2.4.52]# /apps/httpd/bin/apachectl
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
[root@centos httpd-2.4.52]# /apps/httpd/bin/apachectl start^C
[root@centos httpd-2.4.52]# echo 'PATH=/apps/httpd/bin/:$PATH' > /etc/profile.d/httpd.sh
[root@centos httpd-2.4.52]# . /etc/profile.d/httpd.sh #启动
[root@centos httpd-2.4.52]# apachectl start
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
`
输入网址正常访问: