作者【Jev Tse】【版權所有】 系統環境:centos6.8
【本文概覽】
零、httpd2.4.10編譯總結
1、基礎環境
2、依賴包組
一、安裝前準備
二、編譯踩坑
1、第一個坑:APR not found (ARP-Ulit not fount)
2、第二個坑:pcre-config for libpcre not found.
3、第三個坑:g++: command not found
4、第四個坑:make[1]: *** [libpcrecpp.la] Error 1
5、第五個坑:httpd報錯AH00557 AH00558
三、測試服務
四、踩坑總結
1、基礎環境:
安裝"Development Tools"包組
安裝升級gcc、gcc-g++組件
2、依賴包組:
apr、apr-ulit、pcre
包組來源:
wget http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz
wget http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.20/pcre-8.20.zip
1、系統環境:centos6.8
2、安裝開發軟件包組以及GCC:
[root@6 Jev Tse testdir]#yum groupinstall "Development Tools" [root@6 Jev Tse testdir]#yum install gcc
3、解壓httpd-2.4.10.tar.bz2
[root@6 Jev Tse testdir]#tar xvf httpd-2.4.10.tar.bz2 [root@6 Jev Tse testdir]#cd httpd-2.4.10
1、第一個坑:APR not found (ARP-Ulit not fount)
鑒于我在centos7安裝httpd-2.2.29的經驗,直接./configure [root@6 Jev Tse httpd-2.4.10]#./configure --prefix=/usr/local/Jev-apache2 checking for APR... no configure: error: APR not found . Please read the documentation 查看安裝相關文件 [root@6 Jev Tse testdir]#cat README INSTALL * * * * * * Consider if you want to use a previously installed APR and APR-Util (such as those provided with many OSes) or if you need to use the APR and APR-Util from the apr.apache.org project. If the latter, download the latest versions and unpack them to ./srclib/apr and ./srclib/apr-util (no version numbers in the directory names) and use./configure's --with-included-apr option. * * * * * * 從INSTALL 得出: 安裝環境需要安裝apr 以及apr-ulit,并使用--with-included-apr的選項 # 安裝apr-1.5.2組件 [root@6 Jev Tse httpd-2.4.10]#reset #清理環境,排除其他干擾 [root@6 Jev Tse testdir]#wget \ http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz [root@6 Jev Tse testdir]#tar vxf apr-1.5.2.tar.gz [root@6 Jev Tse testdir]#cd apr-1.5.2 [root@6 Jev Tse apr-1.5.2]# cat README [root@6 Jev Tse apr-1.5.2]# ./configure --prefix=/usr/local/apr [root@6 Jev Tse apr-1.5.2]#make && make install [root@6 Jev Tse apr-1.5.2]#echo $? #查看返回值,確定操作無誤 # 安裝apr-util-1.5.2組件 [root@6 Jev Tse testdir]#wget \ http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz [root@6 Jev Tse testdir]# tar vxf apr-util-1.5.2.tar.gz [root@6 Jev Tse testdir]#cd apr-util-1.5.2 [root@6 Jev Tse apr-util-1.5.2]#./configure --prefix=/usr/local/apr-util \ --with-apr=/usr/local/apr #安裝環境需要安裝apr 需使用--with-included-apr的選項 [root@6 Jev Tse apr-util-1.5.2]#make && make install [root@6 Jev Tse apr-util-1.5.2]#echo $? #查看返回值,確定操作無誤
2、第二個坑:pcre-config for libpcre not found.
#重新編譯安裝apache [root@6 Jev Tse testdir]#cd /testdir/httpd-2.4.10 [root@6 Jev Tse Tse httpd-2.4.10]#./configure \ --prefix=/usr/local/Jev-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-8.20組件 [root@6 Jev Tse testdir]#reset #清理環境,排除其他干擾 [root@6 Jev Tse testdir]#wget \ http://jaist.dl.sourceforge.net/project/pcre/pcre/8.20/pcre-8.20.zip [root@6 Jev Tse testdir]#unzip -o pcre-8.20.zip [root@6 Jev Tse testdir]#cd pcre-8.20
3、第三個坑:g++: command not found
[root@6 Jev pcre-8.20]#./configure --prefix=/usr/local/pcre ./libtool: line 990: g++: command not found [root@6 Jev pcre-8.20]#reset [root@6 Jev pcre-8.20]#yum install gcc-c++
4、第四個坑:make[1]: *** [libpcrecpp.la] Error 1
[root@6 Jev pcre-8.20]#./configure --prefix=/usr/local/pcre make[1]: *** [libpcrecpp.la] Error 1 make[1]: Leaving directory `/testdir/test1/pcre-8.20' make: *** [all] Error 2 從網上查資料得到,需加--disable-shared --with-pic 選項 [root@6 Jev pcre-8.20]#reset #清理環境,排除其他干擾 [root@6 Jev pcre-8.20]#./configure --prefix=/usr/local/pcre \ --disable-shared --with-pic [root@6 Jev pcre-8.20]#make && make install [root@6 Jev pcre-8.20]#echo $? #查看返回值,確定操作無誤 #再次編譯安裝apache [root@6 Jev pcre-8.20#reset #清理環境,排除其他干擾 [root@6 Jev pcre-8.20]# cd ../httpd-2.4.10 [root@6 Jev httpd-2.4.10]#./configure --prefix=/usr/local/Jev-apache2 \ --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ \ --with-pcre=/usr/local/pcre [root@6 Jev httpd-2.4.10]#make && make install [root@6 Jev httpd-2.4.10]#echo $? #查看返回值,確定操作無誤 [root@6 Jev httpd-2.4.10]#cd ../ [root@6 Jev Tse testdir]#PATH=$PATH:/usr/local/ Jev-apache2/bin/ > \ /etc/profile.d/ Jev-apache2.sh #添加環境變量 [root@6 Jev Tse testdir]#source /etc/profile.d/ Jev-apache2.sh #加載環境變量
5、第五個坑:httpd報錯AH00557 AH00558
[root@6 Jev Tse testdir]#apachectl start AH00557: httpd: apr_sockaddr_info_get() failed for ... AH00558: httpd: ... #經檢測,這兩個錯誤是apache主機名出錯 #在httpd.conf 配置文件指定ServerName host 即可 [root@6 Jev Tse testdir]# apachectl stop [root@6 Jev Tse testdir]#vim /usr/local/Jev-apache2/conf/httpd.conf #在httpd.conf 配置文件加入“ServerName 172.16.250.69” [root@6 Jev Tse testdir]# apachectl start httpd (pid 58548) already running
確認服務狀態
[root@6 Jev Tse testdir]#netstat -ant |grep :80 #查看80端口是否正常 tcp 0 0 :::80 :::* LISTEN [root@6 Jev Tse testdir]#iptables –F #清理防火墻 [root@6 Jev Tse testdir]#iptables –vnL #確認防火墻狀態 Chain INPUT (policy ACCEPT 11165 packets, 1052K bytes) pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination hain OUTPUT (policy ACCEPT 156 packets, 16554 bytes) pkts bytes target prot opt in out source destination #編輯網頁 [root@6.Jev Tse ~]#vim /usr/local/Jev-apache2/htdocs/index.html
經測試網頁能正常訪問,大功告成
1、編譯軟件前需看清楚,軟件編譯環境需求,可以避免不必要的麻煩。
2、編譯出錯后,用reset清理系統環境,排除其他干擾,再繼續操作。
3、碰到錯誤,先根據錯誤提示以及安裝幫助文檔排錯。
4、確實解決不了才到社區查找相關資料。
作者【Jev Tse】【版權所有】
原創文章,作者:Jev Tse,如若轉載,請注明出處:http://www.www58058.com/61405
Int??ressant cet article, on parle souvent du vent dans le SEO, mais jamais du n??ant!Et pourtant il est vraiment important de savoir g??rer l’espace, un peu comme sa respiration dans une longue phrase. Sinon le visiteur/auditeur d??croche et zappe…Ca me rappelle deux acronymes ricains que j&oequr;affsctionne : KISS, « keep it stupid and simple » et le fameux « less is more » !