首页 > 代码库 > 安装apache

安装apache

0、首先安装gcc:yum install gcc
1、源码包下载地址:http://httpd.apache.org/download.cgi
2、上传到/usr/local/src目录并解压:tar -zxvf httpd-2.4.10.tar.gz
3、创建目标文件夹:mkdir /usr/local/apache2
4、回到源码解压目录:./configure --prefix=/usr/local/apache2
5、出现错误:"APR not found. Please read the documentation."
通过:./configure -help|grep apr查看帮助

--with-included-apr Use bundled copies of APR/APR-Util
--with-apr=PATH prefix for installed APR or the full path to apr-config
--with-apr-util=PATH prefix for installed APU or the full path to

需要apr和apr-util

下载地址:http://apr.apache.org/download.cgi

两种方法:
1)把下载的两个源码包解压后分别放在apache源码目录下的./srclib/apr和./srclib/apr-util 下(注意路径名称!),
等到./configure 步骤的时候添加 ./configure --with-included-apr和--with-included-apr-util
2)分别安装两个源码包:./configure、make、make install。
注意安装Apr-util注意安装Apr-util 时:./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

6、再次执行 步骤4,并添加相关apr和apr-util的选项
7、遇到错误:pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
8、通过./configure -help|grep pcre查看帮助:
--with-pcre=PATH Use external PCRE library
9、安装pcre
下载地址:http://pcre.org/
./configure、make、make install 安装到/usr/local/pcre目录
10、再次执行 步骤4,并执行make和makeinstall,注意./cnfigure步骤加入apr、apr-util 和--with-pcre=/usr/local/pcre
注意:Apache在安装时不会检查参数是否正确,错误的参数会直接被丢弃,不会报告给用户。但可以使用echo $?命令检查是否有错误,当输出结果为0时表示没有错误。

 

 

=====================================================================

参考或引用:

upwifi:《httpd-2.4.1 安装笔记》 http://www.cnblogs.com/upwifi/archive/2013/02/26/2934228.html
CodeWall:《Linux下配置安装PHP环境》 http://www.cnblogs.com/lufangtao/archive/2012/12/30/2839679.html

安装apache