linux下安装Apache-httpd-2.4

1.安装httpd

从http://httpd.apache.org/下载:httpd-2.4.10.tar.gz

tar zxvf httpd-2.4.10.tar.gz
cd xx/httpd-2.4.10
./configure --prefix=/home/soft/httpd-2.4.10
检查编辑环境时出现:
checking for APR... no
configure: error: 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

2.安装apr

从http://apr.apache.org/download.cgi下载:apr-1.5.1.tar.gz

tar zxvf apr-1.5.1.tar.gz

cd xx/apr-1.5.1

./configure --prefix=/home/soft/apr-1.5.1

make
make install
可选:
make clean
make distclean
cd ..
rm -rf apr-1.5.1


3.再次安装httpd

./configure --prefix=/home/soft/httpd-2.4.10 --with-apr=/home/soft/apr-1.5.1

再次检查编译环境出现
checking for APR-util... no
configure: error: APR-util not found . Please read the documentation.

./configure –help | grep apr-util 查看帮助

--with-apr-util=PATH prefix for installed APU or the full path to


4.安装apr-util

从http://apr.apache.org/download.cgi下载:apr-util-1.5.4.tar.gz

tar zxvf apr-util-1.5.4.tar.gz

cd xx/apr-util-1.5.4

./configure --prefix=/home/soft/apr-util-1.5.4 --with-apr=/home/soft/apr-1.5.1  (apr-util依赖apr)

make
make install
可选:
make clean
make distclean
cd ..
rm -rf apr-util-1.5.4


5.再次安装httpd

./configure --prefix=/home/soft/httpd-2.4.10 --with-apr=/home/soft/apr-1.5.1  --with-apr-util=/home/soft/apr-util-1.5.4

再次检查编译环境出现

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

./configure –help | grep pcre 查看帮助

--with-pcre=PATH Use external PCRE library 


6.安装pcre

从http://pcre.org/下载:pcre-8.36.tar.gz

tar zxvf pcre-8.36.tar.gz

cd xx/pcre-8.36

./configure --prefix=/home/soft/pcre-8.36

make
make install
可选:
make clean
make distclean
cd ..
rm -rf pcre-8.36

  注意:pcre安装过程出现了错误,提示需要安装:yum install gcc-c++


7.再次安装httpd
./configure --prefix=/home/soft/httpd-2.4.10 --with-apr=/home/soft/apr-1.5.1  --with-apr-util=/home/soft/apr-util-1.5.4 --with-pcre=/home/soft/pcre-8.36

终于没有编译错误了,继续...

make
make install
可选:
make clean
make distclean
cd ..
rm -rf httpd-2.4.10


试用一下:

查看80端口是否被占用
[root@localhost conf]#netstat -an | grep :80 
端口可能被占用,修改conf/httpd.conf 将 Listen 80 改为 Listen 7777

[root@localhost bin]# apachectl start
访问:http://localhost:7777/  出现:

It works!

表示安装并启动成功。
停止:[root@localhost bin]# apachectl stop

一路艰辛,都是通过网络搜索答案,其实apache官方是有明确依赖说明的:http://httpd.apache.org/docs/2.4/en/install.html,搜索"Requirements"可以看到。

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值