Linux下安装apache http server 过程

软件准备

Linux : cenos5.5

Apache httpd-2.4.9.tar.gz

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


安装步骤

tar jxvf httpd-2.4.9.tar.gz

cd httpd-2.4.9       

#配置apache安装路径

./configure --prefix=/opt/app/apache2 --enable-so


报错,信息如下:

...

configure:

checking for APR... no

configure: error: APR not found. Please read the documentation.

 

apr 依赖没有找到,安装方法如下:

从apache官网下载 apr ; 下载地址:http://apr.apache.org/download.cgi

tar -zxf apr-1.5.1.tar.gz

cd apr-1.5.1

./configure --prefix=/opt/app/apr

make

make install


安装完成后,回到 httpd-2.4.9 目录, 重新配置apache

./configure --prefix=/opt/app/apache2 --enable-so

 

仍然出错,原因是没有指定 apr 配置文件,可用如下命令查看:

./configure -help | grep apr



执行如下命令:

./configure --prefix=/opt/app/apache2 --with-apr=/opt/app/apr/bin/apr-1-config --enable-so


又出错了,报错信息如下:

...

configure:

checking for APR-util... no

configure: error: APR-util not found. Please read the documentation.


APR-util 依赖没有找到,安装方法如下:

仍然从上方的网址,下载 apr-util ;

tar -zxf apr-util-1.5.3.tar.gz

cd apr-util-1.5.3

./configure --prefix=/opt/app/apr-util

 

报错,信息如下:

checking for APR... no

configure: error: APR could not be located. Please use the --with-apr option.

 

很明显,需要加上 --with-apr 选项:

./configure --prefix=/opt/app/apr-util --with-apr=/opt/app/apr/bin/apr-1-config


#编译、安装

make

make install


安装完成后,回到 httpd-2.4.9 目录, 重新配置apache, 命令如下:

./configure --prefix=/opt/app/apache2 --with-apr=/opt/app/apr/bin/apr-1-config --with-apr-util=/opt/app/apr-util/bin/apu-1-config --enable-so


再次出错,报错信息如下:

checking for pcre-config... false

configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

 

缺少pcre, 安装方法如下:

下载地址一:http://sourceforge.net/projects/pcre

下载地址二:http://ftp.exim.llorien.org/pcre/

 

下载 pcre-8.30.zip

unzip -o pcre-8.30.zip

cd pcre-8.30

./configure --prefix=/opt/app/pcre

make

make install



安装完成后,再次回到 httpd-2.4.9 目录, 重新配置apache, 追加”--with-pcre”选项完整命令如下:

./configure --prefix=/opt/app/apache2 --with-apr=/opt/app/apr/bin/apr-1-config --with-apr-util=/opt/app/apr-util/bin/apu-1-config --with-pcre=/opt/app/pcre/bin/pcre-config --enable-so

 

#编译、安装

make

make install

 

至此,Apache Http Server 安装完成!!!


#启动apache

/opt/app/apache2/bin/apachectl stop

/opt/app/apache2/bin/apachectl start

 

#查看80端口是否被占用

netstat -anp | grep :80    

 

#查看apache 启动服务是否启动

ps -aux | grep httpd



本文参考:http://www.cnblogs.com/JemBai/archive/2012/11/07/2759139.html


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值