王高利:Linux__apache,安裝,報錯解決

今日編譯apache時出錯:

#./configure --prefix……檢查編輯環境時出現:

checking for APR... no
configure: error: APR not found .  Please read the documentation

解決辦法:

1.下載所需軟件包:

wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz 
wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip

2.編譯安裝:

a:解決apr not found問題>>>>>>

[root@localhost test]# tar -zxf apr-1.4.5.tar.gz
[root@localhost test]# cd  apr-1.4.5
[root@localhost apr-1.4.5]# ./configure --prefix=/usr/local/apr
[root@localhost apr-1.4.5]# make && make install

b:解決APR-util not found問題>>>>

[root@localhost test]# tar -zxf apr-util-1.3.12.tar.gz
[root@localhost test]# cd apr-util-1.3.12
[root@localhost apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config
[root@localhost apr-util-1.3.12]# make && make install

c:解決pcre問題>>>>>>>>>

[root@localhost test]#unzip -o pcre-8.10.zip
[root@localhost test]#cd pcre-8.10
[root@localhost pcre-8.10]#./configure --prefix=/usr/local/pcre
[root@localhost pcre-8.10]#make && make install

3.最後編譯Apache時加上:

[root@localhost httpd-2.2.31]# ./configure --prefix=/usr/local/httpd --enable-so --enable-cgi --enable-charset-lite --enable-rewrite --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/ && make && make install

安裝後輸出內容爲:

mkdir /usr/local/httpd/build
Installing man pages and online manual
mkdir /usr/local/httpd/man
mkdir /usr/local/httpd/man/man1
mkdir /usr/local/httpd/man/man8
mkdir /usr/local/httpd/manual
make[1]: Leaving directory `/usr/src/httpd-2.2.31'
[root@localhost httpd-2.2.31]#

4.配置服務

[root@localhost httpd-2.2.31]# ln -s /usr/local/httpd/bin/apachectl /etc/init.d/httpd
[root@localhost httpd-2.2.31]# vim /etc/init.d/httpd
#!/bin/sh
# chkconfig:35 85 15  #添加
# description:描述信息,隨便寫!#添加
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
略………………
[root@localhost httpd-2.2.31]# chmod +x httpd
[root@localhost httpd-2.2.31]# chkconfig --level 35 httpd on

5.啓動服務

[root@localhost httpd-2.2.31]# service  httpd start #警告解決方法,編輯配置文件,將ServerName去掉註釋重啓服務即可,例如:ServerName 127.0.0.1:80
httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
[root@localhost httpd-2.2.31]#

6.防火牆設置

[root@localhost httpd-2.2.31]# iptables -I INPUT -m multiport -p tcp --dport 80 -j ACCEPT
[root@localhost httpd-2.2.31]# service  iptables save
iptables:將防火牆規則保存到 /etc/sysconfig/iptables:     [確定]

7.測試

wKioL1cjG62ShAd7AAAxhOREYb0248.png


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章