CentOS7 LAMP 安装

自己学习一下怎么安装LAMP环境,新手一枚,有很多地方参考了别人的经验,有错误的地方望指正
1.安装Apache

[root@localhost src]# wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.4.33.tar.gz
[root@localhost src]# tar -xf httpd-2.4.33.tar.gz

编译安装httpd

[root@localhost src]# cd httpd-2.4.33
[root@localhost httpd-2.4.33]# ./configure

遇到了错误

checking for APR... no
configure: error: APR not found.  Please read the documentation.

原因是缺少Apache运行库,需要安装APR和APR-UTIL
试过了yum安装,不知道为啥安装完还是报这个错,只好试试自己编译安装咯,下载地址在这

编译安装APR

[root@localhost src]# tar -xf apr-1.6.3.tar.gz
[root@localhost src]# cd apr-1.6.3
[root@localhost apr-1.6.3]# ./configure

又遇到一个错误

configure: error: no acceptable C compiler found in $PATH

原因是未安装gcc编译器,给装它一个

[root@localhost apr-1.6.3]# yum install -y gcc-c++

再来一遍,过了

[root@localhost apr-1.6.3]# ./configure
[root@localhost apr-1.6.3]# make && make install

轮到APR-UTIL

[root@localhost apr-1.6.3]# cd ../
[root@localhost src]# tar -xf apr-util-1.6.1.tar.gz
[root@localhost src]# cd apr-util-1.6.1
[root@localhost apr-util-1.6.1]# ./configure

错误还是无可避免滴

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

无法定位到APR的位置,需要带上 --with-apr 参数编译

[root@localhost apr-util-1.6.1]# ./configure --with-apr=/usr/local/apr
[root@localhost apr-util-1.6.1]# make && make install

有报错了

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

缺少expat解析库,给装上

[root@localhost apr-util-1.6.1]# yum install -y expat-devel

继续

[root@localhost apr-util-1.6.1]# make && make install

继续编译安装httpd,出现了个新的错误

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

装上

[root@localhost httpd-2.4.33]# yum install -y pcre-devel

终于编译过了

[root@localhost httpd-2.4.33]# ./configure --enable-so
[root@localhost httpd-2.4.33]# make && make install

又爆出一堆错误

collect2: error: ld returned 1 exit status
make[2]: *** [htpasswd] Error 1
make[2]: Leaving directory `/usr/local/httpd-2.4.33/support'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/httpd-2.4.33/support'
make: *** [all-recursive] Error 1
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值