centos 7.4 最小化安装版本,采用阿里云的源,安装前yum update更新过
最新版Apache HTTP Server下载地址
http://httpd.apache.org/download.cgi
Apache官网的安装说明
http://httpd.apache.org/docs/2.4/install.html#install
除了Apache httpd,还要下载两个依赖环境,
下载地址:http://apr.apache.org/download.cgi
把下载好的两个APR 和 APR-Util解压后,分别重命名去掉版本编号,就单单apr文件夹和apr-util文件夹就好了,然后把这两个文件夹移动到httpd根目录下的srclib文件夹里面,
配置apache
./configure
遇到错误提示:
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
解决办法:
sudo yum -y install pcre-devel
sudo make
时间有点长的噢,听会歌吧。遇到错误提示:
fatal error: expat.h: No such file or directory
解决办法:yum install expat-devel
遇到错误提示如下,说明缺少了xml相关的库
/root/httpd-2.4.29/srclib/apr-util/.libs/libaprutil-1.so: undefined reference to `XML_GetErrorCode' /root/httpd-2.4.29/srclib/apr-util/.libs/libaprutil-1.so: undefined reference to `XML_SetEntityDeclHandler' /root/httpd-2.4.29/srclib/apr-util/.libs/libaprutil-1.so: undefined reference to `XML_ParserCreate' /root/httpd-2.4.29/srclib/apr-util/.libs/libaprutil-1.so: undefined reference to `XML_SetCharacterDataHandler' /root/httpd-2.4.29/srclib/apr-util/.libs/libaprutil-1.so: undefined reference to `XML_ParserFree' /root/httpd-2.4.29/srclib/apr-util/.libs/libaprutil-1.so: undefined reference to `XML_SetUserData' /root/httpd-2.4.29/srclib/apr-util/.libs/libaprutil-1.so: undefined reference to `XML_StopParser' /root/httpd-2.4.29/srclib/apr-util/.libs/libaprutil-1.so: undefined reference to `XML_Parse' /root/httpd-2.4.29/srclib/apr-util/.libs/libaprutil-1.so: undefined reference to `XML_ErrorString' /root/httpd-2.4.29/srclib/apr-util/.libs/libaprutil-1.so: undefined reference to `XML_SetElementHandler' collect2: error: ld returned 1 exit status make[2]: *** [htpasswd] Error 1 make[2]: Leaving directory `/root/httpd-2.4.29/support' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/root/httpd-2.4.29/support' make: *** [all-recursive] Error 1
解决办法:
yum install -y libxml2-devel
sudo make test
编译测试,有11316个条目要检查噢,先喝杯咖啡。sudo make install
编译安装