源码包安装apache

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

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

  httpd-2.4.27.tar.bz2ui

  解压 tar xvf httpd-2.4.27.tar.bz2rest

  cd httpd-2.4.27xml

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

编译 makeit

安装 make installio

2、 问题及解决编译

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

  解决:  须要安装 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 完成

若是按上面步骤安装,那么安装路径是在/usr/local/apache2

启动: /usr/local/apache2/bin/apachectl start

重启:/usr/local/apache2/bin/apachectl restart

停用:/usr/local/apache2/bin/apachectl stop

相关文章
相关标签/搜索