本文摘自PHP中文网,作者步履不停,侵删。
压缩包安装方式
1、下载httpd-2.4.29.tar.gz
2、上传到服务器/usr/local/software
1 2 | tar -zxvf httpd-2.4.29.tar.gz
./configure --prefix=/usr/local/apache2/ # 设置apache安装目录
|
若没有安装过Apr,会报错:
1 2 | checking for APR... no
configure: error: APR not found. Please read the documentation.
|
3、接下来安装apr,首先下载apr-1.6.3.tar.gz
4、上传到服务器/usr/local/software
1 2 3 4 5 | tar -zxvf apr-1.6.3.tar.gz
cd apr-1.6.3
.configure
make
make install
|
又会报错:
1 2 | checking for APR-util... no
configure: error: APR-util not found. Please read the documentation.
|
5、下载apr-util-1.6.1.tar.gz
6、上传到服务器/usr/local/software
1 2 3 | tar -zxvf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1
./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr
|
此时还会报错:
1 2 3 4 5 | xml/apr_xml.c:35:19: 致命错误:expat.h:没有那个文件或目录
# include <expat.h>
^
编译中断。
make: *** [xml/apr_xml.lo] 错误 1
|
7、猜测是可能缺expat的开发库
1 2 3 4 | yum install expat-devel # 中间会让你输入y
./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr
make # 成功!
make install
|
8、此时再回去安装apache,不仅要指定apr的路径,还要指定apr-util的路径
1 | ./configure --prefix=/usr/local/apache2/ --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/
|
依旧报错,不少人到这里可能已经崩溃了,但这个错误跟前面遇到的类似
1 2 | checking for pcre-config... false
configure: error: pcre-config for libpcre not found. PCRE is required and available from http:
|
9、下载pcre-8.41.tar.gz
10、上传到服务器/usr/local/software
1 2 | tar -zxvf pcre-8.41.tar.gz
./configure
|
又再次报错,我保证这是最后一次了
1 2 3 4 | checking windows.h usability... no
checking windows.h presence... no
checking for windows.h... no
configure: error: You need a C++ compiler for C++ support.
|
10、安装c++环境
1 2 3 4 5 | yum install -y gcc gcc-c++
# 错了那么多次,别忘了现在的位置,接下来还是要安装pcre
./configure
make
make install
|
11、好了,绕了一大圈,接下来还是要安装apache
1 2 3 4 5 | cd ..
cd apache
./configure --prefix=/usr/local/apache2/ --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/
make
make install
|
好惨啊!最后一步又报错:
1 2 3 4 5 6 7 8 | /usr/local/apr-util
/usr/local/apr-util
/usr/local/apr-util
collect2: error: ld returned 1 exit status
make[2]: *** [htpasswd] 错误 1
make[2]: Leaving directory `/usr/local/software/apache/support'
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/usr/local/software/apache/support'
|
这种报错没见过,果断网上搜索一番,答案即是:apr版本太高;
12、于是我下载了apr-util-1.5 http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz
阅读剩余部分
相关阅读 >>
如何简便快速的续费一台预付费实例
vim退出不保存的命令是什么?
系统自动创建的默认安全组和自己创建的安全组的默认规则
Linux wc命令有什么用
Linux基础知识系列一
最详细的Linux终端和line discipline图解
Linux shell是什么意思
自动快照功能细节和快速简单的删除自动快照
Linux如何退出
Linux中文本的中文乱码怎么办
更多相关阅读请进入《Linux》频道 >>
转载请注明出处:木庄网络博客 » linux怎么安装apache服务器