1,apache
a)apache官網下載 .tar.gz 結尾的檔案,並且通過ftp傳送到liunx下自建的目錄裡面。
b)解壓 tar -zxvf httpd-2.0.54.tar.gz,並mv將其重新命名為 apach(隨意)
c) ./configure --prefix=/usr/local/http2 \
--enable-modules=all \
--enable-mods-shared=all \
--enable-so
運行是出錯。
........................
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/root/httpd-2.2.11/srclib/apr‘:
configure: error: no acceptable C compiler found in $PATH
See `config.log‘ for more details.
configure failed for srclib/apr
查看了一下原來是錯誤開始於srclib/apr檔案,檢查gcc編譯器時提示沒發現並且在系統內容變數$PATH中沒有合適的c編譯器,以是使用yum -y install gcc來安裝gcc編譯器/或者用rpm包安裝,就可繼續安裝了
再運行,發現
checking whether to enable mod_deflate... checking dependencies
checking for zlib location... not found
checking whether to enable mod_deflate... configure: error: mod_deflate has been requested but can not be built due to prerequisite failures
缺少zlib,yum install zlib-devel –y
make && make install
等待安裝
完畢後
cd /usr/local/apache/bin/conf 備份設定檔 cp –a httpd.conf httpd.conf.back
chkconfig --list httpd //查看httpd服務是否已存在
chkconfig httpd off //關閉系統內建了httpd的服務,如果存在httpd服務
service httpd status //查看內建httpd服務狀態
接著啟動apache
/usr/local/apache/bin/apachect1 –k start
發現無法啟動
httpd: apr_sockaddr_info_get() failed for web154
httpd: Could not reliably determine the server‘s fully qualified domain name, using 127.0.0.1 for ServerName
解決:將apache的設定檔
ServerName localhost:80
再次啟動。ok
#ps aux | grep httpd //linux下查看apache進程
用wget http://127.0.0.1 後無法連結,檢查後是防火牆80連接埠沒有開。
通過 setup 配置下80連接埠tcp協議
在啟動還是沒有啟動,檢查 apache 的錯誤記錄檔發現
[Thu Sep 25 16:49:57 2014] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "web154"
Configuration Failed
在 /etc/hosts 下追加一行 127.0.0.1 web154 localhost
重啟,ok
cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/apache //拷貝apache啟動指令碼
vi /etc/rc.d/init.d/apache // 這裡是編輯apache啟動指令碼
在開頭的#!/bin/sh 下面加上
#chkconfig: 2345 85 15
chkconfig --add apache //添加apache服務
chkconfig --list apache //列出apache服務
ps -aux | grep httpd //查看是否存在httpd服務
至此,apache安裝ok