apache是什么:
Apache是世界使用排名第一的Web服務器軟件。它可以運行在幾乎所有廣泛使用的計算機平臺上,由于其跨平臺和安全性被廣泛使用,是最流行的Web服務器端軟件之一。它快速、可靠并且可通過簡單的API擴充,將Perl/Python等解釋器編譯到服務器中。同時Apache音譯為阿帕奇,是北美印第安人的一個部落,叫阿帕奇族,在美國的西南部。也是一個基金會的名稱、一種武裝直升機等等。
今天嘗試著安裝apache,要求能訪問,庫文件和軟鏈接,還有man幫助暫不闡述
前言:安裝apache之前,檢查gcc編譯器是否安裝
[root@localhost tmp]# rpm -qa |grep gcc libgcc-4.4.7-17.el6.x86_64 gcc-4.4.7-17.el6.x86_64
我這里已經裝過,沒安裝的話使用yum -y install gcc安裝。
1、從apacha官網下載httpd包,http://apache.fayea.com/httpd 解壓并cd到子目錄:
[root@localhost ~]# tar -xf httpd-2.4.10.tar.bz2 [root@localhost ~]# cd httpd-2.4.10 [root@localhost httpd-2.4.10]#
執行./configure,指定安裝路徑/usr/local/apache2
[root@localhost httpd-2.4.10]# ./configure --prefix=/usr/local/apache2 .. checking for APR... no configure: error: APR not found. Please read the documentation. [root@localhost httpd-2.4.10]#
發現報錯,提示沒有找到APR的路徑,從http://apache.fayea.com/apr/ 下載源碼包apr,解壓并cd到子目錄
[root@localhost ~]# tar -xf apr-1.5.0.tar.bz2 [root@localhost ~]# cd apr-1.5.0 [root@localhost apr-1.5.0]# ./configure --prefix=/usr/local/apr/ 沒有報錯,繼續安裝 [root@localhost apr-1.5.0]# make && make install 沒有報錯,安裝成功!
2、再次安裝httpd包,指定apr路徑
[root@localhost httpd-2.4.10]# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr/ .. configure: checking for APR-util... no configure: error: APR-util not found. Please read the documentation. [root@localhost httpd-2.4.10]#
發現缺少apr-util包,從http://apache.fayea.com/apr/下載apr-util包,解壓后cd到子目錄,執行./confgure 指定apr路徑,順便make和make install
[root@localhost apr-util-1.5.3]# ./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr/ && make && make install .. /usr/bin/install -c -m 644 aprutil.exp /usr/local/apr-util//lib /usr/bin/install -c -m 755 apu-config.out /usr/local/apr-util//bin/apu-1-config [root@localhost apr-util-1.5.3]# 成功安裝,沒有報錯
3.再次嘗試安裝httpd包,提示缺少pcre包
[root@localhost httpd-2.4.10]# ./configure --prefix=/usr/local/apache2/ --with-apr=/usr/local/apr/ \--with-apr-util=/usr/local/apr-util/ .. checking for pcre-config... false configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/ [root@localhost httpd-2.4.10]#
從提示信息的官網下載pcre包 http://pcre.org,解壓,cd到子目錄,指定apr和apr-util安裝路徑
[root@localhost pcre-8.38]# ./configure --prefix=/usr/local/pcre/ --with-apr=/usr/local/apr/ \--with-apr-util=/usr/local/apr-util/ .. checking for windows.h... no configure: error: You need a C++ compiler for C++ support.
這里提示我沒有安裝C++編譯器,yum安裝
[root@localhost pcre-8.38]# yum -y install gcc-c++
再次安裝pcre
[root@localhost pcre-8.38]# ./configure --prefix=/usr/local/pcre/ --with-apr=/usr/local/apr/ \--with-apr-util=/usr/local/apr-util/ [root@localhost pcre-8.38]# make && make install
4、最后安裝httpd包,指定apr,apr-util,pcre 路徑
[root@localhost httpd-2.4.10]# ./configure --prefix=/usr/local/apache2/ --with-apr=/usr/local/apr/ \--with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/ .. [root@localhost httpd-2.4.10]# make && make install mkdir /usr/local/apache2/manual make[1]: Leaving directory `/root/httpd-2.4.10' [root@localhost httpd-2.4.10]#
買有什么報錯,啟動服務
[root@localhost httpd-2.4.10]# /usr/local/apache2/bin/apachectl start AH00558: httpd: Could not reliably determine the server's fully qualified domain name, \using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message [root@localhost httpd-2.4.10]#
這里有個報錯,提示主機名有問題,沒什么大礙,不用管它,去網頁檢測一下
成功了。若訪問不了,可能是防火墻的原因,iptables -F關閉它。
提示:在編譯安裝過程中,一定要cd 到解壓之后的包目錄,再執行./confgure 等操作。
原創文章,作者:M20-1--孔祥文,如若轉載,請注明出處:http://www.www58058.com/39702