一個苦逼菜鳥安裝Apache的艱辛歷程
[root@localhost ~]# cd /aa
[root@localhost aa]# tar zxf httpd-2.4.3.tar.gz -C /usr/src
[root@localhost aa]# cd /usr/src
[root@localhost src]# cd httpd-2.4.3/
[root@localhost httpd-2.4.3]# ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite
其中--enable-so 的作用是使httpd服務能夠動態加載模塊功能
--enable-rewrite的作用是使httpd服務具有rewrite網頁地址重寫功能
安裝的時候經常遇到各種錯誤,舉幾個我遇到的問題吧
這時候提示我們APR沒有被發現 APR是什麼呢 我百度了一下
這時候我們就需要下載這個庫文件 http://apr.apache.org/download.cgi/
[root@localhost qq]# tar zxf apr-1.4.6.tar.gz -C /usr/src
[root@localhost qq]# cd /usr/src/apr-1.4.6/
[root@localhost apr-1.4.6]# ./configure --prefix=/usr/local/apr
[root@localhost apr-1.4.6]# make
[root@localhost apr-1.4.6]# make install
這時再去編譯安裝apache 又報錯了 又提示apr-util沒發現
好吧 只能繼續下載了
wget http://apache.etoak.com/apr-util-0.9.19.tar.gz
[root@localhost aa]# tar zxf apr-util-0.9.19.tar.gz -C /usr/src
[root@localhost aa]# cd /usr/src/apr-util-0.9.19/
[root@localhost apr-util-0.9.19]# ./configure --prefix=usr/loacl/apr-util
這樣又報錯了
提示:configure: error: APR could not be located,Please use the --with-apr option
所以需要這樣:
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/
[root@localhost apr-util-0.9.19]# .make
[root@localhost apr-util-0.9.19]# .make install
繼續安裝編譯apache
我是這樣編譯的
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
TMD又報錯了,哥哥怒了
NND又少軟件 尼瑪 今天運氣怎麼這麼點背
好吧 繼續下載軟件
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.21.tar.gz
[root@localhost qq]# tar zxf pcre-8.21.tar.gz -C /usr/src
[root@localhost qq]# cd /usr/src/pcre-8.21/
[root@localhost pcre-8.21]# ./configure --prefix=/usr/local/pcre
好吧 我再來編譯一下apache
./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre
又報錯了,尼瑪 受不了了
這說我版本太低了 檢查了一下 原來是我剛纔下載的apr-util的版本太低了
wget http://apr.apache.org/download.cgi/apr-util-1.5.1.tar.gz
重新編譯安裝一次,步驟參考上面的
現在就是繼續編譯apache
./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre
然後make
再 make install
啓動apache
[root@localhost httpd-2.4.3]# /usr/local/apache2/bin/apachectl start
[root@localhost httpd-2.4.3]# netstat -nutlp | grep 80
tcp 0 0 0.0.0.0:680 0.0.0.0:* LISTEN 2618/rpc.statd
tcp 0 0 :::80 :::* LISTEN 13704/httpd
終於把apache安裝成功了!以前安裝從未遇到過問題,今天比較走運