本文概述
- APR not found
- APR-util not found
- pcre-config for libpcre not found
- OpenSSL version is too old
- xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory
- configure: error: no acceptable C compiler found in $PATH
- nghttp2 version is too old
我认为将其放在一起作为参考会很有帮助。
错误清单
- APR not found
- APR-util not found
- pcre-config for libpcre not found
- OpenSSL version is too old
- xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory
- configure: error: no acceptable C compiler found in $PATH
- nghttp2 version is too old
[[email
protected]handan httpd-2.4.25]# ./configure --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-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found.
Please read the documentation.
[[email
protected] httpd-2.4.25]#
APR代表” Apache Portable Runtime” , 需要从源代码进行编译。如果你与我处于同一情况, 那么以下人员将为你提供救助。
首先, 你需要安装APR。
- 使用wget下载最新版本的APR
wget https://www-eu.apache.org/dist/apr/apr-1.6.3.tar.gz .
- 解压缩下载的文件
gunzip -c apr-1.6.3.tar.gz | tar xvf -
- 它将创建一个新文件夹” apr-1.6.3″
- 进入并使用configure命令进行编译
./configure
【Apache HTTP安装故障排除指南合集详解】这将需要几秒钟, 一旦完成, 你将得到提示(确保没有错误)。
- 最后一步是使用make命令进行安装
make
make install
完成后, 我尝试安装Apache并遇到另一个错误。
APR-util not found
[[email
protected] httpd-2.4.25]# ./configure --enable-ssl --enable-so
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-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-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... no
configure: error: APR-util not found.
Please read the documentation.
[[email
protected] httpd-2.4.25]#
如果还出现” APR-util not found” 错误, 则必须安装以下内容。
- 下载最新的APR-util来源
wget https://www-eu.apache.org/dist/apr/apr-util-1.6.1.tar.gz .
- 解压缩下载的gz文件
gunzip -c apr-util-1.6.1.tar.gz | tar xvf -
- 进入新创建的文件夹” apr-util-1.6.1″ , 并使用以下命令进行安装
./configure --with-apr=/usr/local/apr/bin/apr-1-config
make
make install
尝试再次安装Apache, 但出现另一个错误。
pcre-config for libpcre not found这就是我得到的。
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/
PCRE代表Perl兼容正则表达式, 此错误很容易解决。你只需安装pcre-devel软件包。
yum install pcre-devel
尚未结束, 下一次尝试与OpenSSL相关的问题。
OpenSSL version is too old
checking whether to enable mod_slotmem_plain... no
checking whether to enable mod_ssl... checking dependencies
checking for OpenSSL... checking for user-provided OpenSSL base directory... ./configure: line 25426: cd: /usr/bin/openssl: Not a directory
/root/httpd-2.4.25
adding "-I/root/httpd-2.4.25/include" to CPPFLAGS
setting MOD_CFLAGS to "-I/root/httpd-2.4.25/include"
setting ab_CFLAGS to "-I/root/httpd-2.4.25/include"
adding "-L/root/httpd-2.4.25/lib" to LDFLAGS
setting MOD_LDFLAGS to "-L/root/httpd-2.4.25/lib"
checking for OpenSSL version >
= 0.9.8a... FAILED
configure: WARNING: OpenSSL version is too old
no
checking whether to enable mod_ssl... configure: error: mod_ssl has been requested but can not be built due to prerequisite failures
[[email
protected] httpd-2.4.25]#
首先要确保你拥有的是我所用的最新版本的OpenSSL, 因此我需要安装devel软件包, 一切正常。
yum install openssl-devel
xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory编译APR时, 出现此错误。
[[email
protected] apr-util-1.6.1]# make
make[1]: Entering directory `/opt/temp/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/opt/temp/apr-util-1.6.1/include -I/opt/temp/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: fatal error: expat.h: No such file or directory
#include <
expat.h>
^
compilation terminated.
make[1]: *** [xml/apr_xml.lo] Error 1
如果遇到此错误, 则可以通过安装expat-devel软件包来解决。
yum install expat-devel
configure: error: no acceptable C compiler found in $PATH找不到C编译器对于任何软件版本都是典型的, 你可以通过安装编译器来解决。
yum install gcc
nghttp2 version is too old这是特定于你尝试使用HTTP / 2安装Apache的。你将收到以下错误。
checking whether to enable mod_http2... checking dependencies
checking for OpenSSL... (cached) yes
setting MOD_LDFLAGS to "-lssl -lcrypto -lrt -lcrypt -lpthread"
setting MOD_CFLAGS to " "
setting MOD_CPPFLAGS to "-DH2_OPENSSL"
checking for nghttp2... checking for user-provided nghttp2 base directory... none
checking for pkg-config along ... checking for nghttp2 version >
= 1.2.1... FAILED
configure: WARNING: nghttp2 version is too old
no
checking whether to enable mod_http2... configure: error: mod_http2 has been requested but can not be built due to prerequisite failures
并且, 如果是这样, 你可以通过以下方式安装nghttp2进行修复。
- 从此处下载最新版本的nghttp2
wget https://github.com/nghttp2/nghttp2/releases/download/v1.37.0/nghttp2-1.37.0.tar.gz
- 解压缩下载的文件
tar -xvf nghttp2-1.37.0.tar.gz
- 它将创建一个新文件夹, 放入其中并运行以下命令
./configure
make
make install
一旦完成, 没有错误, 请再次使用HTTP2运行Apache源代码构建。应该没关系。
最后, 我能够成功安装Apache。如果你对学习Apache HTTP Server管理感兴趣, 请查看此在线课程。
推荐阅读
- 44个实用的Apache Web Server面试问题及答案
- Docker,Docker Compose,Docker Swarm,Kubernetes之间有什么区别()
- Kubernetes使用教程完整详细图解
- ES6对话框介绍和用法示例
- ES6运算符介绍和用法示例
- Godot文件系统介绍
- ES6 void关键字
- Android Studio错误日志-注解报错Annotation processors must be explicitly declared now.
- Android从 HttpResponse (或者InputStream) 获取字符串内容的代码