源碼安裝httpd2.4.4

閒話不說,進入正題

 

 

準備工具

httpd_-2.4.4.tar.bz2

apr-1.4.6.tar.gz(apache的一個可移植的運行庫) 

apr-util-1.5.1.tar.gz

 

mkdir /mnt/cdrom

mount  /dev/cdrom  /mnt/cdrom/(建立光盤掛載點)

cd /mnt/cdrom/Server/

ll   apr*

rpm  -ivh  apr-devel-1.2.7-11.e15_3.1.i386.rpm(安裝apr 開發包)

 

安裝apr-1.4.6運行庫

tar  -zxvf  apr-1.4.6.tar.gz -C/usr/local/src/

cd /usr/local/src/apr-1.4.6/

配置apr-1.4.6

 

 ll

less README

 ./configure (默認安裝到/usr/local目錄下自動生成的apr目錄下)

make

make install

cd

安裝apr-util-1.5.1

 tar -zxvf apr-util-1.5.1.tar.gz -C /usr/local/src/

cd /usr/local/src/apr-util-1.5.1/

ll

ls

./configure

./configure --with- apr=/usr/local/apr/bin/apr-1-config(要指定apr-config的完整路徑

make

make install

Cd

安裝pcre 及其開發包(別問爲什麼要裝這個,不裝會出問題的。。。)

ll /mnt/cdrom/Server/pcre*

rpm -ivh  /mnt/cdrom/Server/pcre-6.6-2.el5_1.7.i386.rpm

rpm -ivh  /mnt/cdrom/Server/pcre-devel-6.6-2.e15_1.7.i386.rpm

 

安裝http2.4.4

tar -jxvf httpd-2.4.4.tar.bz2 -C /usr/local/src/

 cd /usr/local/src/httpd-2.4.4/

 

cd  /usr/local/apr

vim  /etc/ld.so.conf.d/apr.conf

寫入路徑/usr/local/apr/lib(讓系統調用運行庫)

ldconfig加載

 

 

./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd(配置文件目錄)--with-apr=/usr/local/apr/bin/apr-1-config(要指定apr-config的完整路徑

 

 

make

make install

cd /usr/local/

cd bin/

./apachectl start

netstat   -tupln  |grep 80(查看80端口是否啓動

此時調用的是apachectl,那麼我們想調用自己的腳本來啓動apache呢? 

那就寫腳本吧。。

 

cd /etc/init.d

vim httpd 

 

#!/bin/bash

#descriptionion: httpd server

#chkconfig:   -88  90

HTTPD=/usr/local/apache/bin/httpd

CONFFILE=etc/httpd/httpd.conf

. /etc/init.d/FUNCTIONS

start()  {

[-f   /var/lock/subsys/http ] && echo  httpd  is starting....

  echo -n  httpd   is starting......

sleep 1

$HTTPD -f  $CONFFILE  && RETVAL=0||RETVAL=1

[$RETVAL   -eq  0] &&touch /var/lock/subsys/http && echo -e  \033[31m  [ok]  \033[0m||echo  -e  \033[31m   [fail]  \033[0m

}

stop (){

Echo -n  httpd is stoping.....

sleep 1

killproc  httpd  && RETVAL=0||RETVAL=1

[$RETVAL   -eq  0] && rm -rf  /var/lock/subsys/http ||echo  -e  \033[31m   [fail]  \033[0m

 

}

 

case $1  in

start)

  start

;;

stop)

stop

;;

restart)

stop

start

;;

*)

echo Usage:start|stop|restart

;;

esac

 

 

chmod   a+x  httpd

chkconfig  --add httpd(把httpd服務設置開機自啓動)

結束

 

       

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章