24h購物| | PChome| 登入
2007-04-20 13:55:58 | 人氣50| 回應0 | 上一篇 | 下一篇
推薦 0 收藏 0 轉貼0 訂閱站台

Solaris 10 安裝 Apache2

bash-3.0.0#gunzip httpd-2.2.4.tar.gz
bash-3.0.0#tar xf httpd-2.2.4.tar
bash-3.0.0#cd httpd-2.2.4
bash-3.0.0#./configure --prefix=/usr/local/apache-2.2.4
bash-3.0.0#make
bash-3.0.0#make install
bash-3.0.0#ln -s /usr/local/apache-2.2.4 /usr/local/apache

以上為一般安裝的方式,現在要把 Apache2 加入 Solaris10 的 SMF 來管理。

Solaris10 安裝時如果選擇所有套件全裝的話,應該就有裝 Apache2 以及其 SMF 的管理設定,現在就拿其管理設定來改成自己要的:

首先修改 SMF Service Mathods 服務:

bash-3.0.0#cd /lib/svc/method

先備份原來的 Script 檔:

bash-3.0.0#cp http-apache2 http-apache2.orig
bash-3.0.0#vi http-apache2

修改 http-apache2 的內容:

1. 改 APACHE_HOME, CONF_FILE, PIDFILE 3 個變數的內容為自己安裝的路徑及檔名
2. 因為 Apache 編譯時沒 SSL 支援, 所以把有關 SSL 的用 # Mark 起來
3. 把強迫砍掉 pid 的指令也 Mark 起來
4. 把新增 Log 資料夾的指令也 Mark 起來

整個檔案如下:

#!/sbin/sh
#
# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# ident "@(#)http-apache2       1.2     04/11/11 SMI"
#

. /lib/svc/share/smf_include.sh

APACHE_HOME=/usr/local/apache
CONF_FILE=/usr/local/apache/conf/httpd.conf
PIDFILE=/usr/local/apache/logs/httpd.pid

[ ! -f ${CONF_FILE} ] &&  exit $SMF_EXIT_ERR_CONFIG

case "$1" in
start)
#       /bin/rm -f ${PIDFILE}
#       /bin/mkdir -p /usr/local/apache/logs
#       ssl=`svcprop -p httpd/ssl svc:/network/http:apache2`
#       if [ "$ssl" = false ]; then
                cmd="start"
#       else
#               cmd="startssl"
#       fi
        ;;
refresh)
        cmd="graceful"
        ;;
stop)
        cmd="stop"
        ;;
*)
        echo "Usage: $0 {start|stop|refresh}"
        exit 1
        ;;
esac

exec ${APACHE_HOME}/bin/apachectl $cmd 2>&1


再來, 要備份及修改 SMF 清單(Manifest):

bash-3.0.0#cd /var/svc/network
bash-3.0.0#cp http-apache2.xml http-apache2.xml.orig
bash-3.0.0#vi http-apache2.xml

找到 manpath,改成自己安裝的 Apache 路徑即可,
整個檔案如下:







        name='network/http'
        type='service'
        version='1'>

       

       
               
                                    grouping='require_all'
                    restart_on='error'
                    type='service'>
                   
               


               
                                    grouping='require_all'
                    restart_on='none'
                    type='service'>
                                            value='svc:/system/filesystem/local:default'/>
               


               
                                    grouping='optional_all'
                    restart_on='error'
                    type='service'>
                                            value='svc:/system/filesystem/autofs:default'/>
               


                                        type='method'
                        name='start'
                        exec='/lib/svc/method/http-apache2 start'
                        timeout_seconds='60' />

                                        type='method'
                        name='stop'
                        exec='/lib/svc/method/http-apache2 stop'
                        timeout_seconds='60' />

                                        type='method'
                        name='refresh'
                        exec='/lib/svc/method/http-apache2 refresh'
                        timeout_seconds='60' />

               
                       
                       
               


               
                       
                                                        value='core,signal' />
               


       


       

       





最後,再註冊即可:

bash-3.0.0#svccfg import /var/svc/manifest/network/http-apache2.xml

如此,就可以使用 svcadm 來啟動或停止 Apache2:

bash-3.0.0#svcadm disable network/http:apache2
bash-3.0.0#svcadm enable network/http:apache2

台長: 到處看看
人氣(50) | 回應(0)| 推薦 (0)| 收藏 (0)
全站分類: 數位資訊(科技、網路、通訊、家電) | 個人分類: Solaris |
此分類下一篇:Solaris Disk Raid 1 過程
此分類上一篇:Solaris 10 安裝 IMAP/POP3

是 (若未登入"個人新聞台帳號"則看不到回覆唷!)
* 請輸入識別碼:
請輸入圖片中算式的結果(可能為0) 
(有*為必填)
TOP
詳全文