编译安装apache

从Apache官网http://httpd.apache.org/ 下载apache源码包httpd-2.4.38.tar.bz2,解压缩:tar xf httpd-2.4.38.tar.bz2.

cd 到apache目录,执行命令:./configure –prefix=/usr/local/apache –sysconfdir=/etc/apache

可能会遇到ERROR:APR NOT FOUND,下载apr以及apr-util:http://apr.apache.org/download.cgi  或者  http://archive.apache.org/dist/apr/

安装arp:

  解压后进入apr目录中,执行./configure –prefix=/usr/local/apr –sysconfdir=/etc/apr, make,make install

  安装apr-util执行相同的命令:./configure –prefix=/usr/local/apr-util –sysconfdir=/etc/apr-util –with-apr=/usr/local/apr

    可能安装会出现ERROR:apr-util致命错误:expat.h:没有那个文件或目录,

      解决方法:缺少expat库: yum install expat.devel

都安装好后安装apache

执行命令:

  ./configure –prefix=/usr/local/apache –sysconfdir=/etc/apache  –with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-util

安装可能出现ERROR:  编译安装apache出现collect2: error: ld returned 1 exit status

解决方法: apr和apr-util版本将为1.5可以正常安装

可能还会出现ERROR:缺少pcre包,解决方法:安装pcre: 可以去官网下载pcre包,http://pcre.org/,也可以直接yum install pcre

至此,apache服务安装完成。

安装后需要进行配置:待续