2012年11月7日

CentOS 6.3 學習筆記 (3) - apache 編譯版安裝

apache 編譯版安裝




安裝必須工具
#yum -y install wget make libtool gcc gcc-c++

下載 apr
#wget http://apache.stu.edu.tw/apr/apr-1.4.6.tar.gz
下載 apr-util
#wget http://apache.stu.edu.tw/apr/apr-util-1.5.1.tar.gz
下載 pcre
#wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.31.tar.gz
下載 apache編譯版
#wget http://apache.stu.edu.tw/httpd/httpd-2.4.3.tar.gz

解壓縮
#tar zxvf httpd-2.4.3.tar.gz
#tar zxvf apr-1.4.6.tar.gz
#tar zxvf apr-util-1.5.1.tar.gz
#tar zxvf pcre-8.31.tar.gz

安裝 apr
#./configure
#make
#make install

安裝 apr-util
#./configure --with-apr=/usr/local/apr/
#make
#make install

安裝 pcre
#./configure
#make
#make install

安裝 pcre-devel
#yum install pcre-devel

安裝 apache
# ./configure --prefix=/usr/local/web/apache2
#make
#make install

啟動 apache
#cd /usr/local/web/apache2/bin/
#./apachectl start


出現 httpd: Could not open configuration file /usr/local/apache2/conf/httpd.conf: No such file or directory

#ln -s /usr/local/web/apache2 /usr/local/apache2

再啟動一次 apache
#./apachectl start

查看是否有啟動
#ps -ef|grep httpd



11/8 新增
使用 service httpd start(stop) 來啟動(停止) apache 服務
#cd /usr/local/web/apache2/bin
#cp apachectl /etc/rc.d/init.d/httpd


複製 apache 啟動檔並設定開機自動啟動
#cp /usr/local/web/apache2/bin/apachectl  /sbin/
#vi /etc/rc.d/rc.local
增加 /sbin/apachectl start



0 意見:

張貼留言