Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> Linux 教學

RedHat 5.5 下 Apache 2.2.6 原始碼編譯安裝完整實戰筆記

編輯:Linux 教學

記錄在 RedHat Enterprise Linux 5.5 上從原始碼編譯安裝 Apache HTTP Server 2.2.6 的完整流程,供後續部署參考。

環境準備

  • 下載 httpd-2.2.6.tar.bz2 放置 /soft
  • 解壓:tar jxvf httpd-2.2.6.tar.bz2
  • 進入目錄:cd httpd-2.2.6

配置與編譯

./configure --help | more          # 查看參數
./configure --prefix=/usr/local/apache --enable-so  # 指定安裝路徑、啟用 DSO
make                               # 編譯
make install                       # 安裝

後續設定

cd /usr/local/apache/conf
cp -a httpd.conf httpd.conf-       # 備份原始設定
chkconfig --list httpd             # 檢查系統自帶 httpd
chkconfig httpd off                # 關閉自帶服務
service httpd status               # 確認狀態
/usr/local/apache/bin/apachectl -k start  # 啟動新編譯的 Apache
netstat -an | grep :80             # 驗證 80 埠
ps -aux | grep httpd               # 檢視進程

註冊為系統服務

cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/apache
vi /etc/rc.d/init.d/apache          # 在 #!/bin/sh 下加入 #chkconfig: 2345 85 15
chkconfig --add apache
chkconfig --list apache
service apache stop                 # 測試停止
netstat -an | grep :80
ps -aux | grep httpd                # 確無殘留進程
service apache start                # 啟動服務

瀏覽器輸入伺服器 IP,若出現 Apache 預設首頁(非 Tomcat),即代表安裝成功。

Copyright © Windows教程網 All Rights Reserved