httpd源码安装

httpd源码安装

源码安装三部曲:
./configure
make
make install

  1. 下载并解压httpd和其依赖包
[root@localhost ~]# ls
anaconda-ks.cfg  httpd-2.4.48.tar.gz
[root@localhost ~]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.7.0.tar.gz
--2021-07-11 17:15:17--  https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.7.0.tar.gz
正在解析主机 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, 2402:f000:1:408:8100::1
正在连接 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1093896 (1.0M) [application/octet-stream]
正在保存至: “apr-1.7.0.tar.gz”

100%[===========================================>] 1,093,896   2.45MB/s 用时 0.4s   

2021-07-11 17:15:18 (2.45 MB/s) - 已保存 “apr-1.7.0.tar.gz” [1093896/1093896])

[root@localhost ~]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
--2021-07-11 17:15:31--  https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
正在解析主机 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, 2402:f000:1:408:8100::1
正在连接 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:554301 (541K) [application/octet-stream]
正在保存至: “apr-util-1.6.1.tar.gz”

100%[===========================================>] 554,301     2.40MB/s 用时 0.2s   

2021-07-11 17:15:32 (2.40 MB/s) - 已保存 “apr-util-1.6.1.tar.gz” [554301/554301])

[root@localhost ~]# ls
anaconda-ks.cfg  apr-1.7.0.tar.gz  apr-util-1.6.1.tar.gz  httpd-2.4.48.tar.gz
[root@localhost ~]# tar xf apr-1.7.0.tar.gz 
[root@localhost ~]# tar xf apr-util-1.6.1.tar.gz 
[root@localhost ~]# tar xf httpd-2.4.48.tar.gz 
[root@localhost ~]# ls
anaconda-ks.cfg  apr-1.7.0.tar.gz  apr-util-1.6.1.tar.gz  httpd-2.4.48.tar.gz
apr-1.7.0        apr-util-1.6.1    httpd-2.4.48

  1. 安装apr-1.7.0
    ./configure
    编辑configure,注释或删除 $ R M " RM " RM"cfgfile
    cfgfile=${ofile}T
    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
#        cfgfile=${ofile}T
    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
#    $RM "$cfgfile
[root@localhost apr-1.7.0]# ./configure --prefix=/usr/local/apr
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
Configuring APR library
Platform: x86_64-pc-linux-gnu
checking for working mkdir -p... yes
APR Version: 1.7.0
checking for chosen layout... apr
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/root/apr-1.7.0':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details

解决报错

[root@localhost apr-1.7.0]# dnf -y install gcc gcc-c++
-bash: dnf: 未找到命令
[root@localhost apr-1.7.0]# yum -y install gcc gcc-c++
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.sjtu.edu.cn
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 gcc.x86_64.0.4.8.5-44.el7 将被 安装
--> 正在处理依赖关系 libgomp = 4.8.5-44.el7,它被软件包 gcc-4.8.5-44.el7.x86_64 需要
--> 正在处理依赖关系 cpp = 4.8.5-44.el7,它被软件包 gcc-4.8.5-44.el7.x86_64 需要
--> 正在处理依赖关系 libgcc >= 4.8.5-44.el7,它被软件包 gcc-4.8.5-44.el7.x86_64 需要
--> 正在处理依赖关系 glibc-devel >= 2.2.90-12,它被软件包 gcc-4.8.5-44.el7.x86_64 需要
--> 正在处理依赖关系 libmpfr.so.4()(64bit),它被软件包 gcc-4.8.5-44.el7.x86_64 需要
--> 正在处理依赖关系 libmpc.so.3()(64bit),它被软件包 gcc-4.8.5-44.el7.x86_64 需要
---> 软件包 gcc-c++.x86_64.0.4.8.5-44.el7 将被 安装
--> 正在处理依赖关系 libstdc++-devel = 4.8.5-44.el7,它被软件包 gcc-c++-4.8.5-44.el7.x86_64 需要
--> 正在处理依赖关系 libstdc++ = 4.8.5-44.el7,它被软件包 gcc-c++-4.8.5-44.el7.x86_64 需要
--> 正在检查事务
---> 软件包 cpp.x86_64.0.4.8.5-44.el7 将被 安装
---> 软件包 glibc-devel.x86_64.0.2.17-324.el7_9 将被 安装
--> 正在处理依赖关系 glibc-headers = 2.17-324.el7_9,它被软件包 glibc-devel-2.17-324.el7_9.x86_64 需要
--> 正在处理依赖关系 glibc = 2.17-324.el7_9,它被软件包 glibc-devel-2.17-324.el7_9.x86_64 需要
--> 正在处理依赖关系 glibc-headers,它被软件包 glibc-devel-2.17-324.el7_9.x86_64 需要
---> 软件包 libgcc.x86_64.0.4.8.5-28.el7 将被 升级
---> 软件包 libgcc.x86_64.0.4.8.5-44.el7 将被 更新
---> 软件包 libgomp.x86_64.0.4.8.5-28.el7 将被 升级
---> 软件包 libgomp.x86_64.0.4.8.5-44.el7 将被 更新
---> 软件包 libmpc.x86_64.0.1.0.1-3.el7 将被 安装
---> 软件包 libstdc++.x86_64.0.4.8.5-28.el7 将被 升级
---> 软件包 libstdc++.x86_64.0.4.8.5-44.el7 将被 更新
---> 软件包 libstdc++-devel.x86_64.0.4.8.5-44.el7 将被 安装
---> 软件包 mpfr.x86_64.0.3.1.1-4.el7 将被 安装
--> 正在检查事务
---> 软件包 glibc.x86_64.0.2.17-222.el7 将被 升级
--> 正在处理依赖关系 glibc = 2.17-222.el7,它被软件包 glibc-common-2.17-222.el7.x86_64 需要
---> 软件包 glibc.x86_64.0.2.17-324.el7_9 将被 更新
---> 软件包 glibc-headers.x86_64.0.2.17-324.el7_9 将被 安装
--> 正在处理依赖关系 kernel-headers >= 2.2.1,它被软件包 glibc-headers-2.17-324.el7_9.x86_64 需要
--> 正在处理依赖关系 kernel-headers,它被软件包 glibc-headers-2.17-324.el7_9.x86_64 需要
--> 正在检查事务
---> 软件包 glibc-common.x86_64.0.2.17-222.el7 将被 升级
---> 软件包 glibc-common.x86_64.0.2.17-324.el7_9 将被 更新
---> 软件包 kernel-headers.x86_64.0.3.10.0-1160.31.1.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

=====================================================================================
 Package               架构         版本                         源             大小
=====================================================================================
正在安装:
 gcc                   x86_64       4.8.5-44.el7                 base           16 M
 gcc-c++               x86_64       4.8.5-44.el7                 base          7.2 M
为依赖而安装:
 cpp                   x86_64       4.8.5-44.el7                 base          5.9 M
 glibc-devel           x86_64       2.17-324.el7_9               updates       1.1 M
 glibc-headers         x86_64       2.17-324.el7_9               updates       691 k
 kernel-headers        x86_64       3.10.0-1160.31.1.el7         updates       9.0 M
 libmpc                x86_64       1.0.1-3.el7                  base           51 k
 libstdc++-devel       x86_64       4.8.5-44.el7                 base          1.5 M
 mpfr                  x86_64       3.1.1-4.el7                  base          203 k
为依赖而更新:
 glibc                 x86_64       2.17-324.el7_9               updates       3.6 M
 glibc-common          x86_64       2.17-324.el7_9               updates        12 M
 libgcc                x86_64       4.8.5-44.el7                 base          103 k
 libgomp               x86_64       4.8.5-44.el7                 base          159 k
 libstdc++             x86_64       4.8.5-44.el7                 base          306 k

事务概要
=====================================================================================
安装  2 软件包 (+7 依赖软件包)
升级           ( 5 依赖软件包)

总下载量:58 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/14): glibc-2.17-324.el7_9.x86_64.rpm                       | 3.6 MB  00:00:04     
(2/14): glibc-devel-2.17-324.el7_9.x86_64.rpm                 | 1.1 MB  00:00:01     
(3/14): glibc-headers-2.17-324.el7_9.x86_64.rpm               | 691 kB  00:00:00     
(4/14): cpp-4.8.5-44.el7.x86_64.rpm                           | 5.9 MB  00:00:06     
(5/14): libgcc-4.8.5-44.el7.x86_64.rpm                        | 103 kB  00:00:00     
(6/14): libgomp-4.8.5-44.el7.x86_64.rpm                       | 159 kB  00:00:00     
(7/14): libmpc-1.0.1-3.el7.x86_64.rpm                         |  51 kB  00:00:00     
(8/14): libstdc++-4.8.5-44.el7.x86_64.rpm                     | 306 kB  00:00:01     
(9/14): libstdc++-devel-4.8.5-44.el7.x86_64.rpm               | 1.5 MB  00:00:01     
(10/14): mpfr-3.1.1-4.el7.x86_64.rpm                          | 203 kB  00:00:00     
(11/14): kernel-headers-3.10.0-1160.31.1.el7.x86_64.rpm       | 9.0 MB  00:00:05     
(12/14): gcc-c++-4.8.5-44.el7.x86_64.rpm                      | 7.2 MB  00:00:11     
(13/14): glibc-common-2.17-324.el7_9.x86_64.rpm               |  12 MB  00:00:11     
(14/14): gcc-4.8.5-44.el7.x86_64.rpm                          |  16 MB  00:00:26     
-------------------------------------------------------------------------------------
总计                                                    2.2 MB/s |  58 MB  00:26     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : libgcc-4.8.5-44.el7.x86_64                                      1/19 
  正在更新    : glibc-common-2.17-324.el7_9.x86_64                              2/19 
  正在更新    : glibc-2.17-324.el7_9.x86_64                                     3/19 
warning: /etc/nsswitch.conf created as /etc/nsswitch.conf.rpmnew
  正在安装    : mpfr-3.1.1-4.el7.x86_64                                         4/19 
  正在安装    : libmpc-1.0.1-3.el7.x86_64                                       5/19 
  正在更新    : libstdc++-4.8.5-44.el7.x86_64                                   6/19 
  正在安装    : libstdc++-devel-4.8.5-44.el7.x86_64                             7/19 
  正在安装    : cpp-4.8.5-44.el7.x86_64                                         8/19 
  正在更新    : libgomp-4.8.5-44.el7.x86_64                                     9/19 
  正在安装    : kernel-headers-3.10.0-1160.31.1.el7.x86_64                     10/19 
  正在安装    : glibc-headers-2.17-324.el7_9.x86_64                            11/19 
  正在安装    : glibc-devel-2.17-324.el7_9.x86_64                              12/19 
  正在安装    : gcc-4.8.5-44.el7.x86_64                                        13/19 
  正在安装    : gcc-c++-4.8.5-44.el7.x86_64                                    14/19 
  清理        : libstdc++-4.8.5-28.el7.x86_64                                  15/19 
  清理        : libgomp-4.8.5-28.el7.x86_64                                    16/19 
  清理        : glibc-common-2.17-222.el7.x86_64                               17/19 
  清理        : glibc-2.17-222.el7.x86_64                                      18/19 
  清理        : libgcc-4.8.5-28.el7.x86_64                                     19/19 
  验证中      : kernel-headers-3.10.0-1160.31.1.el7.x86_64                      1/19 
  验证中      : gcc-c++-4.8.5-44.el7.x86_64                                     2/19 
  验证中      : libstdc++-4.8.5-44.el7.x86_64                                   3/19 
  验证中      : mpfr-3.1.1-4.el7.x86_64                                         4/19 
  验证中      : glibc-headers-2.17-324.el7_9.x86_64                             5/19 
  验证中      : cpp-4.8.5-44.el7.x86_64                                         6/19 
  验证中      : glibc-devel-2.17-324.el7_9.x86_64                               7/19 
  验证中      : gcc-4.8.5-44.el7.x86_64                                         8/19 
  验证中      : glibc-2.17-324.el7_9.x86_64                                     9/19 
  验证中      : libstdc++-devel-4.8.5-44.el7.x86_64                            10/19 
  验证中      : libmpc-1.0.1-3.el7.x86_64                                      11/19 
  验证中      : glibc-common-2.17-324.el7_9.x86_64                             12/19 
  验证中      : libgcc-4.8.5-44.el7.x86_64                                     13/19 
  验证中      : libgomp-4.8.5-44.el7.x86_64                                    14/19 
  验证中      : libstdc++-4.8.5-28.el7.x86_64                                  15/19 
  验证中      : libgomp-4.8.5-28.el7.x86_64                                    16/19 
  验证中      : glibc-common-2.17-222.el7.x86_64                               17/19 
  验证中      : glibc-2.17-222.el7.x86_64                                      18/19 
  验证中      : libgcc-4.8.5-28.el7.x86_64                                     19/19 

已安装:
  gcc.x86_64 0:4.8.5-44.el7               gcc-c++.x86_64 0:4.8.5-44.el7              

作为依赖被安装:
  cpp.x86_64 0:4.8.5-44.el7             glibc-devel.x86_64 0:2.17-324.el7_9         
  glibc-headers.x86_64 0:2.17-324.el7_9 kernel-headers.x86_64 0:3.10.0-1160.31.1.el7
  libmpc.x86_64 0:1.0.1-3.el7           libstdc++-devel.x86_64 0:4.8.5-44.el7       
  mpfr.x86_64 0:3.1.1-4.el7            

作为依赖被升级:
  glibc.x86_64 0:2.17-324.el7_9          glibc-common.x86_64 0:2.17-324.el7_9       
  libgcc.x86_64 0:4.8.5-44.el7           libgomp.x86_64 0:4.8.5-44.el7              
  libstdc++.x86_64 0:4.8.5-44.el7       

完毕!

执行上一步的命令

[root@localhost apr-1.7.0]# ./configure --prefix=/usr/local/apr
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
Configuring APR library
Platform: x86_64-pc-linux-gnu
checking for working mkdir -p... yes
APR Version: 1.7.0
checking for chosen layout... apr
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a sed that does not truncate output... /usr/bin/sed
Applying APR hints file rules for x86_64-pc-linux-gnu
  setting CPPFLAGS to "-DLINUX -D_REENTRANT -D_GNU_SOURCE"
(Default will be unix)
......
configure: creating ./config.status
config.status: creating Makefile
config.status: creating include/apr.h
config.status: creating build/apr_rules.mk
config.status: creating build/pkg/pkginfo
config.status: creating apr-1-config
config.status: creating apr.pc
config.status: creating test/Makefile
config.status: creating test/internal/Makefile
config.status: creating include/arch/unix/apr_private.h
config.status: executing libtool commands
rm: cannot remove 'libtoolT': No such file or directory
config.status: executing default commands


make

[root@localhost apr-1.7.0]# make
make[1]: 进入目录“/root/apr-1.7.0”
/bin/sh /root/apr-1.7.0/libtool --silent --mode=compile gcc -g -O2 -pthread   -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I./include -I/root/apr-1.7.0/include/arch/unix -I./include/arch/unix -I/root/apr-1.7.0/include/arch/unix -I/root/apr-1.7.0/include -I/root/apr-1.7.0/include/private -I/root/apr-1.7.0/include/private  -o encoding/apr_encode.lo -c encoding/apr_encode.c && touch encoding/apr_encode.lo
/root/apr-1.7.0/build/mkdir.sh tools
/bin/sh /root/apr-1.7.0/libtool --silent --mode=compile gcc -g -O2 -pthread   -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I./include -I/root/apr-1.7.0/include/arch/unix -I./include/arch/unix -I/root/apr-1.7.0/include/arch/unix -I/root/apr-1.7.0/include -I/root/apr-1.7.0/include/private -I/root/apr-1.7.0/include/private  -o tools/gen_test_char.lo -c tools/gen_test_char.c && touch tools/gen_test_char.lo
/bin/sh /root/apr-1.7.0/libtool --silent --mode=link gcc -g -O2 -pthread   -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I./include -I/root/apr-1.7.0/include/arch/unix -I./include/arch/unix -I/root/apr-1.7.0/include/arch/unix -I/root/apr-1.7.0/include -I/root/apr-1.7.0/include/private -I/root/apr-1.7.0/include/private   -no-install    -o tools/gen_test_char tools/gen_test_char.lo    -lrt -lcrypt  -lpthread -ldl
/root/apr-1.7.0/build/mkdir.sh include/private
......
gcc -E -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I./include -I/root/apr-1.7.0/include/arch/unix -I./include/arch/unix -I/root/apr-1.7.0/include/arch/unix -I/root/apr-1.7.0/include -I/root/apr-1.7.0/include/private -I/root/apr-1.7.0/include/private  exports.c | grep "ap_hack_" | sed -e 's/^.*[)]\(.*\);$/\1/' >> apr.exp
gcc -E -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I./include -I/root/apr-1.7.0/include/arch/unix -I./include/arch/unix -I/root/apr-1.7.0/include/arch/unix -I/root/apr-1.7.0/include -I/root/apr-1.7.0/include/private -I/root/apr-1.7.0/include/private  export_vars.c | sed -e 's/^\#[^!]*//' | sed -e '/^$/d' >> apr.exp
sed 's,^\(location=\).*$,\1installed,' < apr-1-config > apr-config.out
sed -e 's,^\(apr_build.*=\).*$,\1/usr/local/apr/build-1,' -e 's,^\(top_build.*=\).*$,\1/usr/local/apr/build-1,' < build/apr_rules.mk > build/apr_rules.out
make[1]: 离开目录“/root/apr-1.7.0”

make install

[root@localhost apr-1.7.0]# make install
make[1]: 进入目录“/root/apr-1.7.0”
make[1]: 对“local-all”无需做任何事。
make[1]: 离开目录“/root/apr-1.7.0/root/apr-1.7.0/build/mkdir.sh /usr/local/apr/lib /usr/local/apr/bin /usr/local/apr/build-1 \
             /usr/local/apr/lib/pkgconfig /usr/local/apr/include/apr-1
/usr/bin/install -c -m 644 /root/apr-1.7.0/include/apr.h /usr/local/apr/include/apr-1
for f in /root/apr-1.7.0/include/apr_*.h; do \
    /usr/bin/install -c -m 644 ${f} /usr/local/apr/include/apr-1; \
done
/bin/sh /root/apr-1.7.0/libtool --mode=install /usr/bin/install -c -m 755 libapr-1.la /usr/local/apr/lib
libtool: install: /usr/bin/install -c -m 755 .libs/libapr-1.so.0.7.0 /usr/local/apr/lib/libapr-1.so.0.7.0
libtool: install: (cd /usr/local/apr/lib && { ln -s -f libapr-1.so.0.7.0 libapr-1.so.0 || { rm -f libapr-1.so.0 && ln -s libapr-1.so.0.7.0 libapr-1.so.0; }; })
libtool: install: (cd /usr/local/apr/lib && { ln -s -f libapr-1.so.0.7.0 libapr-1.so || { rm -f libapr-1.so && ln -s libapr-1.so.0.7.0 libapr-1.so; }; })
libtool: install: /usr/bin/install -c -m 755 .libs/libapr-1.lai /usr/local/apr/lib/libapr-1.la
libtool: install: /usr/bin/install -c -m 755 .libs/libapr-1.a /usr/local/apr/lib/libapr-1.a
libtool: install: chmod 644 /usr/local/apr/lib/libapr-1.a
libtool: install: ranlib /usr/local/apr/lib/libapr-1.a
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin" ldconfig -n /usr/local/apr/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/apr/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the 'LD_RUN_PATH' environment variable
     during linking
   - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to '/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
/usr/bin/install -c -m 644 apr.exp /usr/local/apr/lib/apr.exp
/usr/bin/install -c -m 644 apr.pc /usr/local/apr/lib/pkgconfig/apr-1.pc
for f in libtool shlibtool; do \
    if test -f ${f}; then /usr/bin/install -c -m 755 ${f} /usr/local/apr/build-1; fi; \
done
/usr/bin/install -c -m 755 /root/apr-1.7.0/build/mkdir.sh /usr/local/apr/build-1
for f in make_exports.awk make_var_export.awk; do \
    /usr/bin/install -c -m 644 /root/apr-1.7.0/build/${f} /usr/local/apr/build-1; \
done
/usr/bin/install -c -m 644 build/apr_rules.out /usr/local/apr/build-1/apr_rules.mk
/usr/bin/install -c -m 755 apr-config.out /usr/local/apr/bin/apr-1-config

  1. 安装apr-util-1.6.1
    ./configure
[root@localhost apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
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
checking for a BSD-compatible install... /usr/bin/install -c
checking for working mkdir -p... yes
APR-util Version: 1.6.1
checking for chosen layout... apr-util
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
......
config.status: creating apu-1-config
config.status: creating include/private/apu_select_dbm.h
config.status: creating include/apr_ldap.h
config.status: creating include/apu.h
config.status: creating include/apu_want.h
config.status: creating test/Makefile
config.status: creating include/private/apu_config.h
config.status: executing default commands
[root@localhost apr-util-1.6.1]#

make

[root@localhost apr-util-1.6.1]# make
make[1]: 进入目录“/root/apr-util-1.6.1/bin/sh /usr/local/apr/build-1/libtool --silent --mode=compile gcc -g -O2 -pthread   -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I/root/apr-util-1.6.1/include -I/root/apr-util-1.6.1/include/private  -I/usr/local/apr/include/apr-1    -o buckets/apr_brigade.lo -c buckets/apr_brigade.c && touch buckets/apr_brigade.lo
/bin/sh /usr/local/apr/build-1/libtool --silent --mode=compile gcc -g -O2 -pthread   -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I/root/apr-util-1.6.1/include -I/root/apr-util-1.6.1/include/private  -I/usr/local/apr/include/apr-1    -o buckets/apr_buckets.lo -c buckets/apr_buckets.c && touch buckets/apr_buckets.lo
......
/bin/sh /usr/local/apr/build-1/libtool --silent --mode=compile gcc -g -O2 -pthread   -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I/root/apr-util-1.6.1/include -I/root/apr-util-1.6.1/include/private  -I/usr/local/apr/include/apr-1    -o xml/apr_xml.lo -c xml/apr_xml.c && touch xml/apr_xml.lo
xml/apr_xml.c:35:19: 致命错误:expat.h:没有那个文件或目录
 #include <expat.h>
                   ^
编译中断。
make[1]: *** [xml/apr_xml.lo] 错误 1
make[1]: 离开目录“/root/apr-util-1.6.1”
make: *** [all-recursive] 错误 1

解决报错

[root@localhost apr-util-1.6.1]# yum list all | grep expat
expat.x86_64                                2.1.0-10.el7_3             @anaconda
expat.i686                                  2.1.0-12.el7               base     
expat.x86_64                                2.1.0-12.el7               base     
expat-devel.i686                            2.1.0-12.el7               base     
expat-devel.x86_64                          2.1.0-12.el7               base     
expat-static.i686                           2.1.0-12.el7               base     
expat-static.x86_64                         2.1.0-12.el7               base     
[root@localhost apr-util-1.6.1]# yum install -y expat-devel
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.sjtu.edu.cn
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 expat-devel.x86_64.0.2.1.0-12.el7 将被 安装
--> 正在处理依赖关系 expat = 2.1.0-12.el7,它被软件包 expat-devel-2.1.0-12.el7.x86_64 需要

执行上一步命令

[root@localhost apr-util-1.6.1]# make clean
Making clean in test
make[1]: 进入目录“/root/apr-util-1.6.1/test”
make[2]: 进入目录“/root/apr-util-1.6.1/test”
rm -f ./*.o ./*.lo ./*.a ./*.la ./*.so ./*.obj
rm -rf ./.libs
rm -f manyfile.bin testfile.txt data/sqlite*.db dbd testall
rm -rf autom4te.cache
make[2]: 离开目录“/root/apr-util-1.6.1/test”
make[1]: 离开目录“/root/apr-util-1.6.1/test”
make[1]: 进入目录“/root/apr-util-1.6.1”
rm -f ./*.o ./*.lo ./*.a ./*.la ./*.so ./*.obj
rm -rf ./.libs
rm -f xml/*.o xml/*.lo xml/*.a xml/*.la xml/*.so xml/*.obj

[root@localhost apr-util-1.6.1]# make
make[1]: 进入目录“/root/apr-util-1.6.1”
/bin/sh /usr/local/apr/build-1/libtool --silent --mode=compile gcc -g -O2 -pthread   -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I/root/apr-util-1.6.1/include -I/root/apr-util-1.6.1/include/private  -I/usr/local/apr/include/apr-1    -o buckets/apr_brigade.lo -c buckets/apr_brigade.c && touch buckets/apr_brigade.lo

.......
ot/apr-util-1.6.1/include/apu_version.h /root/apr-util-1.6.1/include/private/apr_crypto_internal.h /root/apr-util-1.6.1/include/private/apr_dbd_internal.h /root/apr-util-1.6.1/include/private/apr_dbd_odbc_v2.h /root/apr-util-1.6.1/include/private/apr_dbm_private.h /root/apr-util-1.6.1/include/private/apu_internal.h > export_vars.c
gcc -E -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I/root/apr-util-1.6.1/include -I/root/apr-util-1.6.1/include/private  -I/usr/local/apr/include/apr-1    exports.c | grep "ap_hack_" | sed -e 's/^.*[)]\(.*\);$/\1/' >> aprutil.exp
gcc -E -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I/root/apr-util-1.6.1/include -I/root/apr-util-1.6.1/include/private  -I/usr/local/apr/include/apr-1    export_vars.c | sed -e 's/^\#[^!]*//' | sed -e '/^$/d' >> aprutil.exp
sed 's,^\(location=\).*$,\1installed,' < apu-1-config > apu-config.out
make[1]: 离开目录“/root/apr-util-1.6.1”

make install

[root@localhost apr-util-1.6.1]# make install
make[1]: 进入目录“/root/apr-util-1.6.1”
make[1]: 对“local-all”无需做任何事。
make[1]: 离开目录“/root/apr-util-1.6.1/usr/local/apr/build-1/mkdir.sh /usr/local/apr-util/include/apr-1 /usr/local/apr-util/lib/pkgconfig \
             /usr/local/apr-util/lib /usr/local/apr-util/bin
for f in /root/apr-util-1.6.1/include/*.h /root/apr-util-1.6.1/include/*.h; do \
        /usr/bin/install -c -m 644 ${f} /usr/local/apr-util/include/apr-1; \
done
/usr/bin/install -c -m 644 apr-util.pc /usr/local/apr-util/lib/pkgconfig/apr-util-1.pc
list=''; for i in $list; do \
        ( cd $i ; make DESTDIR= install ); \
done
/bin/sh /usr/local/apr/build-1/libtool --mode=install /usr/bin/install -c -m 755 libaprutil-1.la /usr/local/apr-util/lib
libtool: install: /usr/bin/install -c -m 755 .libs/libaprutil-1.so.0.6.1 /usr/local/apr-util/lib/libaprutil-1.so.0.6.1
libtool: install: (cd /usr/local/apr-util/lib && { ln -s -f libaprutil-1.so.0.6.1 libaprutil-1.so.0 || { rm -f libaprutil-1.so.0 && ln -s libaprutil-1.so.0.6.1 libaprutil-1.so.0; }; })
libtool: install: (cd /usr/local/apr-util/lib && { ln -s -f libaprutil-1.so.0.6.1 libaprutil-1.so || { rm -f libaprutil-1.so && ln -s libaprutil-1.so.0.6.1 libaprutil-1.so; }; })
libtool: install: /usr/bin/install -c -m 755 .libs/libaprutil-1.lai /usr/local/apr-util/lib/libaprutil-1.la
libtool: install: /usr/bin/install -c -m 755 .libs/libaprutil-1.a /usr/local/apr-util/lib/libaprutil-1.a
libtool: install: chmod 644 /usr/local/apr-util/lib/libaprutil-1.a
libtool: install: ranlib /usr/local/apr-util/lib/libaprutil-1.a
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin" ldconfig -n /usr/local/apr-util/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/apr-util/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the 'LD_RUN_PATH' environment variable
     during linking
   - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to '/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
/usr/bin/install -c -m 644 aprutil.exp /usr/local/apr-util/lib
/usr/bin/install -c -m 755 apu-config.out /usr/local/apr-util/bin/apu-1-config
[root@localhost apr-util-1.6.1]# 

  1. 安装httpd
    ./configure
[root@localhost httpd-2.4.48]# ./configure --prefix=/usr/local/httpd --with=apr=/usr/local/apr  --with-apr-util=/usr/local/apr-util
configure: error: unrecognized option: `--with=apr=/usr/local/apr'
Try `./configure --help' for more information
[root@localhost httpd-2.4.48]# ./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr  --with-apr-util=/usr/local/apr-util
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... yes
  setting CC to "gcc"
  setting CPP to "gcc -E"
  setting CFLAGS to " -g -O2 -pthread"
  setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE"
  setting LDFLAGS to " "
configure: 
configure: Configuring Apache Portable Runtime Utility library...
configure: 
checking for APR-util... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for gcc option to accept ISO C99... -std=gnu99
checking for pcre-config... false
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

解决报错

[root@localhost httpd-2.4.48]# yum -y install pcre-devel
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.sjtu.edu.cn
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 pcre-devel.x86_64.0.8.32-17.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

=====================================================================================
 Package              架构             版本                     源              大小
=====================================================================================
正在安装:
 pcre-devel           x86_64           8.32-17.el7              base           480 k

事务概要
=====================================================================================
安装  1 软件包

总下载量:480 k
安装大小:1.4 M
Downloading packages:
pcre-devel-8.32-17.el7.x86_64.rpm                             | 480 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : pcre-devel-8.32-17.el7.x86_64                                    1/1 
  验证中      : pcre-devel-8.32-17.el7.x86_64                                    1/1 

已安装:
  pcre-devel.x86_64 0:8.32-17.el7                                                    

完毕!

执行上一步操作

[root@localhost httpd-2.4.48]# ./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr  --with-apr-util=/usr/local/apr-util
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
......
config.status: executing default commands
configure: summary of build options:

    Server Version: 2.4.48
    Install prefix: /usr/local/httpd
    C compiler:     gcc -std=gnu99
    CFLAGS:          -g -O2 -pthread  
    CPPFLAGS:        -DLINUX -D_REENTRANT -D_GNU_SOURCE  
    LDFLAGS:           
    LIBS:             
    C preprocessor: gcc -E

[root@localhost httpd-2.4.48]# 

make

[root@localhost httpd-2.4.48]# make
Making all in srclib
make[1]: 进入目录“/root/httpd-2.4.48/srclib”
make[1]: 离开目录“/root/httpd-2.4.48/srclib”
Making all in os
make[1]: 进入目录“/root/httpd-2.4.48/os”
Making all in unix
make[2]: 进入目录“/root/httpd-2.4.48/os/unix”
make[3]: 进入目录“/root/httpd-2.4.48/os/unix”
.......
         -o mod_rewrite.la -rpath /usr/local/httpd/modules -module -avoid-version  mod_rewrite.lo 
make[4]: 离开目录“/root/httpd-2.4.48/modules/mappers”
make[3]: 离开目录“/root/httpd-2.4.48/modules/mappers”
make[2]: 离开目录“/root/httpd-2.4.48/modules”
make[2]: 进入目录“/root/httpd-2.4.48/support”
make[2]: 离开目录“/root/httpd-2.4.48/support”

make[1]: 离开目录“/root/httpd-2.4.48[root@localhost httpd-2.4.48]# 


make install

[root@localhost httpd-2.4.48]# make install
.......
Installing icons
mkdir /usr/local/httpd/icons
mkdir /usr/local/httpd/logs
Installing CGIs
mkdir /usr/local/httpd/cgi-bin
Installing header files
mkdir /usr/local/httpd/include
Installing build system files
mkdir /usr/local/httpd/build
Installing man pages and online manual
mkdir /usr/local/httpd/man
mkdir /usr/local/httpd/man/man1
mkdir /usr/local/httpd/man/man8
mkdir /usr/local/httpd/manual
make[1]: 离开目录“/root/httpd-2.4.48”

  1. 关闭防火墙
[root@localhost ~]# systemctl disable --now firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# setenforce 0
  1. 启动
[root@localhost ~]# /usr/local/httpd/bin/apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
[root@localhost ~]# ss -antl
State       Recv-Q Send-Q Local Address:Port               Peer Address:Port              
LISTEN      0      128            *:22                         *:*                  
LISTEN      0      100    127.0.0.1:25                         *:*                  
LISTEN      0      128           :::80                        :::*                  
LISTEN      0      128           :::22                        :::*                  
LISTEN      0      100          ::1:25                        :::*                  
[root@localhost ~]# 

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值