安装apache http server

我的系统是centos6,自带的http server不能添加mod_jk模块,网上查是系统原因。所以自己装apache http server。

安装apache http server 2.2.4,按照文档用cofigure命令配置报错,configure: error: APR not found. 需要先安装apr-1.4.6.tar.gz。

安装apche APR,还是configure报错,configure: error: no acceptable C compiler found in $PATH,需要安装gcc

用yum install gcc 安装gcc。然后./configure --prefix=/opt/apache-apr(自定义目录),成功,输入make命令时报错,再用yum安装make包。

然后在安装apache http还是报错,需要apache apr util,再下载apr-util-1.5.2.tar.gz,安装时又报错,需要安装c++编译器

以上错误都解决再配置apache http又报错,需要pcre,再去下载pcre-8.32.tar.gz,再安装,终于完成。整理下就是:

  • 准备工作

yum install gcc #如果未安装gcc,先安装gcc

yum install -y gcc gcc-c++ #安装c++编译器

yum install make #安装make工具

  • 安装apache APR

从官网下载apr-1.4.6.tar.gz

tar -xvf apr-1.4.6.tar.gz #解压

cd apr-1.4.6

./configure --prefix=/opt/apache-apr #配置安装目录(/opt/apache-apr为自定义目录,下面所有--prefix后内容都是)

make

make install #正常情况应该安装完成,可以echo $?查看上一条命令是否执行成功

  • 安装apache apr util

从官网下载apr-util-1.5.2.tar.gz

tar -xvf apr-util-1.5.2.tar.gz

cd apr-util-1.5.2

./configure --prefix=/opt/apache-apr-util --with-apr=/opt/apache-apr #/opt/apache-apr-util 是自定义安装目录,/opt/apache-apr 是上一步apache apr的安装目录

make

make install

  • 安装pcre-8.32.tar.gz

tar -xvf pcre-8.32.tar.gz

cd pcre-8.32

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

make

make install

  • 安装apache http server

从官网下载httpd-2.4.4.tar.gz

tar -xvf httpd-2.4.4.tar.gz

cd httpd-2.4.4

./configure --prefix=/opt/apache-httpd --with-apr=/opt/apache-apr --with-apr-util=/opt/apache-apr-util --with-pcre=/opt/pcre-8.32

make

make install

以上安装完成,进入apache http 的安装目录/bin,用 ./apachectl  start启动apache服务,从浏览器输入对应机器ip地址,直接访问,出现it works代表成功。

猜你喜欢

转载自daqiqiu.iteye.com/blog/1867740