CENTOS 6.5 平臺離線安裝 Apache2.4

1、下載Apache 2.4

http://httpd.apache.org/download.cgi javascript

http://mirrors.cnnic.cn/apache//httpd/httpd-2.4.10.tar.gz java

解決依賴關係的包 apache

http://www.eu.apache.org/dist/apr/apr-1.5.1.tar.gz ruby

http://www.eu.apache.org/dist/apr/apr-util-1.5.4.tar.gz bash

http://softlayer-sng.dl.sourceforge.net/project/pcre/pcre/8.36/pcre-8.36.tar.gz spa

2、解壓

tar -zxf httpd-2.4.10.tar.gz .net

mv httpd-2.4.10.tar.gz Apache code

3、處理依賴關係

解決apr not found問題 ip

1 tar -zxf apr-1.5.1.tar.gz 2 cd  apr-1.5.1 3 ./configure --prefix=/usr/local/apr 4 make && make install

解決APR-util not found問題 源碼

1 tar -zxf apr-util-1.3.12.tar.gz 2 cd apr-util-1.3.12 3 ./configure --prefix=/usr/local/apr-util -with- apr=/usr/local/apr/bin/apr-1-config 4 make && make install

解決pcre問題

1 tar -zxf pcre-8.36.tar.gz 2 cd  pcre-8.36 3 ./configure --prefix=/usr/local/pcre 4 make && make install

4、卸載自帶的apache

中止HTTPD服務,找到安裝目了刪除安裝文件夾,再刪除配置文件

5、編譯安裝

./configure --prefix=/usr/local/apache2 --enable-deflate --enable-expires --enable-headers --enable-modules=most --enable-so --with-mpm=worker --enable-rewrite --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
1 make 2 make install

5、卸載apache

源碼編譯安裝時經過--prefix 參數指定了安裝目錄,先中止全部服務,把安裝目錄文件夾刪除,而後再到/etc配置文件下刪除配置文件。

而後再經過 find 命令肯定一下就能夠了

6、添加爲服務

cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd vi /etc/rc.d/init.d/httpd 添加(#!/bin/sh下面) # chkconfig: 2345 50 90 # description: Activates/Deactivates Apache Web Server 運行chkconfig把Apache添加到系統的啓動服務組裏面: # chkconfig --add httpd # chkconfig httpd on 啓動服務 service httpd start
相關文章
相關標籤/搜索