CentOs7源码安装Apache

2018-05-03 10:32 阅读 1,627 次 评论 0 条

一、官方安装手册http://httpd.apache.org/docs/2.4/install.html#customize

下载最新版http://httpd.apache.org/download.cgi#apache24

httpd-2.4.27.tar.bz2

解压 tar xvf httpd-2.4.27.tar.bz2

cd httpd-2.4.27

配置 ./configure  --prefix=安装路径 --with-apr和apr-util的目录

编译 make

安装 make install

二、 问题及解决

问题a:configure: error: APR not found. Please read the documentation.

解决:  需要安装 apr 和apr-util

安装包地址:http://archive.apache.org/dist/apr/

下载 apr-1.6.2.tar.bz2  和 apr-util-1.6.0.tar.bz2

解压 tar xvf apr-1.6.2.tar.bz2

cd apr-1.6.2

配置安装路径 ./configure --prefix=/usr/local/apr

编译&安装   make && make install

解压 tar xvf apr-util-1.6.0.tar.bz2

cd apr-util-1.6.0

配置安装路径 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

编译&安装   make && make install

问题b:xml/apr_xml.c:35:19: 致命错误:expat.h:没有那个文件或目录  #include <expat.h>

解决:缺少expat-devel包

yum install expat-devel

问题c:configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

解决:  安装pcre

下载pcre-8.41.tar.gz

解压 pcre-8.41.tar.gz

cd pcre-8.41

配置安装路径 ./configure --prefix=/usr/local/pcre

编译&安装   make && make install

问题d: make编译过程中出现 /usr/local/apr/-util/lib/libaprutil-1.so: undefined reference to `XML_GetErrorCode‘

解决:  我刚开始下的是apr-util-1.6.0.tar.gz 后来换成apr-util-1.6.0.tar.bz2就好使了,可能是包的问题。

也可能是配置时需要--with-expat=builtin,我试了但对于我的错误来说并不好使,后来换了一个包终于好使了,浪费了好长时间。

用apr-util-1.6.0.tar.bz2重新解压安了一遍,回到httpd-2.4.27,make clean

配置./configure --prefix=/usr/local/apache  --with-pcre=/usr/local/pcre/ --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/

编译安装make && make install 完成。

版权声明:本文著作权归原作者所有,欢迎分享本文,谢谢支持!
转载请注明:CentOs7源码安装Apache | 雨晨博客
分类:PHP, 程序笔记 标签:,

发表评论


表情