ubuntu下apache httd/cgi的编译与安装
参考:http://www.jb51.net/article/18230.htm
http://www.51testing.com/html/18/311318-832068.html
?
首先到apache的主页下载最新版本的apache http server,地址为 http://httpd.apache.org/?
安装apache:?
切换到httpd-2.4.6.tar.bz2所在目录,然后:?
#??tar xvf httpd-2.4.6.tar.bz2?
此时在该目录下有一个文件夹httpd-2.4.6,切换到该文件夹:?
# cd ./httpd-2.4.6
安装到 /usr/local/apache2/ 下面,输入下面的命令:?
# ./configure --prefix= /usr/local/apache2?
# make?
# make install?
?
进行到./configure的时候报错。提示configure: error: APR not found. Please read the documentation.
解决方法:
1.解决apr not found问题
APR和APR-UTIL的下载地址:http://apr.apache.org/download.cgi
[root@yahoo test]# ?tar vfc apr-1.4.8.tar.bz2?
[root@yahoo apr-1.4.8]# ./configure --prefix=/usr/local/apr
[root@yahoo apr-1.4.8]# make
[root@yahoo apr-1.4.8]# make install
2.解决APR-util not found问题
[root@yahoo test]# ?tar -xvf apr-util-1.5.2.tar.bz2?
[root@yahoo apr-util-1.5.2]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
[root@yahoo apr-util-1.5.2]# make
[root@yahoo apr-util-1.5.2]# make install
3 ../configure仍提示APR-util not found,增加--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util后出现
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/?
#./configure –help | grep pcre
--with-pcre=PATH Use external PCRE library
下载:http://sourceforge.net/projects/pcre
下载地址二:http://ftp.exim.llorien.org/pcre/
#unzip -o pcre-8.33.zip?
#cd pcre-8.33
#./configure --prefix=/usr/local/pcre
#make
#make install
如报错:configure: error: You need a C++ compiler for C++ support. ??
则安装c++编译器即可:?sudo apt-get install g++
?
?
4.编译Apache
[root@yahoo?httpd-2.4.6]# ./configure --prefix=/usr/local/apache2 ?--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util / ?--with-pcre=/usr/local/pcre
[root@yahoo??httpd-2.4.6]## make
[root@yahoo??httpd-2.4.6]#]# make install
?
make的时候报错如下:
?cannot find the library `/usr/local/apache2/lib/libapr-1.la' or unhandled argument `/usr/local/apache2/lib/libapr-1.la'
解决方法:
?mkdir /usr/local/apache2/lib/
sudo cp /usr/local/libapr-* ? ?/usr/local/apache2/lib/
基本思路就是先建好/usr/local/apache2/lib/,然后将lib复制过去先。
?
执行完这3条命令之后,apache就安装到你的 /usr/local/apache2目录下了.?
# cd /usr/local/apache2?
# ls?
可以看到里面有 /bin ,/conf , /htdocs, /cgi-bin 等目录.此时apache还没有启动,我们通过/bin目录下的工具apachectl来启动,首先切换到/bin目录:?
# cd ./bin?
然后启动:?
# ./apachectl start?
这时候在地址栏输入 http://localhost/ 看看是不是有成功的信息?
?
如ok,则安装完毕。我本机报错如下:
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
(13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
?
需要修改/usr/local/apache2/conf/httpd.conf ?
将ServerName localhost:8080 注释去掉并修改端口 。
将文件中Listen 80将它改为Listen 8080
?
之后重新启动,输入http://localhost:8080/。 然后就没有然后了,已经ok了。页面出现
?
?
?
?
?
?