CentOS下编译安装Apache2(新)

官网下载apache,apr, apr-util,pcre

httpd-2.4.16.tar.gz    http://httpd.apache.org/download.cgi#apache24

apr-1.5.2.tar.gz       http://apr.apache.org/download.cgi

apr-util-1.5.4.tar.gz     

pcre-8.37.tar.gz       http://www.pcre.org/

1 yum安装gcc

yum -y install gcc

2 源码安装apr,apr-util

./configure --prefix=/usr/local/apr/
make
make install ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/ make
make install

3 源码安装pcre

./configure --prefix=/usr/local/pcre/
make
make install

4 源码安装apache

./configure --prefix=/usr/local/apache2/ --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/
make
make install

5 启动服务

/usr/local/apache2/bin/apachectl start

 AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally  to suppress this message

 不影响,浏览器输入虚拟机IP,出现It works! 说明成功。

KEEP LEARNING!
原文地址:https://www.cnblogs.com/roronoa-sqd/p/4875954.html