Apache编译与安装 RedHat enterprises 6.2

引自:http://blog.chinaunix.net/uid-26881541-id-3336614.html

        http://apr.apache.org/download.cgi

命令:

yum install wget ppl cloog-ppl mpfr cpp kernel-headers glibc-headers gibc-devel gcc-4.4.5-6

yum install wget gcc make mysql mysql-server mysql-devel httpd php php-mysql sendmail


 apache下载地址:http://httpd.apache.org/download.cgi#apache24



到http://httpd.apache.org/下载以源码方式安装,我下载的版本是Apache httpd 2.4.3

解压:[root@localhost apache]# tar -jxvf httpd-2.4.3.tar.bz2

配置环境:

[root@localhost httpd-2.4.3]# ./configure --prefix=/usr/local/apache2  --enable-so --enable-mods-shared=all --enable-modules=most

提示configure: error: APR not found. Please read the documentation,

解决:
缺少Apr,下载http://projects.apache.org/indexes/quick.html

解压:[root@localhost apache]# tar zxvf apr-1.4.6.tar.gz

配置环境:

[root@localhost apr-1.4.6]# ./configure --prefix=/usr/local/apr/

编译和安装:

[root@localhost apr-1.4.6]#make

[root@localhost apr-1.4.6]#make install

编译安装完成apr之后,继续编译apache,又有如下的提示configure: error: APR-util not found.  Please read the documentation

解决:

缺少APR-util,http://apr.apache.org/下载

解压: [root@localhost apache]# tar zxvf apr-util-1.4.1.tar.gz

配置环境:

在 [root@localhost apr-util-1.4.1]./configure --prefix=/usr/local/apr-util -with- apr=/usr/local/apr/bin/apr-1-config时,提示configure: error: APR could not be located. Please use the --with-apr option,这是路径的问题(这个问题困扰我好久了,在这里找到了说明http://apache.jz123.cn/install.html),应该用下面的命令[root@localhost apr-util-1.4.1]./configure  --with-apr=/usr/local/

继续编译Apache,晕啊,仍没有成功,提示如下configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

解决:

下载prce,网址http://sourceforge.net/projects/pcre/

解压:unzip pcre-8.31.zip

配置环境:

[root@localhost pcre-8.31]#./configure --prefix=/usr/local/

编译和安装:

[root@localhost pcre-8.31]#make

[root@localhost pcre-8.31]#make install

再次编译Apache,皇天不负有心人啊,终于通过了!此时运行httpd(service httpd start),在浏览器上输入127:0:0:1,就能看到下面的了

This page is used to test the proper operation of the Apache HTTP server after it has been installed. If you can read this page, it means that the Apache HTTP server installed at this site is working properly.

原文地址:https://www.cnblogs.com/tdcqma/p/5035927.html