自己学习一下怎么安装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&#