apache2.4.33 安装,亲测可用,附安装包

下载有相关的包 pcre-8.20.tar.bz2,apr-1.6.3.tar.gz,apr-util-1.6.1.tar.gz httpd-2.4.33.tar.gz

下载相关tar包

apache安装需要依赖于apr以及apr-util,apr-util安装要有pcre,已安装,可跳过,但是如果版本不对,会报xml找不到一些变量。

1.安装pcre

tar -xjf pcre-8.20.tar.bz2 -C /usr/local/pcre/

./configure

make

make install

pcre 编辑器要求 gcc ,没有要安装

由于http协议以及gcc对时间有精确的要求,需要同步时间。

同步时间可以使用ntpdate命令或者date命令 

make的时候报错,是少了gcc-c++

libtool: compile: Try `libtool --help' for more information.
make[1]: *** [pcrecpp.lo] Error 1
make[1]: Leaving directory `/usr/local/pcre'

make: *** [all] Error 2

执行下面的安装命令可解决

yum -y install gcc-c++

2.解压

httpd-2.4.33.tar.gz

mkdir /home/httpd/

tar -xzvf httpd-2.4.33.tar.gz -C /home/httpd/

3.解压apr和apr-util,移动

tar -xzvf apr-1.6.3.tar.gz

tar -xzvf apr-util-1.6.1.tar.gz

mv apr-1.6.3 /home/httpd/srclib/apr

mv apr-util-1.6.1 /home/httpd/srclib/apr-util

注:srclib目录下的名称必须是apr和apr-util,要么在编译apache的时候会报错,找不到目录

4.编译apache

cd /home/httpd/

mkdir /home/apache2

./configure --prefix=/home/apache2  --with-included-apr    --with-pcre=/usr/local/pcre/bin

在编译的时候遇到一个错误:

xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory

在网上查找说可能是少了expat库,yum install expat-devel 安装该库,安装完再次编译,果然可以。

然后make最后make install

如果make install 报错

例:libtool: install: error: cannot install `libaprutil-1.la' to a directory not ending in /usr/local/apache2/lib  

就因为之前安装过,重新安装没有清理干净

make clean 就可以了

安装完成后测试一下/home/apache2/bin/apachectl start如果启动报错:

httpd: Could not reliably determine the server's fully qualified domain name

vim 打开 httpd.conf,将里面的 #ServerName localhost:80 注释去掉即可。启动完成后http://ip/

出现it works!页面说明安装成功

https://blog.csdn.net/hsd2012/article/details/51518383

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值