Linux Server /var/spool/clientmqueue 目錄下產生大量文件的解決方法

今天在檢查兩台 AAA server 時才發現居然 / 已經到了 94% 了,SNMP server 上滿滿都是從這兩台機器上送來的 Alarm Traps;這可真是糟糕,趕快查一下到底是啥東西佔了這麼多硬碟空間...
[root@KHXAAAS2 ~]# df -h;
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 4.0G 3.6G 237M 94% /
/dev/sda1 1012M 40M 921M 5% /boot
none 4.0G 0 4.0G 0% /dev/shm
/dev/sda3 4.0G 41M 3.7G 2% /inactive_root
/dev/sda6 21G 78M 19G 1% /others
/NFSDB/radacct 537G 384M 509G 1% /opt/AAA-6.1.8-20081202/run/radacct
KHXDB:/DB/accounting 537G 384M 509G 1% /NFSDB/radacct
首先到 / 下面用 du -sh * 來查詢一下目前的 / 的使用狀態:
[root@KHXAAAS2 ~]# cd /
[root@KHXAAAS2 /]# du -sh *
5.6M bin
6.4M boot
216K dev
44M etc
32K home
20K inactive_root
8.0K initrd
97M lib
16K lost+found
16K media
8.0K misc
8.0K mnt
247M NFSDB

1.3G opt
2.0M others
du: cannot read directory `proc/857/task': No such file or directory
du: cannot read directory `proc/857/fd': No such file or directory
916M proc
2.0M root
176K rpm
18M sbin
0 selinux
8.0K srv
0 sys
336K tmp
2.0G usr

1.5G var
很明顯的,/opt 跟 /var 佔了很大的空間,/opt 我安裝了幾個大的 AAA service 在裡面,先慢點處理,這個 /var 佔據了 1.5G 實在有點奇怪了,繼續往下查...
[root@KHXAAAS2 /]# cd /var
[root@KHXAAAS2 var]# du -sh *
12K account
2.2M cache
16K crash
28K db
32K empty
16K ftp
300K gdm
41M lib
8.0K local
132K lock
42M log
4.0K mail
24K net-snmp
8.0K nis
8.0K opt
8.0K preserve
276K run

1.5G spool
8.0K tmp
8.0K tux
2.1M www
24K yp
看來 spool 的目錄下有問題,繼續...
[root@KHXAAAS2 var]# cd spool/
[root@KHXAAAS2 spool]# ls -al
total 6404
drwxr-xr-x 13 root root 4096 Jun 12 2008 .
drwxr-xr-x 23 root root 4096 Jun 12 2008 ..
drwxr-xr-x 2 root root 4096 Jun 12 2008 anacron
drwx------ 3 daemon daemon 4096 Jun 12 2008 at

drwxrwx--- 2 smmsp smmsp 6443008 Dec 24 12:53 clientmqueue
drwx------ 2 root root 4096 Dec 24 11:49 cron
drwx--x--- 3 root sys 4096 Jun 12 2008 cups
drwxr-xr-x 2 root root 4096 Aug 13 2004 lpd
drwxrwxr-x 2 root mail 4096 Aug 13 2004 mail
drwx------ 2 root mail 4096 Jan 23 2007 mqueue
drwxr-xr-x 2 rpm rpm 4096 Aug 2 2007 repackage
drwxr-xr-x 2 root root 4096 Sep 5 2007 up2date
drwxrwxrwt 2 root root 4096 Oct 5 2004 vbox

[root@KHXAAAS2 spool]# du -sh *
32K anacron
20K at

1.5G clientmqueue
16K cron
16K cups
8.0K lpd
8.0K mail
8.0K mqueue
8.0K repackage
8.0K up2date
8.0K vbox
[root@KHXAAAS2 spool]# cd clientmqueue/
[root@KHXAAAS2 clientmqueue]# du -sh *
-bash: /usr/bin/du: Argument list too long
看起來,這個 /var/spool/clientmqueue 的目錄下的東西太多了,連 du 的指令都下不了,我們用 ls 來看一下好了...
[root@KHXAAAS2 clientmqueue]# ls
dfm5C422X2007728 dfmA8CE2sU014445 dfmAQIX3He008540 dfmBF1O3tM024344 qfm9U9325M025071 qfmAHFp3o7008591 qfmB5MG2ik015455 dfm5D421x8008729 dfmA8CF2ex014725 dfmAQIY3JM008766 dfmBF1P2CK024575 qfm9U942p8025326 qfmAHFq22Z008848 qfmB5MH2dU015683 dfm5D4222i021334 dfmA8Cf2Oe022040 dfmAQIZ2lS008993 dfmBF1p2T6030541 qfm9U953gs025583 qfmAHFQ2RH002131 qfmB5Mh2Zw021688 dfm5DK23Jv003790 dfmA8CG2TR015000 dfmAQJ02LM014708 dfmBF1q22Z030769 qfm9U962PF025835 qfmAHFR22P002445 qfmB5Mi3jw021934 dfm5EK22jL009067 dfmA8Cg3uP022313 dfmAQJ13b6014942 dfmBF1Q2Tk024802 qfm9U972GP026084 qfmAHFr2PM009102 qfmB5MI3sc015914 dfm5OK314c006681 dfmA8Ch291022592 dfmAQJ23VT015171 dfmBF1r3jO030995 qfm9U983lb026334 qfmAHFs2XF009366 qfmB5MJ2hf016139 dfm5PK323O007690 dfmA8CH2so015312 dfmAQJ32Tu015402 dfmBF1R3xM025033 qfm9U992mX026621 qfmAHFS3sD002719 qfmB5Mj3Ia022161 dfm5QK32Ur008747 dfmA8Ci25T022861 dfmAQJ420C015631 dfmBF1s2LO031226 qfm9U9A20p026912 qfmAHFT2AP002970 qfmB5MK2P7016366 dfm5RK335g022157 dfmA8CI2UK015587 dfmAQJ52GN015858 dfmBF1S3st025260 qfm9U9a31w001040 qfmAHFt2ha009618 qfmB5Mk2SN022392 dfm5SK32xd023117 dfmA8Cj23T023137 dfmAQJ62Dm016089 dfmBF1T2Qt025491 qfm9U9B2aF027174 qfmAHFU2RT003229 qfmB5Ml2Ab022619 dfm5UK31gY007333 dfmA8CJ34Q015865 dfmAQJ72B4016316 dfmBF1t2RL031453 qfm9U9b2dR001296 qfmAHFu3dG009875 qfmB5ML2kM016594 dfm61K328o008143 dfmA8Ck20E023413 dfmAQJ82fO016547 dfmBF1U250025718 qfm9U9c22o001541 qfmAHFv30Z010126 qfmB5Mm2Gk022851 dfm62K32BT010023 dfmA8CK3r4016134 dfmAQJ93WG016775 dfmBF1u39e031684 qfm9U9C29A027419 qfmAHFV3pd003482 qfmB5MM2ZI016827 dfm63K32ia011151 dfmA8CL2dQ016417 dfmAQJa2On023080 dfmBF1v2Gh031911 qfm9U9d2Wa001793 qfmAHFW2J4003739 qfmB5Mn2fg023079 dfm64K32E5011955 dfmA8Cl3SM023691 dfmAQJA3DY017002 dfmBF1V2s6025962 qfm9U9D3p9027670 qfmAHFw2XB010386 qfmB5MN3Wi017052 dfm65K31uZ012771 dfmA8CM27o016689 dfmAQJB2YJ017245 dfmBF1w2pd032138 qfm9U9E2uC027923 qfmAHFX2Ep003993 qfmB5Mo3oH023305 dfm67K31mg029851 dfmA8Cm39g023966 dfmAQJb3pV023307 dfmBF1W2tF026190 qfm9U9e2Xh002049 qfmAHFx2kM010637 qfmB5MO3oS017280 dfm68K310Y030656 dfmA8CN2BY016971 dfmAQJC2qs017472 dfmBF1X3iF026417 qfm9U9F2kZ028177 qfmAHFY2Zm004250 qfmB5MP2jh017506 ^C
看起來真的是太多了,只好先用 Ctrl+C 中斷一下,不過幸好這些檔案產生的原因都是由於有某個用戶 (通常是 root 啦)新增了某個 cron job,而 cron job 裡面程序有輸出內容,這些內容會以 mail 的方式發給剛剛建立 cron job 的用戶,假如這時 sendmail 沒有啟動便會產生這些 queue 檔,基本上並不是什麼重要的檔案,一句話,殺無赦就對了~

不過由於這個目錄下的檔案太多,用 rm 的指令通常會得到像剛剛 du 所看到的錯誤訊息:
-bash: /bin/rm: Argument list too long
看來直接用 rm 是殺不掉了,沒關係,那就用下面的指令吧:
[root@KHXAAAS2 clientmqueue]# pwd
/var/spool/clientmqueue
[root@KHXAAAS2 clientmqueue]# ls | xargs rm -f
[root@KHXAAAS2 clientmqueue]# ls -al
total 6316
drwxrwx--- 2 smmsp smmsp 6443008 Dec 24 13:18 .
drwxr-xr-x 13 root root 4096 Jun 12 2008 ..
看吧,用了 ls | xargs rm -f 果然輕鬆的就殺掉這一堆的檔案囉,在檢查一下硬碟的使用狀況:
[root@KHXAAAS2 clientmqueue]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 4.0G 2.9G 956M 76% /
/dev/sda1 1012M 40M 921M 5% /boot
none 4.0G 0 4.0G 0% /dev/shm
/dev/sda3 4.0G 41M 3.7G 2% /inactive_root
/dev/sda6 21G 78M 19G 1% /others
/NFSDB/radacct 537G 384M 509G 1% /opt/AAA-6.1.8-20081202/run/radacct
KHXDB:/DB/accounting 537G 384M 509G 1% /NFSDB/radacct

[root@KHXAAAS2 clientmqueue]#
看吧,果然清空之後,使用空間多了很多...不過這只是治標,不是治本,重點是要記得去把那個兇手,也就是那個 cron job 的最後加上一段 > /dev/null 2>&1,例如:
[root@KHXAAAS2 ~]# crontab -l
* * * * * /etc/init.d/snmp_cron.sh > /dev/null 2>&1
這樣就可以避免問題再次重複發生囉...OK,報告完畢~
(詳全文...)

夜空中的笑臉


今天在客戶這邊上完課要回飯店時,一抬頭突然發現夜空中的月亮似乎有些不一樣,怎麼好像一張笑臉似的,感覺月亮上方的兩顆星星超亮的說,趕緊叫住 Jason 與小廖,拿出手機來拍,不過拍出的效果實在@#$%....

於是乾脆到車上拿車相機來拍,回到飯店將照片寄給洋蔥媽咪看,才發現原來大家都看到了啊,上網查詢了一下,原來今天是初四的眉月,月亮如上揚的嘴角,加上月亮上方的那兩顆星星是金星與木星呢,難怪我覺得怎麼今天的星星這麼亮...據說,這種天文景象,下次要到 2036 年才會再出現呢,雖然和洋蔥媽咪及小洋蔥分處在高雄與台北,但我們仍能一起看到同樣的星空,我想,應該也是一種幸福吧~ (詳全文...)

如何在 WindowsXP 上叫出 NetMeeting ㄌㄟ?

同事突然問說 WindowsXP 上怎麼沒有 NetMeeting ㄌㄟ?要怎麼把他叫出來啊?
呵呵,其實,WindowsXP 上面還是有附 NetMeeting 的,只是沒有捷徑罷了,他的路徑就在 C:\Program Files\NetMeeting\conf.exe 啦,直接執行或拉個捷徑出來就行了,當然也可以用下面的方式叫出來:
1. 由左下角的[開始]功能表,選 [執行]:

2. 敲入conf,按下碓定執行:
3. NetMeeting 打開囉...

不過我順便在另一台 Windows Vista 上試了一下,發現原來 Vista 上已經將 NetMeeting 拿掉,改成 Windows 會議室了;以下是 Microsoft 官方網站上的說明:
Microsoft Windows XP 是 Windows 的最後一個用戶端版本,其中包含 NetMeeting。 NetMeeting 並未隨附 Windows Vista。

為了在這種情況下支援目前的共同作業工作階段,Hotfix 是可用可讓您在 Windows Vista 架構的電腦上安裝 NetMeeting。此 NetMeeting 版本被作為轉換工具,可以協助支援共同作業工作階段當您在您的環境中使用 Windows XP 電腦搭配 Windows Vista 架構的電腦。

參考資料:
Microsoft 技術支援服務:Hotfix 是可以在執行 Windows Vista 的電腦上安裝 NetMeeting 3.02
(詳全文...)

SNMP on LINUX server 之 exec 自訂訊息實作

之前我們講到用 snmpd 裡面的 proc + 服務名稱來監視特定的服務狀態,但這只對部分的服務有效,例如 ntpd, snmpd, nfsd, httpd...等等,我不太確定他的抓取方式,但似乎,用 ps 去看如果 process name 沒出現在最前面的,似乎 snmpd 就 monitor 不到,這種狀況像 Tomcat 就會出現。舉例來說,我有個服務是用到 java 去帶起來的,如下面所示:
[root@KHXAAAS1 ~]# ps -aef|grep AAA|grep -v AAA
root 19475 1 0 09:13 ? 00:00:11 java -Xmx512m -Daaa.base=/opt/AAA -Daaa.run=/opt/AAA/run -Daaa.bin=/opt/AAA/bin -Daaa.lib=/opt/AAA/lib -Daaa.jni=/opt/AAA/jni com.lucent.aaa.gui.ServerManagementTool -debug info
root 21631 1 0 Sep12 ? 00:01:39 java -Daaa.base=/opt/AAA -Daaa.run=/opt/AAA/run -Daaa.bin=/opt/AAA/bin -Daaa.lib=/opt/AAA/lib -Daaa.jni=/opt/AAA/jni com.lucent.aaa.ConfigServer
root 26302 1 0 09:41 pts/0 00:00:08 java -Xmx512m -server -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -Dsun.rmi.dgc.server.gcInterval=0x7FFFFFFFFFFFFFFE -Dsun.rmi.dgc.client.gcInterval=0x7FFFFFFFFFFFFFFE -Daaa.base=/opt/AAA -Daaa.run=/opt/AAA/run -Daaa.bin=/opt/AAA/bin -Daaa.lib=/opt/AAA/lib -Daaa.jni=/opt/AAA/jni com.lucent.aaa.PolicyServer -debug debug
但用 snmpd 去監控 proc AAA 的話,一定看不到東西,(雖然可以用 proc Java 的方式來 monitor,但畢竟用 Java 帶起來的服務越來越多,這樣並不容易區分,容易造成誤判。)這個時候就可以用一個變通的方式來 monitor 我們要的服務狀態,那就是 exec 這個 snmpd.conf 裡的 option,他的用法是:
Usage:
exec MIBOID EXEC-COMMAND
我們直接實作一下好了。

首先假設我們有一個如前面說的服務用 proc AAA 方式加到 /etc/snmp/snmpd.conf 裡面卻無法正常 monitor 到服務的狀態時,而且假設,我們有一個簡單的判斷服務正常啟動的方法時(通常是像我們這裡示範的這種,灌了一個某某廠商的軟體時,想改變他的啟動方式或參數又無從改起時),如下所示,今天的實作目標有兩台 AAA server,上面有兩個主要的 process 要檢查狀態,
其中一個是 Policy server 另一個是 Configuration server,為了待會兒的測試,我先將其中第一台 KHXAAAS1 的 Policy server 先停掉,第二台 KHXAAAS2 的服務全部都讓他正常帶起來:
[root@KHXAAAS1 ~]# /opt/AAA/bin/aaa list all
The server could not be reached: Connection refused
8950 AAA Policy Server: not responding
101 Server active
8950 AAA Configuration Server: responding
[root@KHXAAAS2 ~]# /opt/AAA/bin/aaa list all
101 Server active
8950 AAA Policy Server: responding
101 Server active
8950 AAA Configuration Server: responding
說簡單點,/etc/snmpd/snmpd.conf 裡的 exec 這個 option 其實就是宣告一個 OID,然後當 SNMP server query 到這個 OID 時,就去執行指定的 shell scrpit 然後將直塞回剛剛指定的 OID.101.x 裡面去。接下來我們直接做一個簡單示範:

首先我們先 vi /etc/snmp/snmpd.conf(或用下面的 echo 指令也行)在裡面新加上一行如下的格式:
[root@KHXAAAS1 ~]# echo "exec .1.3.6.1.4.1.2021.51 ApplicationStatusQury /bin/sh /bin/ASQ.sh" >> /etc/snmp/snmpd.conf
檢查一下確實寫進去了:
[root@KHXAAAS1 ~]# grep ApplicationStatusQury /etc/snmp/snmpd.conf
exec .1.3.6.1.4.1.2021.51 ApplicationStatusQury /bin/sh /bin/ASQ.sh
接著我們編輯一個簡單的 shell script 叫 /bin/ASQ-AAA.sh 用來檢查 Policy server 和 Configuration server 的狀態,寫到 /opt/.ASQ-AAA-Policy.prState 與 /opt/.ASQ-AAA-Config.prState 裡面(這裡我先定義一下,如果這個file裡面的值是 responding 代表 服務正常,如果是 not responding 的話,代表服務掛點了,當然也可以用 wc -l 去讓這個 fiie 帶的值為 0 或 1 ):
[root@KHXAAAS1 ~]# cat /bin/ASQ-AAA.sh
#!/bin/sh
/opt/AAA/bin/aaa list policy > /opt/.ASQ-AAA-Policy.prState1
cat /opt/.ASQ-AAA-Policy.prState1|cut -d ":" -f2 > /opt/.ASQ-AAA-Policy.prState2
#grep 'not responding' /opt/.ASQ-AAA-Policy.prState1|wc -l > /opt/.ASQ-AAA-Policy.prState2

/opt/AAA/bin/aaa list config > /opt/.ASQ-AAA-Config.prState1
cat /opt/.ASQ-AAA-Config.prState1|cut -d ":" -f2 > /opt/.ASQ-AAA-Config.prState2
#grep 'not responding' /opt/.ASQ-AAA-Config.prState1|wc -l > /opt/.ASQ-AAA-Config.prState2
exit
然後我們再寫個 /bin/ASQ-AAA.sh 用來檢查 /opt/.ASQ-AAA-Policy.prState2 與 /opt/.ASQ-AAA-Config.prState2 裡面的值,分別寫進 1.3.6.1.4.1.2021.51.101.1 與 1.3.6.1.4.1.2021.51.101.2 這兩個 OID 去,如果你在剛剛的 schipt 裡面有 3 個 output,那就會還有 1.3.6.1.4.1.2021.51.101.3 這個 OID,依此類推...
[root@KHXAAAS1 ~]# cat /bin/ASQ.sh
#!/bin/sh
echo `cat /opt/.ASQ-AAA-Policy.prState2`
echo `cat /opt/.ASQ-AAA-Config.prState2`
exit
接著用 crontab -e 把他加進 cron job 去吧,這裡我們讓他每兩分鐘執行一次 Application Status Qury 的 script,可自行更改。
[root@KHXAAAS1 ~]# crontab -l
*/2 * * * * /bin/PSQ-AAA.sh
剛剛改完 /etc/snmp/snmpd.conf 之後我們還沒重起 snmpd 的服務,所以現在去查詢 .1.3.6.1.4.1.2021.51 這個 OID 應該會得倒下面的回應:
[root@KHXAAAS1 ~]# snmpwalk -v 2c -c public localhost .1.3.6.1.4.1.2021.51
UCD-SNMP-MIB::ucdavis.51 = No Such Object available on this agent at this OID
再來要開始驗證了,先確定一下兩台 AAA server 上的服務是把第一台的 Policy server 停下來的狀態,第二台則是保持 service 正常:
[root@KHXAAAS1 ~]# /opt/AAA/bin/aaa list all
The server could not be reached: Connection refused
8950 AAA Policy Server: not responding
101 Server active
8950 AAA Configuration Server: responding
[root@KHXAAAS2 ~]# /opt/AAA/bin/aaa list all
101 Server active
8950 AAA Policy Server: responding
101 Server active
8950 AAA Configuration Server: responding
接下來先重啟一下 snmpd service 來讓剛剛我們改的部分生效:
[root@KHXAAAS1 ~]# service snmpd restart
Stopping snmpd: [ OK ]
Starting snmpd: [ OK ]
好啦,現在可以查詢看看囉,先在本機上查詢一下(當然你也可以從你的 SNMP server 端來查詢) 我們剛剛新定義的 OID:
[root@KHXAAAS1 ~]# snmpwalk -v 2c -c public localhost .1.3.6.1.4.1.2021.51
UCD-SNMP-MIB::ucdavis.51.1.1 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.51.2.1 = STRING: "ApplicationStatusQury"
UCD-SNMP-MIB::ucdavis.51.3.1 = STRING: "/bin/sh /bin/ASQ.sh"
UCD-SNMP-MIB::ucdavis.51.100.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.51.101.1 = STRING: "not responding"
UCD-SNMP-MIB::ucdavis.51.101.2 = STRING: "responding"
UCD-SNMP-MIB::ucdavis.51.102.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.51.103.1 = ""
如果是用 wc -l 去 count 的話那應該會像下面這樣:
UCD-SNMP-MIB::ucdavis.51.101.1 = STRING: "1"
UCD-SNMP-MIB::ucdavis.51.101.2 = STRING: "0"
當然在這裡我們需要的是 .1.3.6.1.4.1.2021.51.101.1 and .1.3.6.1.4.1.2021.51.101.2 這兩個 OID,對應到 Policy server 和 Configuration server 的服務狀態。所以由 SNMP server 端就可以直接設定一個 Passive Monitor 來 Polling 這兩個 OID 的值。
[root@KHXEMSS1 ~]# snmpwalk -v 2c -c public khxaaas1 .1.3.6.1.4.1.2021.51.101.1
UCD-SNMP-MIB::ucdavis.51.101.1 = STRING: "not responding"
[root@KHXEMSS1 ~]# snmpwalk -v 2c -c public khxaaas1 .1.3.6.1.4.1.2021.51.101.2
UCD-SNMP-MIB::ucdavis.51.101.2 = STRING: "responding"
[root@KHXEMSS1 ~]# snmpwalk -v 2c -c public khxaaas2 .1.3.6.1.4.1.2021.51.101.1
UCD-SNMP-MIB::ucdavis.51.101.1 = STRING: "responding"
[root@KHXEMSS1 ~]# snmpwalk -v 2c -c public khxaaas2 .1.3.6.1.4.1.2021.51.101.2
UCD-SNMP-MIB::ucdavis.51.101.2 = STRING: "responding"
所以上面就代表第一台 KHXAAAS1 的 Policy server 有問題。OK...報告完畢。
(詳全文...)

用 mysqldump 來 Backup/Restore MySQL 的 DB data

今天收到客戶的要求要把 DB server 上的 MySQL data 做個定期備份,所以就順便實作一下~
首先,這裡的環境是:

兩台 DB server 上都有 MySQL Enterprise v2.0.56,
OS 都是 RedHat EL ES4U5,另外這兩台 DB server 上還有 Veritas 做 HA。
我們就不說廢話了,直接開始吧:

MySQL 備份資料庫主要有兩種方法,一種是用 Hard copy 的方法,也就是直接把 ~/mysql/data/[資料庫名稱]/* 通通備份下來,如果要到回去資料庫,資料庫版本要一樣喔,免得發生非預期的結果。不過這種方法備份還原時最好先把 mysqld 停下來。
要看 MySQL 是否執行中可用下面的指令 "mysqladmin status":
[root@KHXDBS1 ~]# /opt/mysql/enterprise/monitor/mysql/bin/mysqladmin status
/opt/mysql/enterprise/monitor/mysql/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!
而要檢查剛剛所說的資料庫所在的位置,可以去查看一下 /etc/init.d/mysql 個檔案的內容,由於這裡的環境是兩台 DB server 後面接著一座 Storage,所以我把 datadir (資料庫路徑) 改到 /DB (由後端 Storage mount 過來)底下:
[root@KHXDBS1 ~]# grep "datadir=/" /etc/init.d/mysql
# datadir=/var/lib/mysql
datadir=/DB/var/lib/mysql
[root@KHXDBS1 ~]# cp -pR /DB/var/lib/mysql/AAA /DB/mysql/backup/.
其中 AAA 是這次要備份的的 schema 啦。

還有一種作法是用 mysqldump 將資料倒出來 *.sql,指令格式為:
mysqldump -h [Host] -u[DbUserName] -p[DbPassword] [DbName] > [filename].sql
簡單的例子:
mysqldump -h 127.0.0.1 -uroot -pOOXX AAA > /DB/mysql/backup/dbMysqlArchive_XXXX.sql
要做 Restore 時可以用下面的指令範例來倒:
mysql -h 127.0.0.1 -uroot -pOOXX AAA < /DB/mysql/backup/dbMysqlArchive_XXXX.sql
對了,Restore 之前要先確定 AAA 的 Schema 還存在喔~
下面是附上簡單寫的一個小 script 去每天晚上作個備份...給大家參考一下:
[root@KHXDBS1 ~]# crontab -l 10 2 * * * /bin/DB_archive.sh > /dev/null 2>&1
[root@KHXDBS1 ~]# cat /bin/DB_archive.sh
#!/bin/sh -vx
#
# DB server : Backup DB data
# Version: @01
#
INITIAL_DIR=/opt/logs
HOSTNAME=`hostname |cut -c -7`
LOG_APPENDIX=`date +"%Y-%m%d"`
LOCK_FILE=$INITIAL_DIR/.dbMysqlArchive_lock
LOG_FILE=$INITIAL_DIR/$HOSTNAME-dbMysqlArchive_$LOG_APPENDIX.log
ERR_COUNTER=0
FIX_COUNTER=0
MAIN_SEPERATOR="==============="
SEC_SEPERATOR="#---------------------------------------------------------------------------------------#"
NOW=`date +%Y-%m-%d-%H:%M:%S`
ARC_EXT=`date +%Y%m%d%H`
ARC_DIR=/DB/mysql/backup
ARC_FILE=$ARC_DIR/dbMysqlArchive_$ARC_EXT.sql

if [ ! -f "$LOCK_FILE" ]; then
touch $LOCK_FILE
else
echo $MAIN_SEPERATOR >> $LOG_FILE
echo $NOW >> $LOG_FILE
echo "$LOCK_FILE exist" >> $LOG_FILE
echo $MAIN_SEPERATOR >> $LOG_FILE
exit
fi

if [ `rsh khxdb hostname|cut -c -7|grep $HOSTNAME|wc -l` = 1 ]; then
/usr/bin/find $INITIAL_DIR -name "$HOSTNAME-dbMysqlArchive*.log" -mtime +8 -exec rm {} \;
/usr/bin/find $ARC_DIR -name "dbMysqlArchive_*.sql" -mtime +8 -exec rm {} \;

echo $SEC_SEPERATOR >> $LOG_FILE
echo "# DB server mysql data archive script starting #" >> $LOG_FILE
echo $SEC_SEPERATOR >> $LOG_FILE
#------------------------ Archive MySQL data ----------------------------------------------#
echo "Start to excute mysqldump command at $NOW ..." >> $LOG_FILE
echo "" >> $LOG_FILE
/opt/mysql/enterprise/monitor/mysql/bin/mysqldump -h 127.0.0.1 -uroot -pOOXX AAA > $ARC_FILE
if [ `ls -l $ARC_FILE| wc -l` = 1 ]; then
echo "$ARC_FILE created..." >> $LOG_FILE
else
echo "$ARC_FILE create fail, Please check it now..." >> $LOG_FILE
fi
rm -rf $LOCK_FILE
echo $SEC_SEPERATOR >> $LOG_FILE
echo "# DB server MySQL data archive script finished #" >> $LOG_FILE
echo $SEC_SEPERATOR >> $LOG_FILE
#------------------------------------------------------------------------------------------#
else
echo $NOW >> $LOG_FILE
echo "This server is NOT the active one !!!" >> $LOG_FILE
echo "Check script is stopping !!!" >> $LOG_FILE
echo $SEC_SEPERATOR >> $LOG_FILE
rm -rf $LOCK_FILE
fi
[root@KHXDBS1 ~]#
備份完會像下面所示的例子喔:
[root@KHXDBS1 ~]# ls -alrt /DB/mysql/backup/
total 168
drwxr-xr-x 3 root root 4096 Oct 14 15:25 ..
-rw-r--r-- 1 root root 77092 Oct 15 02:10 dbMysqlArchive_2008101502.sql
drwxr-xr-x 2 root root 4096 Oct 14 15:55 .

搞定!收工。
(詳全文...)

讓 history command 顯示時間記錄 on LINUX

有時候在機器上查詢曾經下過的指令記錄時,多半大家看到的都是如下面的格式吧:
[root@KHXPROVS1 ~]# history
1 ifconfig -a;
2 service ntpd status; ntpq -p;
3 df -h;
4 service vsftpd status;
5 history
[root@KHXPROVS1 ~]#
可是如果這台機器有很多人都會進來用的話呢?那我怎麼知道某個特別的指令是在什麼時間下的呢?能不能在 history 秀出的紀錄裡加上時間戳記呢?當然可以,在 bash 的變數裡面有一個叫 HISTTIMEFORMAT 就可以達到這麼需求,我們就來實作一下吧:

首先,這個變數必須在 BASH 3.0 以上才有提供喔,如果以 RedHat Enterprise 的版本來看 , 要 RHEL 4 ES/AS 以後的版本才行!

先確認一下目前 BASH 的版本吧:
[root@KHXPROVS1 ~]# rpm -q bash
bash-3.0-19.3
看來版本是 OK 的,接著編輯一下 /etc/profile 或者直接用下面的指令把變數宣告進去:
echo "HISTTIMEFORMAT='<%F %T>:'" >> /etc/profile
echo "export HISTTIMEFORMAT" >> /etc/profile
當然,編輯完的話,存檔離開,接著用:
[root@KHXPROVS1 ~]# source /etc/profile
或者離開目前的 shell 再登入一次,然後再敲一次 history 指令看一下結果:
[root@KHXPROVS1 ~]# history
1 <2008-10-08 18:02:22>ifconfig -a;
2 <2008-10-08 18:02:22>service ntpd status; ntpq -p;
3 <2008-10-08 18:02:22>df -h;
4 <2008-10-08 18:02:22>service vsftpd status;
5 <2008-10-08 18:02:22>history
6 <2008-10-08 18:02:22>rpm -q bash
7 <2008-10-08 18:02:22>echo "HISTTIMEFORMAT='<%F %T>:'" >> /etc/profile
8 <2008-10-08 18:02:22>echo "export HISTTIMEFORMAT" >> /etc/profile
9 <2008-10-08 18:02:22>source /etc/profile
10 <2008-10-08 18:03:15>history
[root@KHXPROVS1 ~]#
果然,每個歷史指令的前面都多了時間戳記囉~

參考資料:GNU 官網的 5.2 Bash Variables
(詳全文...)

在 Linux 上增加一個新服務並設為開機啟動

上次裝完 JAVA 跟 Tomcat 之後,是用手動的方式將 Tomcat 的服務帶起來的,(啟動:/opt/tomcat/bin/startup.sh 停止:/opt/tomcat/bin/shutdown.sh)這次我們要做的就是將 Tomcat 加為系統的一個服務,改為可用 service service_name start/stop 的方式來啟動跟關閉:

首先,我們先到 /etc/init.d/ 底下去新增一個 tomcat 的檔案 (記得要改為可執行喔~)
[root@KHXPROVS1 ~]# touch /etc/init.d/tomcat
[root@KHXPROVS1 ~]# chmod 755 /etc/init.d/tomcat
[root@KHXPROVS1 bin]# ls -alrt /etc/init.d/ |grep tomcat
-rwxr-xr-x 1 root root 609 Oct 2 16:10 tomcat
編輯 /etc/init.d/tomcat 的內容,這個檔案的寫法可以參考系統上面 /etc/init.d/ 下的其他檔案;
比較重要的是第二行,其語法為:
# chkconfig: [runlevels] [start number] [stop number]
# runlevels 代表不同的 run level 狀態, start number 與 stop number 則是在 /etc/rc.d/rc[2345].d 內建立以 S90tomcat 及 K80tomcat 為檔名的設定。
[root@KHXPROVS1 ~]# vi /etc/init.d/tomcat
#!/bin/bash
# process init file for tomcat
#
# chkconfig: 2345 90 80
# description: Apache Tomcat Daemon
#
# processname: /opt/tomcat/bin/startup.sh and /opt/tomcat/bin/shutdown.sh

start() {
echo -n "Starting up Tomcat: ";echo "";
/opt/tomcat/bin/startup.sh
}

stop() {
echo -n "Shutting down Tomcat: ";echo "";
/opt/tomcat/bin/shutdown.sh
}

restart() {
echo "Restarting Tomcat:"
stop
start
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo "Usage: Tomcat {start|stop|restart}"
exit 1
esac

exit $?
~
~
~
~
"/etc/rc.d/init.d/tomcat" 39L, 524C written
修改完存檔離開,接著我們檢查一下目前 tomcat 是否有啟動:
[root@KHXPROVS1 ~]# ps -aef|grep tomcat
root 22754 22207 0 15:53 pts/2 00:00:00 grep tomcat
好了,現在就來測試一下剛剛的檔案囉,首先,測試一下啟動 tomcat 服務吧:
[root@KHXPROVS1 ~]# service tomcat start
Starting up Tomcat:
Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /usr
[root@KHXPROVS1 ~]# ps -aef|grep tomcat|grep -v grep
root 22775 1 30 15:53 pts/2 00:00:11 /usr/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties -Djava.endorsed.dirs=/opt/tomcat/endorsed -classpath :/opt/tomcat/bin/bootstrap.jar -Dcatalina.base=/opt/tomcat -Dcatalina.home=/opt/tomcat -Djava.io.tmpdir=/opt/tomcat/temp org.apache.catalina.startup.Bootstrap start
接著,測試一下停止 tomcat 服務吧:
[root@KHXPROVS1 ~]# service tomcat stop
Shutting down Tomcat:
Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /usr
[root@KHXPROVS1 ~]# ps -aef|grep tomcat|grep -v grep
最後,測試一下重新啟動 tomcat 服務吧:
[root@KHXPROVS1 ~]# service tomcat restart
Restarting Tomcat:
Shutting down Tomcat:
Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /usr
Starting up Tomcat:
Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /usr
[root@KHXPROVS1 ~]# ps -aef|grep tomcat|grep -v grep
root 23001 1 99 15:55 pts/2 00:00:07 /usr/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties -Djava.endorsed.dirs=/opt/tomcat/endorsed -classpath :/opt/tomcat/bin/bootstrap.jar -Dcatalina.base=/opt/tomcat -Dcatalina.home=/opt/tomcat -Djava.io.tmpdir=/opt/tomcat/temp org.apache.catalina.startup.Bootstrap start
[root@KHXPROVS1 ~]#
接下來要讓 tomcat 在次開機時都會自動啟動,這裡我們用 chkconfig 這個指令來達成,
先用 --list 將目前的各項服務狀態列出來並 grep 一下 tomcat:
[root@KHXPROVS1 ~]# chkconfig --list|grep tomcat
看的出來目前 tomcat 並不在 chkconfig 的管理列表中,所以我們用 --add 來新增 tomcat 的服務 (增加一個服務名稱給 chkconfig 來管理,該服務名稱 必須存在 /etc/init.d/ 內!)
[root@KHXPROVS1 ~]# chkconfig --add tomcat
[root@KHXPROVS1 ~]# chkconfig --list|grep tomcat
tomcat 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@KHXPROVS1 ~]#
我們列出 /etc/rc.d/rcx.d/ 底下關於 tomcat 的部分:
[root@KHXPROVS1 ~]# find /etc/rc.d/ |grep 'tomcat'|sort
/etc/rc.d/init.d/tomcat
/etc/rc.d/rc0.d/K80tomcat
/etc/rc.d/rc1.d/K80tomcat
/etc/rc.d/rc2.d/S90tomcat
/etc/rc.d/rc3.d/S90tomcat
/etc/rc.d/rc4.d/S90tomcat
/etc/rc.d/rc5.d/S90tomcat
/etc/rc.d/rc6.d/K80tomcat
好了,報告完畢~
(詳全文...)

SNMP proxy to Sub-Agent on LINUX server 實作

上次的 snmp 測試中,測試匯入了 RADIUS 相關的幾個 MIB 檔,並用 snmptranslate 確認過 snmpd 已經可以認得我們所新匯入的 OBJECT-TYPE 與 OID了;但是,如果使用 snmpwalk 去查詢相關 OID 的值時,卻會出現查詢不到的窘境。

那麼對於一個系統不認得的 OID 要怎麼辦呢?我們來示範一下用 proxy 的選項達到這個結果。今天的範例是,在原本的 AAA Server 上,除了原本系統的 snmpd 以外,另外啟動一個 AAA 的 snmp Agent,假設這個新的 Agent 所 Listening 的 port 為 1461,那麼,目前系統上就應該有在 listening 下面的這些 ports:
[root@KHXAAAS2 ~]# netstat -an |grep 161
udp 0 0 0.0.0.0:161 0.0.0.0:*
[root@KHXAAAS2 ~]# netstat -an |grep 162
udp 0 0 0.0.0.0:162 0.0.0.0:*
unix 2 [ ACC ] STREAM LISTENING 21620 /tmp/.font-unix/fs7100

[root@KHXAAAS2 ~]# netstat -an |grep 1461
udp 0 0 :::1461 :::*
其中 0 0.0.0.0:161 是系統 snmpd 所使用的,而 0 :::1461 是新 AAA Agent 所使用。

這裡我們先列一下關於 porxy 這個 option 的用法:
proxy [-Cn CONTEXTNAME] [SNMPCMD ARGS] HOST OID [REMOTEOID]
This token specifies that any incoming requests under OID should be proxied on to another HOST instead. If a CONTEXTNAME is specified, it assigns the proxied tree to a particular context name within the local agent. This is the proper way to query multiple agents through a single proxy. Assign each remote agent to a different context name. Then you can use "snmpwalk -n contextname1" to walk one remote proxied agent and "snmpwalk -n contextname2" to walk another, assuming you are using SNMPv3 to talk to the proxy (snmpv1 and snmpv2c context mappings aren't currently supported but might be in the future). Optionally, relocate the local OID tree to the new location at the REMOTEOID. To authenticate to HOST you should use the appropriate set of SNMPCMD ARGS. See the snmpcmd(1) manual page for details.
接下來我們編輯一下 snmp 的設定檔,將下面這一行加到檔案的最後就可以:(這一行便是要將 OID 為 1.3.6.1.2.1.67 以下的轉給 localhost:1461 也就是 AAA Agent 來處理啦 )
[root@KHXAAAS2 ~]# vi /etc/snmp/snmpd.conf
#前面這些設定就省略不列出來了...
proxy -v 2c -c public localhost:1461 .1.3.6.1.2.1.67
~
~
"/etc/snmp/snmpd.conf" 481L, 19481C written
存檔離開,再重啟 snmpd 之前我們先觀察一下目前 snmpwalk 的結果:
首先這是經由 snmpd:161 查詢 SNMPv2-MIB::sysDescr.0 的結果:
[root@KHXAAAS2 ~]# snmpwalk -v 2c -c public localhost .1.3.6.1.2.1.1.1
SNMPv2-MIB::sysDescr.0 = STRING: Linux KHXAAAS2 2.6.9-67.ELsmp #1 SMP Wed Nov 7 13:58:04 EST 2007 i686
接著這是經由 snmpd:161 查詢 RADIUS-AUTH-SERVER-MIB::radiusAuthServIdent.0 的結果:
[root@KHXAAAS2 ~]# snmpwalk -v 2c -c public localhost .1.3.6.1.2.1.67.1.1.1.1.1.0
RADIUS-AUTH-SERVER-MIB::radiusAuthServIdent.0 = No Such Object available on this agent at this OID
很明顯的目前透過 snmpd 的 161 port 是查詢不到 RADIUS-AUTH-SERVER-MIB::radiusAuthServIdent.0 的內容的;
接下來我們再試一下經由 AAA Agent:1461 查詢 RADIUS-AUTH-SERVER-MIB::radiusAuthServIdent.0 的結果:
[root@KHXAAAS2 ~]# snmpwalk -v 2c -c public localhost:1461 .1.3.6.1.2.1.67.1.1.1.1.1.0
RADIUS-AUTH-SERVER-MIB::radiusAuthServIdent.0 = STRING: Alcatel-Lucent 8950 AAA PolicyServer, Version 6.0.1
所以目前的狀況就是,分開以 port 161 和 1461 只可以分別查詢到不同 OID 的值;

接著我們重啟一下 snmpd 服務,讓剛剛的 proxy 設定讀進去:
[root@KHXAAAS2 ~]# service snmpd restart
Stopping snmpd: [ OK ]
Starting snmpd: [ OK ]
好了,讓我們再試一次吧:
[root@KHXAAAS2 ~]# snmpwalk -v 2c -c public localhost .1.3.6.1.2.1.67.1.1.1.1.1.0
RADIUS-AUTH-SERVER-MIB::radiusAuthServIdent.0 = STRING: Alcatel-Lucent 8950 AAA PolicyServer, Version 6.0.1
[root@KHXAAAS2 ~]# snmpwalk -v 2c -c public localhost:1461 .1.3.6.1.2.1.67.1.1.1.1.1.0
RADIUS-AUTH-SERVER-MIB::radiusAuthServIdent.0 = STRING: Alcatel-Lucent 8950 AAA PolicyServer, Version 6.0.1
很明顯的,在加上這一行之後,直接查詢 snmpd:161 已經可以看到跟查詢 AAA Agent:1461 相同的結果囉~

這裡有兩篇 snmpd 相關 command 的詳細使用說明可以參考喔:
http://pwet.fr/man/linux/formats/snmp/snmpd_conf
http://pwet.fr/man/linux/commandes/snmpcmd
(詳全文...)

SNMP 匯入新 MIB on LINUX server

這次我們要測試的機器仍然是 RHEL ES4U6 的環境,已經裝好相關的 net-snmp (net-snmp-5.1.2-11.EL4.11) 程式,下面列出測試要匯入的為 RADIUS 相關的幾個 MIB 檔:
RADIUS-AUTH-SERVER-MIB.txt
RADIUS-AUTH-CLIENT-MIB.txt
RADIUS-ACC-SERVER-MIB.txt
RADIUS-ACC-CLIENT-MIB.txt
RADIUS-DYNAUTH-SERVER-MIB.txt
RADIUS-DYNAUTH-CLIENT-MIB.txt
先用 snmptranslate 來確認一下 snmpd 是否可以認得我們要匯入的 OBJECT-TYPE 與 OID:
[root@KHXAAAS2 mibs]# snmptranslate -On -IR radiusAuthServMIBCompliance
Unknown object identifier: radiusAuthServMIBCompliance
[root@KHXAAAS2 mibs]# snmptranslate -Td .1.3.6.1.2.1.67.1.1.2.1.1
SNMPv2-SMI::mib-2.67.1.1.2.1.1
mib-2 OBJECT-TYPE
-- FROM SNMPv2-SMI, RFC1213-MIB
::= { iso(1) org(3) dod(6) internet(1) mgmt(2) mib-2(1) 67 1 1 2 1 1 }
看起來目前是翻譯不出我們所要查 RADIUS 相關的 OBJECT-TYPE 與 OID,好了,接下來就是這次的工作囉:

首先,我們將 RADIUS 這幾個 MIB 檔複製到 /usr/share/snmp/mibs 底下:
[root@KHXAAAS2 ~] mkdir -p $HOME/.snmp
[root@KHXAAAS2 ~] cp -p /tmp/RADIUS* /usr/share/snmp/mibs/
接著就是告訴 snmpd 去 load 這些 MIB:

有兩種方式,暫時測試可用第一種方法,只對目前的 session 有效:
[root@KHXAAAS2 ~] export MIBS=+MY-MIB
或者是第二種方法:
[root@KHXAAAS2 ~] echo "mibs +RADIUS-AUTH-SERVER-MIB" >> $HOME/.snmp/snmp.conf
[root@KHXAAAS2 ~] echo "mibs +RADIUS-AUTH-CLIENT-MIB" >> $HOME/.snmp/snmp.conf
[root@KHXAAAS2 ~] echo "mibs +RADIUS-ACC-SERVER-MIB" >> $HOME/.snmp/snmp.conf
[root@KHXAAAS2 ~] echo "mibs +RADIUS-ACC-CLIENT-MIB" >> $HOME/.snmp/snmp.conf
[root@KHXAAAS2 ~] echo "mibs +RADIUS-DYNAUTH-SERVER-MIB" >> $HOME/.snmp/snmp.conf
[root@KHXAAAS2 ~] echo "mibs +RADIUS-DYNAUTH-CLIENT-MIB" >> $HOME/.snmp/snmp.conf
or
[root@KHXAAAS2 ~] echo "mibs +ALL" >> $HOME/.snmp/snmp.conf
也是可以,用 ALL 會把所有可用的 MIB 都 LOAD 進來,當然包括剛剛的幾個測試 MIB 檔,不過速度上會比較慢喔。(注意喔,如果是用
echo "mibs +RADIUS-DYNAUTH-CLIENT-MIB" 的方式,要記得把後面的 .txt 去掉喔~)

好了,先看一下 MIBDIR 的目錄下有些什麼囉:
[root@KHXAAAS2 mibs]# pwd
/usr/share/snmp/mibs
[root@KHXAAAS2 mibs]# ls -alrt
total 1740
-rw-r--r-- 1 root root 38034 Jul 19 2007 SNMPv2-TC.txt
-rw-r--r-- 1 root root 8924 Jul 19 2007 SNMPv2-SMI.txt
-rw-r--r-- 1 root root 29305 Jul 19 2007 SNMPv2-MIB.txt
-rw-r--r-- 1 root root 8263 Jul 19 2007 SNMPv2-CONF.txt
-rw-r--r-- 1 root root 9106 Jul 19 2007 SNMP-PROXY-MIB.txt
-rw-r--r-- 1 root root 1174 Jul 19 2007 RFC-1215.txt
-rw-r--r-- 1 root root 79667 Jul 19 2007 RFC1213-MIB.txt
-rw-r--r-- 1 root root 3067 Jul 19 2007 RFC1155-SMI.txt
-rw-r--r-- 1 root root 71691 Jul 19 2007 IF-MIB.txt
-rw-r--r-- 1 root root 5066 Jul 19 2007 IF-INVERTED-STACK-MIB.txt
-rw-r--r-- 1 root root 84492 Jul 19 2007 EtherLike-MIB.txt
-rw-r--r-- 1 root root 4076 Jul 19 2007 UDP-MIB.txt
-rw-r--r-- 1 root root 10765 Jul 19 2007 TCP-MIB.txt
-rw-r--r-- 1 root root 2205 Jul 19 2007 SNMP-USM-AES-MIB.txt
-rw-r--r-- 1 root root 147822 Jul 19 2007 RMON-MIB.txt
-rw-r--r-- 1 root root 24723 Jul 19 2007 NOTIFICATION-LOG-MIB.txt
-rw-r--r-- 1 root root 4400 Jul 19 2007 IPV6-UDP-MIB.txt
-rw-r--r-- 1 root root 2367 Jul 19 2007 IPV6-TC.txt
-rw-r--r-- 1 root root 7257 Jul 19 2007 IPV6-TCP-MIB.txt
-rw-r--r-- 1 root root 48703 Jul 19 2007 IPV6-MIB.txt
-rw-r--r-- 1 root root 15936 Jul 19 2007 IPV6-ICMP-MIB.txt
-rw-r--r-- 1 root root 23499 Jul 19 2007 IP-MIB.txt
-rw-r--r-- 1 root root 26781 Jul 19 2007 IP-FORWARD-MIB.txt
-rw-r--r-- 1 root root 12517 Jul 19 2007 INET-ADDRESS-MIB.txt
-rw-r--r-- 1 root root 4660 Jul 19 2007 HCNUM-TC.txt
-rw-r--r-- 1 root root 64311 Jul 19 2007 DISMAN-SCRIPT-MIB.txt
-rw-r--r-- 1 root root 24613 Jul 19 2007 DISMAN-SCHEDULE-MIB.txt
-rw-r--r-- 1 root root 17455 Jul 19 2007 AGENTX-MIB.txt
-rw-r--r-- 1 root root 35242 Jul 19 2007 UCD-SNMP-MIB.txt
-rw-r--r-- 1 root root 8118 Jul 19 2007 UCD-IPFWACC-MIB.txt
-rw-r--r-- 1 root root 2163 Jul 19 2007 UCD-DEMO-MIB.txt
-rw-r--r-- 1 root root 22769 Jul 19 2007 SNMP-TARGET-MIB.txt
-rw-r--r-- 1 root root 4628 Jul 19 2007 SMUX-MIB.txt
-rw-r--r-- 1 root root 4318 Jul 19 2007 NET-SNMP-TC.txt
-rw-r--r-- 1 root root 2036 Jul 19 2007 NET-SNMP-MIB.txt
-rw-r--r-- 1 root root 6741 Jul 19 2007 NET-SNMP-EXAMPLES-MIB.txt
-rw-r--r-- 1 root root 15650 Jul 19 2007 NET-SNMP-AGENT-MIB.txt
-rw-r--r-- 1 root root 4299 Jul 19 2007 IANA-LANGUAGE-MIB.txt
-rw-r--r-- 1 root root 20126 Jul 19 2007 IANAifType-MIB.txt
-rw-r--r-- 1 root root 4743 Jul 19 2007 IANA-ADDRESS-FAMILY-NUMBERS-MIB.txt
-rw-r--r-- 1 root root 10583 Jul 19 2007 HOST-RESOURCES-TYPES.txt
-rw-r--r-- 1 root root 52544 Jul 19 2007 HOST-RESOURCES-MIB.txt
-rw-r--r-- 1 root root 3010 Jul 19 2007 UCD-DLMOD-MIB.txt
-rw-r--r-- 1 root root 3198 Jul 19 2007 UCD-DISKIO-MIB.txt
-rw-r--r-- 1 root root 34162 Jul 19 2007 SNMP-VIEW-BASED-ACM-MIB.txt
-rw-r--r-- 1 root root 5775 Jul 19 2007 SNMPv2-TM.txt
-rw-r--r-- 1 root root 39201 Jul 19 2007 SNMP-USER-BASED-SM-MIB.txt
-rw-r--r-- 1 root root 20014 Jul 19 2007 SNMP-NOTIFICATION-MIB.txt
-rw-r--r-- 1 root root 5496 Jul 19 2007 SNMP-MPD-MIB.txt
-rw-r--r-- 1 root root 22342 Jul 19 2007 SNMP-FRAMEWORK-MIB.txt
-rw-r--r-- 1 root root 15490 Jul 19 2007 SNMP-COMMUNITY-MIB.txt
-rw-r--r-- 1 root root 5931 Jul 19 2007 LM-SENSORS-MIB.txt
-rw-r--r-- 1 root root 68177 Jul 19 2007 DISMAN-EVENT-MIB.txt
drwxr-xr-x 4 root root 4096 Jun 12 04:28 ..
-rw-rw---- 1 root root 28446 Aug 29 00:32 RADIUS-AUTH-SERVER-MIB.txt
-rw-rw---- 1 root root 26373 Aug 29 00:32 RADIUS-AUTH-CLIENT-MIB.txt
-rw-rw---- 1 root root 26281 Aug 29 00:32 RADIUS-ACC-SERVER-MIB.txt
-rw-rw---- 1 root root 23747 Aug 29 00:32 RADIUS-ACC-CLIENT-MIB.txt
-rw-rw---- 1 root root 29247 Aug 29 00:32 RADIUS-DYNAUTH-SERVER-MIB.txt
-rw-rw---- 1 root root 31892 Aug 29 00:32 RADIUS-DYNAUTH-CLIENT-MIB.txt
drwxr-xr-x 2 root root 4096 Oct 2 10:16 .
-rw-r--r-- 1 root root 2058 Oct 2 10:16 .index
不用重起 snmpd 的服務,我們直接再查詢一次試試看:

[root@KHXAAAS2 mibs]# snmptranslate -On -IR radiusAuthServMIBCompliance
.1.3.6.1.2.1.67.1.1.2.1.1
[root@KHXAAAS2 mibs]# snmptranslate -Td .1.3.6.1.2.1.67.1.1.2.1.1
RADIUS-AUTH-SERVER-MIB::radiusAuthServMIBCompliance
radiusAuthServMIBCompliance MODULE-COMPLIANCE
-- FROM RADIUS-AUTH-SERVER-MIB
DESCRIPTION "The compliance statement for authentication
servers implementing the RADIUS Authentication
Server MIB. Implementation of this module is for
IPv4-only entities, or for backwards compatibility
use with entities that support both IPv4 and
IPv6."
::= { iso(1) org(3) dod(6) internet(1) mgmt(2) mib-2(1) radiusMIB(67) radiusAuthentication(1) radiusAuthServMIB(1) radiusAuthServMIBConformance(2) radiusAuthServMIBCompliances(1) 1 }
果然就可以查詢的到 RADIUS 的 OBJECT-TYPE 與 OID 囉...

參考資料:Net-SNMP FAQ How do I add a MIB
(詳全文...)

SNMP on LINUX server 實作(二)--補遺

回到公司測試另外一台機器時才發現,噫?這台機器上怎麼沒有 snmpwalk 之類的指令可以用呢?同樣是 RHEL ES4U6 啊,其實這個問題很簡單,只是因為這一台機器當初安裝只選了部分安裝,所以關於 snmp 的部分僅安裝了 net-snmp 的 package,卻沒有安裝相關的 utility 罷了。

先看一下目前系統上關於 snmp 的指令有哪些:
[root@KHXAAAS2 ~]# ls -al /usr/sbin/snmp*
-rwxr-xr-x 1 root root 25180 Jul 19 2007 /usr/sbin/snmpd
-rwxr-xr-x 1 root root 21700 Jul 19 2007 /usr/sbin/snmptrapd
[root@KHXAAAS2 ~]# ls -al /usr/bin/snmp*
ls: /usr/bin/snmp*: No such file or directory
可以看得出目前只有兩個 snmp daemon 而已,其餘相關的指令都不存在。
再檢查一下目前所安裝的 rpm:
[root@KHXAAAS2 ~]# rpm -qa|grep net-snmp
net-snmp-libs-5.1.2-11.EL4.11
net-snmp-5.1.2-11.EL4.11
[root@KHXAAAS2 ~]#
果然沒有看到 net-snmp-utils-5.1.2-11.EL4.11 的影子啊...

到 Google 上搜尋一下或者直接到 RPM Search 去抓一個回來用吧...



這裡列出這個 RPM 檔的 Requires :
perl(Net::SMTP)
libnetsnmp.so.5
perl(Getopt::Std)
libc.so.6(GLIBC_2.0)
rpmlib(PayloadFilesHavePrefix) <= 4.0-1 /usr/bin/perl libcrypto.so.4 libc.so.6(GLIBC_2.3) libelf.so.1 libm.so.6 rpmlib(CompressedFileNames) <= 3.0.4-1 libc.so.6(GLIBC_2.1) net-snmp = 5.1.2 perl(File::Copy) perl(Data::Dumper) perl(IO::File) perl(Term::ReadLine) libc.so.6
下面是這個 RPM 檔中的可用指令部分:(Content of RPM :)
/usr/bin/encode_keychange
/usr/bin/fixproc
/usr/bin/ipf-mod.pl
/usr/bin/snmpbulkget
/usr/bin/snmpbulkwalk
/usr/bin/snmpconf
/usr/bin/snmpdelta
/usr/bin/snmpdf
/usr/bin/snmpget
/usr/bin/snmpgetnext
/usr/bin/snmpinform
/usr/bin/snmpnetstat
/usr/bin/snmpset
/usr/bin/snmpstatus
/usr/bin/snmptable
/usr/bin/snmptest
/usr/bin/snmptranslate
/usr/bin/snmptrap
/usr/bin/snmpusm
/usr/bin/snmpvacm
/usr/bin/snmpwalk
/usr/bin/traptoemail


抓到了 net-snmp-utils-5.1.2-11.EL4.11.i386.rpm 之後直接 ftp 到待測機器上吧,這次開個目錄 /rpm 專門擺放 RPM packages 好了:
[root@KHXAAAS2 ~]# cd /rpm
[root@KHXAAAS2 rpm]# ls -al
total 184
drwxr-xr-x 2 root root 4096 Sep 24 18:15 .
drwxr-xr-x 27 root root 4096 Sep 24 18:15 ..
-rw-r--r-- 1 root root 162078 Sep 24 18:15 net-snmp-utils-5.1.2-11.EL4.11.i386.rpm
接下來就直接安裝吧:
[root@KHXAAAS2 rpm]# rpm -Uvh net-snmp-utils-5.1.2-11.EL4.11.i386.rpm
warning: net-snmp-utils-5.1.2-11.EL4.11.i386.rpm: V3 DSA signature: NOKEY, key ID 1d1e034b
Preparing... ########################################### [100%]
1:net-snmp-utils ########################################### [100%]
好了,這時我們再檢查一次 snmp 相關的指令吧:
[root@KHXAAAS2 rpm]# ls -al /usr/sbin/snmp*
-rwxr-xr-x 1 root root 25180 Jul 19 2007 /usr/sbin/snmpd
-rwxr-xr-x 1 root root 21700 Jul 19 2007 /usr/sbin/snmptrapd
[root@KHXAAAS2 rpm]# ls -al /usr/bin/snmp*
-rwxr-xr-x 1 root root 6820 May 3 2007 /usr/bin/snmpbulkget
-rwxr-xr-x 1 root root 8560 May 3 2007 /usr/bin/snmpbulkwalk
-rwxr-xr-x 1 root root 21177 May 3 2007 /usr/bin/snmpconf
-rwxr-xr-x 1 root root 15076 May 3 2007 /usr/bin/snmpdelta
-rwxr-xr-x 1 root root 8804 May 3 2007 /usr/bin/snmpdf
-rwxr-xr-x 1 root root 6504 May 3 2007 /usr/bin/snmpget
-rwxr-xr-x 1 root root 6368 May 3 2007 /usr/bin/snmpgetnext
lrwxrwxrwx 1 root root 8 Sep 24 18:16 /usr/bin/snmpinform -> snmptrap
-rwxr-xr-x 1 root root 42948 May 3 2007 /usr/bin/snmpnetstat
-rwxr-xr-x 1 root root 7960 May 3 2007 /usr/bin/snmpset
-rwxr-xr-x 1 root root 10556 May 3 2007 /usr/bin/snmpstatus
-rwxr-xr-x 1 root root 18148 May 3 2007 /usr/bin/snmptable
-rwxr-xr-x 1 root root 11516 May 3 2007 /usr/bin/snmptest
-rwxr-xr-x 1 root root 10912 May 3 2007 /usr/bin/snmptranslate
-rwxr-xr-x 1 root root 9272 May 3 2007 /usr/bin/snmptrap
-rwxr-xr-x 1 root root 17612 May 3 2007 /usr/bin/snmpusm
-rwxr-xr-x 1 root root 15916 May 3 2007 /usr/bin/snmpvacm
-rwxr-xr-x 1 root root 8352 May 3 2007 /usr/bin/snmpwalk
[root@KHXAAAS2 rpm]#
果然多了不少有用的指令囉~

[root@KHXAAAS2 rpm]# rpm -qa|grep net-snmp
net-snmp-libs-5.1.2-11.EL4.11
net-snmp-5.1.2-11.EL4.11
net-snmp-utils-5.1.2-11.EL4.11

各個指令的詳細說明可以參考 Net-SNMP 官方網站的教學:
http://net-snmp.sourceforge.net/wiki/index.php/Tutorials
(詳全文...)

SNMP on LINUX server 實作

這幾天把 site 的幾台機器開始要加到 SNMP server 裡,所以得先把 幾台機器上的 SNMP 打開設定好,至少要能從 SNMP server 去 polling,然後能送 SNMP Traps 到 SNMP server 去...

先檢查一下 snmpd 的狀態,應該是未啟動的:
[root@KHXPROVS1 ~]# service snmpd status
snmpd is stopped
再檢查一下是否開機會啟動 snmpd 的服務:
[root@KHXPROVS1 ~]# chkconfig --list|grep snmpd
snmpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
所以我們先用 chkconfig 的指令讓 snmpd 一開機便會自行啟動:
[root@KHXPROVS1 ~]# chkconfig --level 345 snmpd on
接著打開 snmpd 的服務:
[root@KHXPROVS1 ~]# service snmpd start
Starting snmpd: [ OK ]
再來我們先嘗試著用 snmpwalk 的指令來查詢一下主機:
[root@KHXPROVS1 ~]# snmpwalk -v 1 localhost -c public system
Timeout: No Response from localhost
[root@KHXPROVS1 ~]# snmpwalk -v 2c -c public localhost system
Timeout: No Response from localhost
關於 snmpwalk 的用法,可以直接看 manual:
[root@KHXPROVS1 ~]# snmpwalk
No hostname specified.
USAGE: snmpwalk [OPTIONS] AGENT [OID]

Version: 5.1.2
Web: http://www.net-snmp.org/
Email: net-snmp-coders@lists.sourceforge.net

OPTIONS:
-h, --help display this help message
-H display configuration file directives understood
-v 1|2c|3 specifies SNMP version to use
-V, --version display package version number
SNMP Version 1 or 2c specific
-c COMMUNITY set the community string
SNMP Version 3 specific
-a PROTOCOL set authentication protocol (MD5|SHA)
-A PASSPHRASE set authentication protocol pass phrase
-e ENGINE-ID set security engine ID (e.g. 800000020109840301)
-E ENGINE-ID set context engine ID (e.g. 800000020109840301)
-l LEVEL set security level (noAuthNoPriv|authNoPriv|authPriv)
-n CONTEXT set context name (e.g. bridge1)
-u USER-NAME set security name (e.g. bert)
-x PROTOCOL set privacy protocol (DES|AES)
-X PASSPHRASE set privacy protocol pass phrase
-Z BOOTS,TIME set destination engine boots/time
General communication options
-r RETRIES set the number of retries
-t TIMEOUT set the request timeout (in seconds)
Debugging
-d dump input/output packets in hexadecimal
-D TOKEN[,...] turn on debugging output for the specified TOKENs
(ALL gives extremely verbose debugging output)
General options
-m MIB[:...] load given list of MIBs (ALL loads everything)
-M DIR[:...] look in given list of directories for MIBs
-P MIBOPTS Toggle various defaults controlling MIB parsing:
u: allow the use of underlines in MIB symbols
c: disallow the use of "--" to terminate comments
d: save the DESCRIPTIONs of the MIB objects
e: disable errors when MIB symbols conflict
w: enable warnings when MIB symbols conflict
W: enable detailed warnings when MIB symbols conflict
R: replace MIB symbols from latest module
-O OUTOPTS Toggle various defaults controlling output display:
a: print all strings in ascii format
b: do not break OID indexes down
e: print enums numerically
E: escape quotes in string indices
f: print full OIDs on output
n: print OIDs numerically
q: quick print for easier parsing
Q: quick print with equal-signs
s: print only last symbolic element of OID
S: print MIB module-id plus last element
t: print timeticks unparsed as numeric integers
T: print human-readable text along with hex strings
u: print OIDs using UCD-style prefix suppression
U: don't print units
v: print values only (not OID = value)
x: print all strings in hex format
X: extended index format
-I INOPTS Toggle various defaults controlling input parsing:
b: do best/regex matching to find a MIB node
h: don't apply DISPLAY-HINTs
r: do not check values for range/type legality
R: do random access to OID labels
u: top-level OIDs must have '.' prefix (UCD-style)
s SUFFIX: Append all textual OIDs with SUFFIX before parsing
S PREFIX: Prepend all textual OIDs with PREFIX before parsing
-L LOGOPTS Toggle various defaults controlling logging:
e: log to standard error
o: log to standard output
f file: log to the specified file
s facility: log to syslog (via the specified facility)

(variants)
[EO] pri: log to standard error/output for level 'pri' and above
[EO] p1-p2: log to standard error/output for levels 'p1' to 'p2'
[FS] pri token: log to file/syslog for level 'pri' and above
[FS] p1-p2 token: log to file/syslog for levels 'p1' to 'p2'
-C APPOPTS Set various application specific behaviours:
p: print the number of variables found
i: include given OID in the search range
c: do not check returned OIDs are increasing
t: Display wall-clock time to complete the request
剛剛,我們分別用 v1 跟 v2c 去查詢都沒得到回應,因為 snmpd 的設定檔還沒編輯過,所以我們先編輯一下 /etc/snmp/snmpd.conf 檔,這是 snmpd 的設定檔,其中有幾個地方要改的:

1.首先找一下 com2sec notConfigUser default public 這一段,然後改成如下所示:(其中 10.16.25.25 是 SNMP server 的 IP address)
#com2sec notConfigUser default public
com2sec local localhost public
com2sec mynetwork 10.16.25.25 public
2. 再來是找 group notConfigGroup v1 notConfigUser 這一段,然後改成如下所示:
#group notConfigGroup v1 notConfigUser
#group notConfigGroup v2c notConfigUser
group MyRWGroup v1 local
group MyRWGroup v2c local
group MyROGroup v1 mynetwork
group MyROGroup v2c mynetwork
3. 接著是找 view all included .1 80 這一段,然後改成如下所示:(把前面的 # 去掉)
## incl/excl subtree mask
view all included .1 80
4. 找到 #access MyROGroup "" any noauth 0 all none none 這一段,改成如下所示:
#access MyROGroup "" any noauth 0 all none none
#access MyRWGroup "" any noauth 0 all all all
access MyROGroup "" any noauth prefix all none none
access MyRWGroup "" any noauth prefix all all all
5. 再找一下 syslocation Unknown (configure /etc/snmp/snmp.conf)這一段,改成如下所示:(其中 syslocation 用來告知你機器所在的位置)
syslocation GangShan
syscontact Root (configure /etc/snmp/snmp.local.conf)
6. 接下來是設定 process monitor 的部分,找到 #proc mountd 這一行的位置,這裡假設我們機器上面有 ftp 的服務,而且我們想監視服務的狀態那就可以改成如下所示:
#proc mountd
proc snmpd
proc vsftpd

procfix vsftpd /sbin/service vsftpd restart
(其中 procfix 那一行是在 process 沒有 running 時執行的)。

7. 再來是關於硬碟容量的監視,找到 #disk / 10000 這一段,這裡假設我們要監視 / ,上限是 85% 的使用限制,我們可以設定如下:
#disk / 10000
disk / 15%
好囉,先改這一部分,存檔然後將 snmpd 的服務重啟吧:
[root@KHXPROVS1 ~]# service snmpd restart
Stopping snmpd: [ OK ]
Starting snmpd: [ OK ]
8. 好了,做個簡單的測試吧,先查詢一下硬碟的監視狀況吧:
[root@KHXPROVS1 ~]# snmpwalk -v 2c -c public localhost .1.3.6.1.4.1.2021.9
UCD-SNMP-MIB::dskIndex.1 = INTEGER: 1
UCD-SNMP-MIB::dskPath.1 = STRING: /
UCD-SNMP-MIB::dskDevice.1 = STRING: /dev/sda2
UCD-SNMP-MIB::dskMinimum.1 = INTEGER: -1
UCD-SNMP-MIB::dskMinPercent.1 = INTEGER: 15
UCD-SNMP-MIB::dskTotal.1 = INTEGER: 41286828
UCD-SNMP-MIB::dskAvail.1 = INTEGER: 31760584
UCD-SNMP-MIB::dskUsed.1 = INTEGER: 7428960
UCD-SNMP-MIB::dskPercent.1 = INTEGER: 19
UCD-SNMP-MIB::dskPercentNode.1 = INTEGER: 6
UCD-SNMP-MIB::dskErrorFlag.1 = INTEGER: 0
UCD-SNMP-MIB::dskErrorMsg.1 = STRING:
9. 再來,查詢一下服務的監視狀況吧:
[root@KHXPROVS1 ~]# snmpwalk -v 2c -c public localhost .1.3.6.1.4.1.2021.2
UCD-SNMP-MIB::prIndex.1 = INTEGER: 1
UCD-SNMP-MIB::prIndex.2 = INTEGER: 2
UCD-SNMP-MIB::prNames.1 = STRING: snmpd
UCD-SNMP-MIB::prNames.2 = STRING: vsftpd
UCD-SNMP-MIB::prMin.1 = INTEGER: 0
UCD-SNMP-MIB::prMin.2 = INTEGER: 0
UCD-SNMP-MIB::prMax.1 = INTEGER: 0
UCD-SNMP-MIB::prMax.2 = INTEGER: 0
UCD-SNMP-MIB::prCount.1 = INTEGER: 1
UCD-SNMP-MIB::prCount.2 = INTEGER: 1
UCD-SNMP-MIB::prErrorFlag.1 = INTEGER: 0
UCD-SNMP-MIB::prErrorFlag.2 = INTEGER: 0
UCD-SNMP-MIB::prErrMessage.1 = STRING:
UCD-SNMP-MIB::prErrMessage.2 = STRING:
UCD-SNMP-MIB::prErrFix.1 = INTEGER: 0
UCD-SNMP-MIB::prErrFix.2 = INTEGER: 0
UCD-SNMP-MIB::prErrFixCmd.1 = STRING:
UCD-SNMP-MIB::prErrFixCmd.2 = STRING: /sbin/service vsftpd restart
假設我現在將 vsftpd 服務給停下來,那麼再做一次 snmp query 就會發現 1.3.6.1.4.1.2021.2.1.101 (UCD-SNMP-MIB::prErrMessage.2)的內容變成了:
UCD-SNMP-MIB::prErrMessage.2 = STRING: No vsftpd process running.
10. 接著我們在做個測試,直接用 snmptrap 的指令將 UCD-SNMP-MIB::prErrMessage.2 的值當成 traps 的內容送出到 SNMP server 去:
[root@KHXPROVS1 ~]# /usr/bin/snmptrap -v 2c -c public 10.16.25.25 "" .1.3.6.1.4.1.2021.2.1.101 .1.3.6.1.4.1.2021.2.1.101 s "HOST:KHXP
PROVS1|EVENT=No vsftpd process running."
另外,我們打開 tcpdump 看一下是否有攔到這個 traps 送出:
[root@KHXPROVS1 ~]# tcpdump -vvvXX host 10.16.25.25 -i eth0 and port 162 -s 0
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes


18:23:55.648888 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto 17, length: 165) KHXPROVS1.tatung.net.tw.32796 > 10.16.25.25.snmptrap: [bad udp cksum a09d!] { SNMPv2c { V2Trap(121) R=2145043168 system.sysUpTime.0=37325417 S:1.1.4.1.0=E:2021.2.1.101 E:2021.2.1.101="HOST:KHXPROVS1|EVENT=No vsftpd process running." } }
0x0000: 001d 0926 b7cd 001e c9ad 5464 0800 4500 ...&......Td..E.
0x0010: 00a5 0000 4000 4011 f3ef 0a10 1920 0a10 ....@.@.........
0x0020: 1919 801c 00a2 0091 46fb 3081 8602 0101 ........F.0.....
0x0030: 0406 7075 626c 6963 a779 0204 7fda c2e0 ..public.y......
0x0040: 0201 0002 0100 306b 3010 0608 2b06 0102 ......0k0...+...
0x0050: 0101 0300 4304 0239 8a69 3018 060a 2b06 ....C..9.i0...+.
0x0060: 0106 0301 0104 0100 060a 2b06 0104 018f ..........+.....
0x0070: 6502 0165 303d 060a 2b06 0104 018f 6502 e..e0=..+.....e.
0x0080: 0165 042f 484f 5354 3a4b 4858 5052 4f56 .e./HOST:KHXPROV
0x0090: 5331 7c45 5645 4e54 3d4e 6f20 7673 6674 S1|EVENT=No.vsft
0x00a0: 7064 2070 726f 6365 7373 2072 756e 6e69 pd.process.runni
0x00b0: 6e67 2e ng.

1 packets captured
1 packets received by filter
0 packets dropped by kernel
[root@KHXPROVS1 ~]#
測試完畢,如果這時在 SNMP server 上有 MIB Browser 之類的軟體,便可收到剛剛送出的 ALARM Traps 囉。

下次有機會再把檢查以及送 traps 出去的簡單 scripts 列上來給大家參考吧...


此處列出其他幾個常用的語法:

設定基本的 snmpd 參數:
snmpconf -i -g basic_setup (輔助建立、修改配置文件)
snmpget -v 1 -c public 127.0.0.1 ssCpuRawSystem.0
UCD-SNMP-MIB::ssCpuRawSystem.0 = Counter32: 2377652724

轉換物件名稱的數值形式與可閱讀形式、查詢 MIB 資訊:
snmptranslate -On -Td -IR ssCpuRawSystem
.1.3.6.1.4.1.2021.11.52
ssCpuRawSystem OBJECT-TYPE
— FROM UCD-SNMP-MIB
SYNTAX Counter32
MAX-ACCESS read-only
STATUS current
DESCRIPTION “system CPU time.”
::= { iso(1) org(3) dod(6) internet(1) private(4) enterprises(1) ucdavis(2021) systemStats(11) 52 }
snmptranslate -Td .1.3.6.1.4.1.2021.11.52
UCD-SNMP-MIB::ssCpuRawSystem
ssCpuRawSystem OBJECT-TYPE
— FROM UCD-SNMP-MIB
SYNTAX Counter32
MAX-ACCESS read-only
STATUS current
DESCRIPTION “system CPU time.”
::= { iso(1) org(3) dod(6) internet(1) private(4) enterprises(1) ucdavis(2021) systemStats(11) 52 }
以 SNMP 查詢網路上主機的硬碟用量:
[root@KHXPROVS1 ~]# snmpdf -v 1 -c public -Cu khxprovs1 (<<>
Description size (kB) Used Available Used%
/ 41286828 7433684 33853144 18%
取得網路上主機系統狀態:
[root@KHXPROVS1 ~]# snmpstatus -v 1 -c public khxprovs1 (<<>
[127.0.0.1]=>[Linux KHXPROVS1 2.6.9-55.ELsmp #1 SMP Fri Apr 20 17:03:35 EDT 2007 i686] Up: 16:15:02.30
Interfaces: 0, Recv/Trans packets: 1529/1529 | IP: 38894376/58055763

Net-SNMP 首頁:http://www.net-snmp.org/
查詢 MIB file 或 OID 的好站:ipMonitor Support Portal :: Mibs
(詳全文...)

LINUX Java 環境及 Tomcat 安裝

今天實作的機器為 Dell-1950 安裝的 OS 為 RHEL ES4 Update5,首先我們要先實作安裝 JAVA JDK, 因此我們先從 Java SE Downloads 下載 JDK 6 Update 7:

進入剛剛的頁面後,選擇 JDK 6 Update 7 的 Download 按鈕 (這個版本內還包含了 Java Runtime Environment (JRE) 囉),接下來看到 "Select Platform and Language for your download:" 時選擇你的 OS 跟語言,這裡我選擇 Linux 的 Platfrom 以及 Multi-Language 為 Language 選擇同意後按 "Continus" 下載 "jdk-6u7-linux-i586-rpm.bin"。

或者從 Sun Microsystems 下載 Linux 專用的 Java 軟體:

進到剛剛的連結頁面後,按下 Linux RPM (自我解壓縮檔) 便可下載 JDK 6 Update 7。
--- 建議下載 RPM 自解壓縮格式的(RPM in self-extracting file,jdk-6u7-linux-i586-rpm.bin)

再來是將檔案上傳到這次實作的機器上,這裡就先 ftp 到 /opt 吧:
[root@KHXPROVS1 ~]# cd /opt
[root@KHXPROVS1 opt]# ls -alrt
total 181532
drwx------ 2 root root 16384 Jun 25 22:22 lost+found
-rw-r--r-- 1 root root 248493 Jul 1 14:35 iperf-2.0.4.tar.gz
drwxrwxrwx 8 501 501 4096 Jul 1 14:36 iperf-2.0.4
drwxr-xr-x 25 root root 4096 Aug 27 15:56 ..
drwxr-xr-x 4 root root 4096 Sep 4 09:32 .
-rw-r--r-- 1 root root 74397909 Sep 4 09:37 jdk-6u7-linux-i586-rpm.bin
將檔案權限改為可執行檔:
[root@KHXPROVS1 opt]# chmod +x jdk-6u6-linux-i586-rpm.bin
[root@KHXPROVS1 opt]# ls -alrt
total 181532
drwx------ 2 root root 16384 Jun 25 22:22 lost+found
-rw-r--r-- 1 root root 248493 Jul 1 14:35 iperf-2.0.4.tar.gz
drwxrwxrwx 8 501 501 4096 Jul 1 14:36 iperf-2.0.4
drwxr-xr-x 25 root root 4096 Aug 27 15:56 ..
drwxr-xr-x 4 root root 4096 Sep 4 09:32 .
-rwxr-xr-x 1 root root 74397909 Sep 4 09:37 jdk-6u7-linux-i586-rpm.bin
要開始安裝 JDK囉, 安裝時會有一段 Sun 的協議,敲幾個空白鍵,當詢問是否同意時,敲 yes 就好。
[root@KHXPROVS1 opt]# ./jdk-6u7-linux-i586-rpm.bin
Sun Microsystems, Inc. Binary Code License Agreement

for the JAVA SE DEVELOPMENT KIT (JDK), VERSION 6

SUN MICROSYSTEMS, INC. ("SUN") IS WILLING TO LICENSE THE
SOFTWARE IDENTIFIED BELOW TO YOU ONLY UPON THE CONDITION
THAT YOU ACCEPT ALL OF THE TERMS CONTAINED IN THIS BINARY
CODE LICENSE AGREEMENT AND SUPPLEMENTAL LICENSE TERMS
(COLLECTIVELY "AGREEMENT"). PLEASE READ THE AGREEMENT
CAREFULLY. BY DOWNLOADING OR INSTALLING THIS SOFTWARE, YOU
ACCEPT THE TERMS OF THE AGREEMENT. INDICATE ACCEPTANCE BY
SELECTING THE "ACCEPT" BUTTON AT THE BOTTOM OF THE
AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY ALL THE
TERMS, SELECT THE "DECLINE" BUTTON AT THE BOTTOM OF THE
AGREEMENT AND THE DOWNLOAD OR INSTALL PROCESS WILL NOT
CONTINUE.

1. DEFINITIONS. "Software" means the identified above in
binary form, any other machine readable materials
(including, but not limited to, libraries, source files,
header files, and data files), any updates or error
corrections provided by Sun, and any user manuals,
programming guides and other documentation provided to you
by Sun under this Agreement. "General Purpose Desktop
Computers and Servers" means computers, including desktop,
laptop and tablet computers, or servers, used for general
computing functions under end user control (such as but not
specifically limited to email, general purpose Internet
browsing, and office suite productivity tools).
The use of Software in systems and solutions that provide
dedicated functionality (other than as mentioned above) or
designed for use in embedded or function-specific software
applications, for example but not limited to: Software
embedded in or bundled with industrial control systems,
wireless mobile telephones, wireless handheld devices,
kiosks, TV/STB, Blu-ray Disc devices, telematics and
network control switching equipment, printers and storage
management systems, and other related systems are excluded
from this definition and not licensed under this
Agreement. "Programs" means Java technology applets and
applications intended to run on the Java Platform Standard
Edition (Java SE) platform on Java-enabled General Purpose
Desktop Computers and Servers.

2. LICENSE TO USE. Subject to the terms and conditions of
this Agreement, including, but not limited to the Java
Technology Restrictions of the Supplemental License Terms,
Sun grants you a non-exclusive, non-transferable, limited
license without license fees to reproduce and use
internally Software complete and unmodified for the sole
purpose of running Programs. Additional licenses for
developers and/or publishers are granted in the
Supplemental License Terms.

3. RESTRICTIONS. Software is confidential and copyrighted.
Title to Software and all associated intellectual property
rights is retained by Sun and/or its licensors. Unless
enforcement is prohibited by applicable law, you may not
modify, decompile, or reverse engineer Software. You
acknowledge that Licensed Software is not designed or
intended for use in the design, construction, operation or
maintenance of any nuclear facility. Sun Microsystems, Inc.
disclaims any express or implied warranty of fitness for
such uses. No right, title or interest in or to any
trademark, service mark, logo or trade name of Sun or its
licensors is granted under this Agreement. Additional
restrictions for developers and/or publishers licenses are
set forth in the Supplemental License Terms.

4. LIMITED WARRANTY. Sun warrants to you that for a period
of ninety (90) days from the date of purchase, as evidenced
by a copy of the receipt, the media on which Software is
furnished (if any) will be free of defects in materials and
workmanship under normal use. Except for the foregoing,
Software is provided "AS IS". Your exclusive remedy and
Sun's entire liability under this limited warranty will be
at Sun's option to replace Software media or refund the fee
paid for Software. Any implied warranties on the Software
are limited to 90 days. Some states do not allow
limitations on duration of an implied warranty, so the
above may not apply to you. This limited warranty gives you
specific legal rights. You may have others, which vary from
state to state.

5. DISCLAIMER OF WARRANTY. UNLESS SPECIFIED IN THIS
AGREEMENT, ALL EXPRESS OR IMPLIED CONDITIONS,
REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED
WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE OR NON-INFRINGEMENT ARE DISCLAIMED, EXCEPT TO THE
EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY
INVALID.

6. LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY
LAW, IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR
ANY LOST REVENUE, PROFIT OR DATA, OR FOR SPECIAL, INDIRECT,
CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
CAUSED REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT
OF OR RELATED TO THE USE OF OR INABILITY TO USE SOFTWARE,
EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES. In no event will Sun's liability to you, whether
in contract, tort (including negligence), or otherwise,
exceed the amount paid by you for Software under this
Agreement. The foregoing limitations will apply even if the
above stated warranty fails of its essential purpose. Some
states do not allow the exclusion of incidental or
consequential damages, so some of the terms above may not
be applicable to you.

7. TERMINATION. This Agreement is effective until
terminated. You may terminate this Agreement at any time by
destroying all copies of Software. This Agreement will
terminate immediately without notice from Sun if you fail
to comply with any provision of this Agreement. Either
party may terminate this Agreement immediately should any
Software become, or in either party's opinion be likely to
become, the subject of a claim of infringement of any
intellectual property right. Upon Termination, you must
destroy all copies of Software.

8. EXPORT REGULATIONS. All Software and technical data
delivered under this Agreement are subject to US export
control laws and may be subject to export or import
regulations in other countries. You agree to comply
strictly with all such laws and regulations and acknowledge
that you have the responsibility to obtain such licenses to
export, re-export, or import as may be required after
delivery to you.

9. TRADEMARKS AND LOGOS. You acknowledge and agree as
between you and Sun that Sun owns the SUN, SOLARIS, JAVA,
JINI, FORTE, and iPLANET trademarks and all SUN, SOLARIS,
JAVA, JINI, FORTE, and iPLANET-related trademarks, service
marks, logos and other brand designations ("Sun Marks"),
and you agree to comply with the Sun Trademark and Logo
Usage Requirements currently located at
http://www.sun.com/policies/trademarks. Any use you make of
the Sun Marks inures to Sun's benefit.

10. U.S. GOVERNMENT RESTRICTED RIGHTS. If Software is being
acquired by or on behalf of the U.S. Government or by a
U.S. Government prime contractor or subcontractor (at any
tier), then the Government's rights in Software and
accompanying documentation will be only as set forth in
this Agreement; this is in accordance with 48 CFR 227.7201
through 227.7202-4 (for Department of Defense (DOD)
acquisitions) and with 48 CFR 2.101 and 12.212 (for non-DOD
acquisitions).

11. GOVERNING LAW. Any action related to this Agreement
will be governed by California law and controlling U.S.
federal law. No choice of law rules of any jurisdiction
will apply.

12. SEVERABILITY. If any provision of this Agreement is
held to be unenforceable, this Agreement will remain in
effect with the provision omitted, unless omission would
frustrate the intent of the parties, in which case this
Agreement will immediately terminate.

13. INTEGRATION. This Agreement is the entire agreement
between you and Sun relating to its subject matter. It
supersedes all prior or contemporaneous oral or written
communications, proposals, representations and warranties
and prevails over any conflicting or additional terms of
any quote, order, acknowledgment, or other communication
between the parties relating to its subject matter during
the term of this Agreement. No modification of this
Agreement will be binding, unless in writing and signed by
an authorized representative of each party.

SUPPLEMENTAL LICENSE TERMS

These Supplemental License Terms add to or modify the terms
of the Binary Code License Agreement. Capitalized terms not
defined in these Supplemental Terms shall have the same
meanings ascribed to them in the Binary Code License
Agreement . These Supplemental Terms shall supersede any
inconsistent or conflicting terms in the Binary Code
License Agreement, or in any license contained within the
Software.

A. Software Internal Use and Development License Grant.
Subject to the terms and conditions of this Agreement and
restrictions and exceptions set forth in the Software
"README" file incorporated herein by reference, including,
but not limited to the Java Technology Restrictions of
these Supplemental Terms, Sun grants you a non-exclusive,
non-transferable, limited license without fees to reproduce
internally and use internally the Software complete and
unmodified for the purpose of designing, developing, and
testing your Programs.

B. License to Distribute Software. Subject to the terms and
conditions of this Agreement and restrictions and
exceptions set forth in the Software README file,
including, but not limited to the Java Technology
Restrictions of these Supplemental Terms, Sun grants you a
non-exclusive, non-transferable, limited license without
fees to reproduce and distribute the Software, provided
that (i) you distribute the Software complete and
unmodified and only bundled as part of, and for the sole
purpose of running, your Programs, (ii) the Programs add
significant and primary functionality to the Software,
(iii) you do not distribute additional software intended to
replace any component(s) of the Software, (iv) you do not
remove or alter any proprietary legends or notices
contained in the Software, (v) you only distribute the
Software subject to a license agreement that protects Sun's
interests consistent with the terms contained in this
Agreement, and (vi) you agree to defend and indemnify Sun
and its licensors from and against any damages, costs,
liabilities, settlement amounts and/or expenses (including
attorneys' fees) incurred in connection with any claim,
lawsuit or action by any third party that arises or results
from the use or distribution of any and all Programs and/or
Software.

C. License to Distribute Redistributables. Subject to the
terms and conditions of this Agreement and restrictions and
exceptions set forth in the Software README file, including
but not limited to the Java Technology Restrictions of
these Supplemental Terms, Sun grants you a non-exclusive,
non-transferable, limited license without fees to reproduce
and distribute those files specifically identified as
redistributable in the Software "README" file
("Redistributables") provided that: (i) you distribute the
Redistributables complete and unmodified, and only bundled
as part of Programs, (ii) the Programs add significant and
primary functionality to the Redistributables, (iii) you do
not distribute additional software intended to supersede
any component(s) of the Redistributables (unless otherwise
specified in the applicable README file), (iv) you do not
remove or alter any proprietary legends or notices
contained in or on the Redistributables, (v) you only
distribute the Redistributables pursuant to a license
agreement that protects Sun's interests consistent with the
terms contained in the Agreement, (vi) you agree to defend
and indemnify Sun and its licensors from and against any
damages, costs, liabilities, settlement amounts and/or
expenses (including attorneys' fees) incurred in connection
with any claim, lawsuit or action by any third party that
arises or results from the use or distribution of any and
all Programs and/or Software.

D. Java Technology Restrictions. You may not create,
modify, or change the behavior of, or authorize your
licensees to create, modify, or change the behavior of,
classes, interfaces, or subpackages that are in any way
identified as "java", "javax", "sun" or similar convention
as specified by Sun in any naming convention designation.

E. Distribution by Publishers. This section pertains to
your distribution of the Software with your printed book or
magazine (as those terms are commonly used in the industry)
relating to Java technology ("Publication"). Subject to and
conditioned upon your compliance with the restrictions and
obligations contained in the Agreement, in addition to the
license granted in Paragraph 1 above, Sun hereby grants to
you a non-exclusive, nontransferable limited right to
reproduce complete and unmodified copies of the Software on
electronic media (the "Media") for the sole purpose of
inclusion and distribution with your Publication(s),
subject to the following terms: (i) You may not distribute
the Software on a stand-alone basis; it must be distributed
with your Publication(s); (ii) You are responsible for
downloading the Software from the applicable Sun web site;
(iii) You must refer to the Software as JavaTM SE
Development Kit 6; (iv) The Software must be reproduced in
its entirety and without any modification whatsoever
(including, without limitation, the Binary Code License and
Supplemental License Terms accompanying the Software and
proprietary rights notices contained in the Software);
(v) The Media label shall include the following
information: Copyright 2006, Sun Microsystems, Inc. All
rights reserved. Use is subject to license terms. Sun, Sun
Microsystems, the Sun logo, Solaris, Java, the Java Coffee
Cup logo, J2SE, and all trademarks and logos based on Java
are trademarks or registered trademarks of Sun
Microsystems, Inc. in the U.S. and other countries. This
information must be placed on the Media label in such a
manner as to only apply to the Sun Software; (vi) You must
clearly identify the Software as Sun's product on the Media
holder or Media label, and you may not state or imply that
Sun is responsible for any third-party software contained
on the Media; (vii) You may not include any third party
software on the Media which is intended to be a replacement
or substitute for the Software; (viii) You shall indemnify
Sun for all damages arising from your failure to comply
with the requirements of this Agreement. In addition, you
shall defend, at your expense, any and all claims brought
against Sun by third parties, and shall pay all damages
awarded by a court of competent jurisdiction, or such
settlement amount negotiated by you, arising out of or in
connection with your use, reproduction or distribution of
the Software and/or the Publication. Your obligation to
provide indemnification under this section shall arise
provided that Sun: (a) provides you prompt notice of the
claim; (b) gives you sole control of the defense and
settlement of the claim; (c) provides you, at your expense,
with all available information, assistance and authority to
defend; and (d) has not compromised or settled such claim
without your prior written consent; and (ix) You shall
provide Sun with a written notice for each Publication;
such notice shall include the following information: (1)
title of Publication, (2) author(s), (3) date of
Publication, and (4) ISBN or ISSN numbers. Such notice
shall be sent to Sun Microsystems, Inc., 4150 Network
Circle, M/S USCA12-110, Santa Clara, California 95054,
U.S.A , Attention: Contracts Administration.

F. Source Code. Software may contain source code that,
unless expressly licensed for other purposes, is provided
solely for reference purposes pursuant to the terms of this
Agreement. Source code may not be redistributed unless
expressly provided for in this Agreement.

G. Third Party Code. Additional copyright notices and
license terms applicable to portions of the Software are
set forth in the THIRDPARTYLICENSEREADME.txt file. In
addition to any terms and conditions of any third party
opensource/freeware license identified in the
THIRDPARTYLICENSEREADME.txt file, the disclaimer of
warranty and limitation of liability provisions in
paragraphs 5 and 6 of the Binary Code License Agreement
shall apply to all Software in this distribution.

H. Termination for Infringement. Either party may terminate
this Agreement immediately should any Software become, or
in either party's opinion be likely to become, the subject
of a claim of infringement of any intellectual property
right.

I. Installation and Auto-Update. The Software's
installation and auto-update processes transmit a limited
amount of data to Sun (or its service provider) about those
specific processes to help Sun understand and optimize
them. Sun does not associate the data with personally
identifiable information. You can find more information
about the data Sun collects at http://java.com/data/.

For inquiries please contact: Sun Microsystems, Inc., 4150
Network Circle, Santa Clara, California 95054, U.S.A.

Do you agree to the above license terms? [yes or no]
yes
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
inflating: jdk-6u7-linux-i586.rpm
inflating: sun-javadb-common-10.3.1-4.1.i386.rpm
inflating: sun-javadb-core-10.3.1-4.1.i386.rpm
inflating: sun-javadb-client-10.3.1-4.1.i386.rpm
inflating: sun-javadb-demo-10.3.1-4.1.i386.rpm
inflating: sun-javadb-docs-10.3.1-4.1.i386.rpm
inflating: sun-javadb-javadoc-10.3.1-4.1.i386.rpm
Preparing... ########################################### [100%]
1:jdk ########################################### [100%]
Unpacking JAR files...
rt.jar...
jsse.jar...
charsets.jar...
tools.jar...
localedata.jar...
plugin.jar...
javaws.jar...
deploy.jar...
Installing JavaDB
Preparing... ########################################### [100%]
1:sun-javadb-common ########################################### [ 17%]
2:sun-javadb-core ########################################### [ 33%]
3:sun-javadb-client ########################################### [ 50%]
4:sun-javadb-demo ########################################### [ 67%]
5:sun-javadb-docs ########################################### [ 83%]
6:sun-javadb-javadoc ########################################### [100%]

Java(TM) SE Development Kit 6 successfully installed.

Product Registration is FREE and includes many benefits:
* Notification of new versions, patches, and updates
* Special offers on Sun products, services and training
* Access to early releases and documentation

Product and system data will be collected. If your configuration
supports a browser, the Sun Product Registration form for
the JDK will be presented. If you do not register, none of
this information will be saved. You may also register your
JDK later by opening the register.html file (located in
the JDK installation directory) in a browser.

For more information on what data Registration collects and
how it is managed and used, see:
http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html

Press Enter to continue.....

Done.
檢查一下目前安裝的 JAVA 吧:
[root@KHXPROVS1 opt]# rpm -qa|grep java
sun-javadb-demo-10.3.1-4.1
sun-javadb-common-10.3.1-4.1
java-1.4.2-gcj-compat-1.4.2.0-27jpp
sun-javadb-core-10.3.1-4.1
sun-javadb-javadoc-10.3.1-4.1
db4-java-4.2.52-7.1
gcc4-java-4.1.1-53.EL4
java-1.4.2-gcj-compat-devel-1.4.2.0-27jpp
sun-javadb-client-10.3.1-4.1
gcc-java-3.4.6-8
sun-javadb-docs-10.3.1-4.1
而 JDK 會被安裝到 /usr/java/jdk1.6.0_07 底下:其中 /usr/java/jdk1.6.0_07/jre 便是 Java Runtime Environment 的安裝路徑喔。
[root@KHXPROVS1 opt]# ls -alrt /usr/java/
total 16
drwxr-xr-x 15 root root 4096 Sep 4 09:39 ..
lrwxrwxrwx 1 root root 21 Sep 4 09:40 latest -> /usr/java/jdk1.6.0_07
drwxr-xr-x 9 root root 4096 Sep 4 09:40 jdk1.6.0_07
lrwxrwxrwx 1 root root 16 Sep 4 09:40 default -> /usr/java/latest
drwxr-xr-x 3 root root 4096 Sep 4 09:40 .
[root@KHXPROVS1 ~]# ls -al /usr/java/jdk1.6.0_07
total 18660
drwxr-xr-x 9 root root 4096 Sep 4 09:40 .
drwxr-xr-x 3 root root 4096 Sep 11 13:26 ..
drwxr-xr-x 2 root root 4096 Sep 4 09:39 bin
-rw-r--r-- 1 root root 4137 Jun 10 16:54 COPYRIGHT
drwxr-xr-x 10 root root 4096 Sep 4 09:39 demo
drwxr-xr-x 3 root root 4096 Sep 4 09:39 include
drwxr-xr-x 6 root root 4096 Sep 4 09:39 jre
drwxr-xr-x 3 root root 4096 Sep 4 11:15 lib
-rw-r--r-- 1 root root 17058 Jun 10 16:54 LICENSE
drwxr-xr-x 4 root root 4096 Sep 4 09:39 man
-rw-r--r-- 1 root root 28599 Jun 10 16:54 README.html
-rw-r--r-- 1 root root 24132 Jun 10 16:54 README_ja.html
-rw-r--r-- 1 root root 18329 Jun 10 16:54 README_zh_CN.html
-r--r--r-- 1 root root 5134 Sep 4 09:40 register.html
-r--r--r-- 1 root root 5566 Sep 4 09:40 register_ja.html
-r--r--r-- 1 root root 4744 Sep 4 09:40 register_zh_CN.html
drwxr-xr-x 9 root root 4096 Sep 4 09:39 sample
-rw-r--r-- 1 root root 18719895 Jun 10 16:54 src.zip
-rw-r--r-- 1 root root 190102 Jun 10 16:54 THIRDPARTYLICENSEREADME.txt
[root@KHXPROVS1 ~]#

如果你和我一樣沒有 Sun JDK 的 JPackage Java compatibility package,那麼就到 RepoView: Scientific Linux Fermi Testing 5rolling x86_64 或者到 FileWatcher 去下載 java-1.6.0-sun-compat-1.6.0.07-1jpp.i586.rpm (60.32 KB) 吧。一樣的,下載完後將檔案 ftp 到實作機的 /opt 去,然後安裝:
[root@KHXPROVS1 opt]# ls -al
total 292796
drwxr-xr-x 5 root root 4096 Sep 4 11:09 .
drwxr-xr-x 25 root root 4096 Sep 4 10:43 ..
drwxrwxrwx 8 501 501 4096 Jul 1 14:36 iperf-2.0.4
-rw-r--r-- 1 root root 248493 Jul 1 14:35 iperf-2.0.4.tar.gz
-rw-r--r-- 1 root root 61764 Sep 4 11:09 java-1.6.0-sun-compat-1.6.0.07-1jpp.i586.rpm
-rw-r--r-- 1 root root 65414959 Jun 10 18:38 jdk-6u7-linux-i586.rpm
-rwxr-xr-x 1 root root 74397909 Sep 4 09:37 jdk-6u7-linux-i586-rpm.bin
-rw-r--r-- 1 root root 19463427 Jun 10 18:36 jre-6u7-linux-i586.rpm
-rwxr-xr-x 1 root root 19216086 Sep 4 10:31 jre-6u7-linux-i586-rpm.bin
drwx------ 2 root root 16384 Jun 25 22:22 lost+found
drwxr-xr-x 3 root root 4096 Sep 4 09:40 sun
-rw-r--r-- 1 root root 463678 Aug 20 2007 sun-javadb-client-10.3.1-4.1.i386.rpm
-rw-r--r-- 1 root root 62801 Aug 20 2007 sun-javadb-common-10.3.1-4.1.i386.rpm
-rw-r--r-- 1 root root 3655834 Aug 20 2007 sun-javadb-core-10.3.1-4.1.i386.rpm
-rw-r--r-- 1 root root 996942 Aug 20 2007 sun-javadb-demo-10.3.1-4.1.i386.rpm
-rw-r--r-- 1 root root 4290799 Aug 20 2007 sun-javadb-docs-10.3.1-4.1.i386.rpm
-rw-r--r-- 1 root root 123721 Aug 20 2007 sun-javadb-javadoc-10.3.1-4.1.i386.rpm
[root@KHXPROVS1 opt]# rpm -Uvh java-1.6.0-sun-compat-1.6.0.07-1jpp.i586.rpm
warning: java-1.6.0-sun-compat-1.6.0.07-1jpp.i586.rpm: V3 DSA signature: NOKEY, key ID 82fd17b2
Preparing... ########################################### [100%]
1:java-1.6.0-sun-compat ########################################### [100%]
檢查一下 java-1.6.0-sun-compat-1.6.0.07-1jpp 有出現在 rpm installation list 裡面:
[root@KHXPROVS1 opt]# rpm -qa |grep java
sun-javadb-demo-10.3.1-4.1
sun-javadb-common-10.3.1-4.1
java-1.4.2-gcj-compat-1.4.2.0-27jpp
sun-javadb-core-10.3.1-4.1
sun-javadb-javadoc-10.3.1-4.1
db4-java-4.2.52-7.1
gcc4-java-4.1.1-53.EL4
java-1.4.2-gcj-compat-devel-1.4.2.0-27jpp
sun-javadb-client-10.3.1-4.1
java-1.6.0-sun-compat-1.6.0.07-1jpp
gcc-java-3.4.6-8
sun-javadb-docs-10.3.1-4.1
接下來檢查一下目前系統使用的 JAVA 版本:
[root@KHXPROVS1 opt]# java -version
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Server VM (build 10.0-b23, mixed mode)
確認一下目前的系統是設定最後版本為 default JAVA, run 下面的 command: (應該會看到目前系統有兩個可用的 Java 程式, 如下所示)
[root@KHXPROVS1 opt]# alternatives --config java

There are 2 programs which provide 'java'.

Selection Command
-----------------------------------------------
1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
*+ 2 /usr/lib/jvm/jre-1.6.0-sun/bin/java

Enter to keep the current selection[+], or type selection number:
[root@KHXPROVS1 opt]#
如果在 number 2 之前有看到 *+, 那就ok,直接按 Enter 就好。不過如果你的運氣不好,是 1 被選到,那麼 type 2 並按 Enter 改為使用最後版本。

JDK 安裝到這裡算是 ok 了,接下來是設定環境變數,可以用 export 命令直接在 shell 下設置,但只針對當前的 shell 有效,因此我們直接去修改 .bashrc 文件吧:
[root@KHXPROVS1 opt]# vi ~/.bashrc
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias vi='vim'

TERM=xterm-color; export TERM;

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

export JAVA_HOME=/usr/java/jdk1.6.0_07
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
~
存檔然後離開這個 shell 再進來一次:
[root@KHXPROVS1 opt]# exit
logout
測試一下剛剛的環境變數:
[root@KHXPROVS1 ~]# echo $JAVA_HOME
/usr/java/jdk1.6.0_07
[root@KHXPROVS1 ~]# echo $CLASSPATH
.:/usr/java/jdk1.6.0_07/lib/dt.jar:/usr/java/jdk1.6.0_07/lib/tools.jar
[root@KHXPROVS1 ~]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/java/jdk1.6.0_07/bin:/root/bin
[root@KHXPROVS1 ~]#
接著是 Apache Tomcat 的安裝部分了,首先我們到 Apache Tomcat 的官方網站去,點選左邊 download 的一個版本,這裡選擇的是 tomcat6.x:
進去後選 Binary Distributions 下的 tar.gz (pgp, md5) 來下載 Apache Tomcat v6.0.18。

下載完後將 apache-tomcat-6.0.18.tar.gz 上傳到測試機器的 /opt 下:
[root@KHXPROVS1 opt]# cd /opt
[root@KHXPROVS1 opt]# ls -al
total 292796
drwxr-xr-x 5 root root 4096 Sep 4 11:09 .
drwxr-xr-x 25 root root 4096 Sep 4 10:43 ..
-rw-r--r-- 1 root root 6142197 Sep 3 19:04 apache-tomcat-6.0.18.tar.gz
drwxrwxrwx 8 501 501 4096 Jul 1 14:36 iperf-2.0.4
-rw-r--r-- 1 root root 248493 Jul 1 14:35 iperf-2.0.4.tar.gz
-rw-r--r-- 1 root root 61764 Sep 4 11:09 java-1.6.0-sun-compat-1.6.0.07-1jpp.i586.rpm
-rw-r--r-- 1 root root 65414959 Jun 10 18:38 jdk-6u7-linux-i586.rpm
-rwxr-xr-x 1 root root 74397909 Sep 4 09:37 jdk-6u7-linux-i586-rpm.bin
-rw-r--r-- 1 root root 19463427 Jun 10 18:36 jre-6u7-linux-i586.rpm
-rwxr-xr-x 1 root root 19216086 Sep 4 10:31 jre-6u7-linux-i586-rpm.bin
drwx------ 2 root root 16384 Jun 25 22:22 lost+found
drwxr-xr-x 3 root root 4096 Sep 4 09:40 sun
-rw-r--r-- 1 root root 463678 Aug 20 2007 sun-javadb-client-10.3.1-4.1.i386.rpm
-rw-r--r-- 1 root root 62801 Aug 20 2007 sun-javadb-common-10.3.1-4.1.i386.rpm
-rw-r--r-- 1 root root 3655834 Aug 20 2007 sun-javadb-core-10.3.1-4.1.i386.rpm
-rw-r--r-- 1 root root 996942 Aug 20 2007 sun-javadb-demo-10.3.1-4.1.i386.rpm
-rw-r--r-- 1 root root 4290799 Aug 20 2007 sun-javadb-docs-10.3.1-4.1.i386.rpm
-rw-r--r-- 1 root root 123721 Aug 20 2007 sun-javadb-javadoc-10.3.1-4.1.i386.rpm
接下來安裝的話直接解壓縮就可以了:(目前預計要安裝的路徑為 /opt/ 喔)
[root@KHXPROVS1 opt]# tar zxvf apache-tomcat-6.0.18.tar.gz
apache-tomcat-6.0.18/bin/catalina.sh
apache-tomcat-6.0.18/bin/digest.sh
apache-tomcat-6.0.18/bin/setclasspath.sh
apache-tomcat-6.0.18/bin/shutdown.sh
apache-tomcat-6.0.18/bin/startup.sh
apache-tomcat-6.0.18/bin/tool-wrapper.sh
apache-tomcat-6.0.18/bin/version.sh
apache-tomcat-6.0.18/conf/
apache-tomcat-6.0.18/conf/catalina.policy
apache-tomcat-6.0.18/conf/catalina.properties
apache-tomcat-6.0.18/conf/context.xml
apache-tomcat-6.0.18/conf/logging.properties
apache-tomcat-6.0.18/conf/server.xml
apache-tomcat-6.0.18/conf/tomcat-users.xml
apache-tomcat-6.0.18/conf/web.xml
apache-tomcat-6.0.18/bin/
apache-tomcat-6.0.18/lib/
apache-tomcat-6.0.18/logs/
apache-tomcat-6.0.18/temp/
apache-tomcat-6.0.18/webapps/
apache-tomcat-6.0.18/webapps/ROOT/
apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/
apache-tomcat-6.0.18/webapps/docs/
apache-tomcat-6.0.18/webapps/docs/WEB-INF/
apache-tomcat-6.0.18/webapps/docs/api/
apache-tomcat-6.0.18/webapps/docs/appdev/
apache-tomcat-6.0.18/webapps/docs/appdev/printer/
apache-tomcat-6.0.18/webapps/docs/appdev/printer/docs/
apache-tomcat-6.0.18/webapps/docs/appdev/printer/docs/appdev/
apache-tomcat-6.0.18/webapps/docs/appdev/sample/
apache-tomcat-6.0.18/webapps/docs/appdev/sample/docs/
apache-tomcat-6.0.18/webapps/docs/appdev/sample/src/
apache-tomcat-6.0.18/webapps/docs/appdev/sample/src/mypackage/
apache-tomcat-6.0.18/webapps/docs/appdev/sample/web/
apache-tomcat-6.0.18/webapps/docs/appdev/sample/web/WEB-INF/
apache-tomcat-6.0.18/webapps/docs/appdev/sample/web/images/
apache-tomcat-6.0.18/webapps/docs/architecture/
apache-tomcat-6.0.18/webapps/docs/architecture/printer/
apache-tomcat-6.0.18/webapps/docs/architecture/requestProcess/
apache-tomcat-6.0.18/webapps/docs/architecture/startup/
apache-tomcat-6.0.18/webapps/docs/config/
apache-tomcat-6.0.18/webapps/docs/config/printer/
apache-tomcat-6.0.18/webapps/docs/funcspecs/
apache-tomcat-6.0.18/webapps/docs/funcspecs/printer/
apache-tomcat-6.0.18/webapps/docs/images/
apache-tomcat-6.0.18/webapps/docs/printer/
apache-tomcat-6.0.18/webapps/docs/tribes/
apache-tomcat-6.0.18/webapps/examples/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/cal/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/chat/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/checkbox/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/colors/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/compressionFilters/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/dates/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/error/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/examples/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/filters/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/jsp2/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/jsp2/examples/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/jsp2/examples/el/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/listeners/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/num/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/sessions/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/util/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/validators/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/jsp/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/jsp/applet/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/jsp2/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/lib/
apache-tomcat-6.0.18/webapps/examples/WEB-INF/tags/
apache-tomcat-6.0.18/webapps/examples/jsp/
apache-tomcat-6.0.18/webapps/examples/jsp/cal/
apache-tomcat-6.0.18/webapps/examples/jsp/chat/
apache-tomcat-6.0.18/webapps/examples/jsp/checkbox/
apache-tomcat-6.0.18/webapps/examples/jsp/colors/
apache-tomcat-6.0.18/webapps/examples/jsp/dates/
apache-tomcat-6.0.18/webapps/examples/jsp/error/
apache-tomcat-6.0.18/webapps/examples/jsp/forward/
apache-tomcat-6.0.18/webapps/examples/jsp/images/
apache-tomcat-6.0.18/webapps/examples/jsp/include/
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/el/
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/jspattribute/
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/jspx/
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/misc/
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/simpletag/
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/tagfiles/
apache-tomcat-6.0.18/webapps/examples/jsp/jsptoserv/
apache-tomcat-6.0.18/webapps/examples/jsp/num/
apache-tomcat-6.0.18/webapps/examples/jsp/plugin/
apache-tomcat-6.0.18/webapps/examples/jsp/plugin/applet/
apache-tomcat-6.0.18/webapps/examples/jsp/security/
apache-tomcat-6.0.18/webapps/examples/jsp/security/protected/
apache-tomcat-6.0.18/webapps/examples/jsp/sessions/
apache-tomcat-6.0.18/webapps/examples/jsp/simpletag/
apache-tomcat-6.0.18/webapps/examples/jsp/snp/
apache-tomcat-6.0.18/webapps/examples/jsp/tagplugin/
apache-tomcat-6.0.18/webapps/examples/jsp/xml/
apache-tomcat-6.0.18/webapps/examples/servlets/
apache-tomcat-6.0.18/webapps/examples/servlets/images/
apache-tomcat-6.0.18/webapps/host-manager/
apache-tomcat-6.0.18/webapps/host-manager/META-INF/
apache-tomcat-6.0.18/webapps/host-manager/WEB-INF/
apache-tomcat-6.0.18/webapps/host-manager/images/
apache-tomcat-6.0.18/webapps/manager/
apache-tomcat-6.0.18/webapps/manager/META-INF/
apache-tomcat-6.0.18/webapps/manager/WEB-INF/
apache-tomcat-6.0.18/webapps/manager/images/
apache-tomcat-6.0.18/work/
apache-tomcat-6.0.18/LICENSE
apache-tomcat-6.0.18/NOTICE
apache-tomcat-6.0.18/RELEASE-NOTES
apache-tomcat-6.0.18/RUNNING.txt
apache-tomcat-6.0.18/bin/bootstrap.jar
apache-tomcat-6.0.18/bin/catalina-tasks.xml
apache-tomcat-6.0.18/bin/catalina.bat
apache-tomcat-6.0.18/bin/commons-daemon.jar
apache-tomcat-6.0.18/bin/cpappend.bat
apache-tomcat-6.0.18/bin/digest.bat
apache-tomcat-6.0.18/bin/jsvc.tar.gz
apache-tomcat-6.0.18/bin/service.bat
apache-tomcat-6.0.18/bin/setclasspath.bat
apache-tomcat-6.0.18/bin/shutdown.bat
apache-tomcat-6.0.18/bin/startup.bat
apache-tomcat-6.0.18/bin/tomcat-juli.jar
apache-tomcat-6.0.18/bin/tomcat-native.tar.gz
apache-tomcat-6.0.18/bin/tomcat6.exe
apache-tomcat-6.0.18/bin/tomcat6w.exe
apache-tomcat-6.0.18/bin/tool-wrapper.bat
apache-tomcat-6.0.18/bin/version.bat
apache-tomcat-6.0.18/lib/annotations-api.jar
apache-tomcat-6.0.18/lib/catalina-ant.jar
apache-tomcat-6.0.18/lib/catalina-ha.jar
apache-tomcat-6.0.18/lib/catalina-tribes.jar
apache-tomcat-6.0.18/lib/catalina.jar
apache-tomcat-6.0.18/lib/el-api.jar
apache-tomcat-6.0.18/lib/jasper-el.jar
apache-tomcat-6.0.18/lib/jasper-jdt.jar
apache-tomcat-6.0.18/lib/jasper.jar
apache-tomcat-6.0.18/lib/jsp-api.jar
apache-tomcat-6.0.18/lib/servlet-api.jar
apache-tomcat-6.0.18/lib/tomcat-coyote.jar
apache-tomcat-6.0.18/lib/tomcat-dbcp.jar
apache-tomcat-6.0.18/lib/tomcat-i18n-es.jar
apache-tomcat-6.0.18/lib/tomcat-i18n-fr.jar
apache-tomcat-6.0.18/lib/tomcat-i18n-ja.jar
apache-tomcat-6.0.18/temp/safeToDelete.tmp
apache-tomcat-6.0.18/webapps/ROOT/RELEASE-NOTES.txt
apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/web.xml
apache-tomcat-6.0.18/webapps/ROOT/asf-logo-wide.gif
apache-tomcat-6.0.18/webapps/ROOT/build.xml
apache-tomcat-6.0.18/webapps/ROOT/favicon.ico
apache-tomcat-6.0.18/webapps/ROOT/index.html
apache-tomcat-6.0.18/webapps/ROOT/index.jsp
apache-tomcat-6.0.18/webapps/ROOT/tomcat-power.gif
apache-tomcat-6.0.18/webapps/ROOT/tomcat.gif
apache-tomcat-6.0.18/webapps/ROOT/tomcat.svg
apache-tomcat-6.0.18/webapps/docs/BUILDING.txt
apache-tomcat-6.0.18/webapps/docs/NOTICE
apache-tomcat-6.0.18/webapps/docs/RELEASE-NOTES.txt
apache-tomcat-6.0.18/webapps/docs/RUNNING.txt
apache-tomcat-6.0.18/webapps/docs/WEB-INF/web.xml
apache-tomcat-6.0.18/webapps/docs/aio.html
apache-tomcat-6.0.18/webapps/docs/api/index.html
apache-tomcat-6.0.18/webapps/docs/appdev/build.xml.txt
apache-tomcat-6.0.18/webapps/docs/appdev/deployment.html
apache-tomcat-6.0.18/webapps/docs/appdev/index.html
apache-tomcat-6.0.18/webapps/docs/appdev/installation.html
apache-tomcat-6.0.18/webapps/docs/appdev/introduction.html
apache-tomcat-6.0.18/webapps/docs/appdev/printer/deployment.html
apache-tomcat-6.0.18/webapps/docs/appdev/printer/docs/appdev/build.xml.txt
apache-tomcat-6.0.18/webapps/docs/appdev/printer/docs/appdev/web.xml.txt
apache-tomcat-6.0.18/webapps/docs/appdev/printer/index.html
apache-tomcat-6.0.18/webapps/docs/appdev/printer/installation.html
apache-tomcat-6.0.18/webapps/docs/appdev/printer/introduction.html
apache-tomcat-6.0.18/webapps/docs/appdev/printer/processes.html
apache-tomcat-6.0.18/webapps/docs/appdev/printer/source.html
apache-tomcat-6.0.18/webapps/docs/appdev/processes.html
apache-tomcat-6.0.18/webapps/docs/appdev/sample/build.xml
apache-tomcat-6.0.18/webapps/docs/appdev/sample/docs/README.txt
apache-tomcat-6.0.18/webapps/docs/appdev/sample/index.html
apache-tomcat-6.0.18/webapps/docs/appdev/sample/sample.war
apache-tomcat-6.0.18/webapps/docs/appdev/sample/src/mypackage/Hello.java
apache-tomcat-6.0.18/webapps/docs/appdev/sample/web/WEB-INF/web.xml
apache-tomcat-6.0.18/webapps/docs/appdev/sample/web/hello.jsp
apache-tomcat-6.0.18/webapps/docs/appdev/sample/web/images/tomcat.gif
apache-tomcat-6.0.18/webapps/docs/appdev/sample/web/index.html
apache-tomcat-6.0.18/webapps/docs/appdev/source.html
apache-tomcat-6.0.18/webapps/docs/appdev/web.xml.txt
apache-tomcat-6.0.18/webapps/docs/apr.html
apache-tomcat-6.0.18/webapps/docs/architecture/index.html
apache-tomcat-6.0.18/webapps/docs/architecture/overview.html
apache-tomcat-6.0.18/webapps/docs/architecture/printer/index.html
apache-tomcat-6.0.18/webapps/docs/architecture/printer/overview.html
apache-tomcat-6.0.18/webapps/docs/architecture/printer/requestProcess.html
apache-tomcat-6.0.18/webapps/docs/architecture/printer/startup.html
apache-tomcat-6.0.18/webapps/docs/architecture/requestProcess.html
apache-tomcat-6.0.18/webapps/docs/architecture/requestProcess/requestProcess.pdf
apache-tomcat-6.0.18/webapps/docs/architecture/requestProcess/roseModel.mdl
apache-tomcat-6.0.18/webapps/docs/architecture/startup.html
apache-tomcat-6.0.18/webapps/docs/architecture/startup/serverStartup.pdf
apache-tomcat-6.0.18/webapps/docs/architecture/startup/serverStartup.txt
apache-tomcat-6.0.18/webapps/docs/balancer-howto.html
apache-tomcat-6.0.18/webapps/docs/building.html
apache-tomcat-6.0.18/webapps/docs/cgi-howto.html
apache-tomcat-6.0.18/webapps/docs/changelog.html
apache-tomcat-6.0.18/webapps/docs/class-loader-howto.html
apache-tomcat-6.0.18/webapps/docs/cluster-howto.html
apache-tomcat-6.0.18/webapps/docs/config/ajp.html
apache-tomcat-6.0.18/webapps/docs/config/cluster-channel.html
apache-tomcat-6.0.18/webapps/docs/config/cluster-deployer.html
apache-tomcat-6.0.18/webapps/docs/config/cluster-interceptor.html
apache-tomcat-6.0.18/webapps/docs/config/cluster-listener.html
apache-tomcat-6.0.18/webapps/docs/config/cluster-manager.html
apache-tomcat-6.0.18/webapps/docs/config/cluster-membership.html
apache-tomcat-6.0.18/webapps/docs/config/cluster-receiver.html
apache-tomcat-6.0.18/webapps/docs/config/cluster-sender.html
apache-tomcat-6.0.18/webapps/docs/config/cluster-valve.html
apache-tomcat-6.0.18/webapps/docs/config/cluster.html
apache-tomcat-6.0.18/webapps/docs/config/context.html
apache-tomcat-6.0.18/webapps/docs/config/engine.html
apache-tomcat-6.0.18/webapps/docs/config/executor.html
apache-tomcat-6.0.18/webapps/docs/config/globalresources.html
apache-tomcat-6.0.18/webapps/docs/config/host.html
apache-tomcat-6.0.18/webapps/docs/config/http.html
apache-tomcat-6.0.18/webapps/docs/config/index.html
apache-tomcat-6.0.18/webapps/docs/config/loader.html
apache-tomcat-6.0.18/webapps/docs/config/manager.html
apache-tomcat-6.0.18/webapps/docs/config/printer/ajp.html
apache-tomcat-6.0.18/webapps/docs/config/printer/cluster-channel.html
apache-tomcat-6.0.18/webapps/docs/config/printer/cluster-deployer.html
apache-tomcat-6.0.18/webapps/docs/config/printer/cluster-interceptor.html
apache-tomcat-6.0.18/webapps/docs/config/printer/cluster-listener.html
apache-tomcat-6.0.18/webapps/docs/config/printer/cluster-manager.html
apache-tomcat-6.0.18/webapps/docs/config/printer/cluster-membership.html
apache-tomcat-6.0.18/webapps/docs/config/printer/cluster-receiver.html
apache-tomcat-6.0.18/webapps/docs/config/printer/cluster-sender.html
apache-tomcat-6.0.18/webapps/docs/config/printer/cluster-valve.html
apache-tomcat-6.0.18/webapps/docs/config/printer/cluster.html
apache-tomcat-6.0.18/webapps/docs/config/printer/context.html
apache-tomcat-6.0.18/webapps/docs/config/printer/engine.html
apache-tomcat-6.0.18/webapps/docs/config/printer/executor.html
apache-tomcat-6.0.18/webapps/docs/config/printer/globalresources.html
apache-tomcat-6.0.18/webapps/docs/config/printer/host.html
apache-tomcat-6.0.18/webapps/docs/config/printer/http.html
apache-tomcat-6.0.18/webapps/docs/config/printer/index.html
apache-tomcat-6.0.18/webapps/docs/config/printer/loader.html
apache-tomcat-6.0.18/webapps/docs/config/printer/manager.html
apache-tomcat-6.0.18/webapps/docs/config/printer/realm.html
apache-tomcat-6.0.18/webapps/docs/config/printer/resources.html
apache-tomcat-6.0.18/webapps/docs/config/printer/server.html
apache-tomcat-6.0.18/webapps/docs/config/printer/service.html
apache-tomcat-6.0.18/webapps/docs/config/printer/systemprops.html
apache-tomcat-6.0.18/webapps/docs/config/printer/valve.html
apache-tomcat-6.0.18/webapps/docs/config/realm.html
apache-tomcat-6.0.18/webapps/docs/config/resources.html
apache-tomcat-6.0.18/webapps/docs/config/server.html
apache-tomcat-6.0.18/webapps/docs/config/service.html
apache-tomcat-6.0.18/webapps/docs/config/systemprops.html
apache-tomcat-6.0.18/webapps/docs/config/valve.html
apache-tomcat-6.0.18/webapps/docs/connectors.html
apache-tomcat-6.0.18/webapps/docs/default-servlet.html
apache-tomcat-6.0.18/webapps/docs/deployer-howto.html
apache-tomcat-6.0.18/webapps/docs/developers.html
apache-tomcat-6.0.18/webapps/docs/extras.html
apache-tomcat-6.0.18/webapps/docs/funcspecs/fs-admin-apps.html
apache-tomcat-6.0.18/webapps/docs/funcspecs/fs-admin-objects.html
apache-tomcat-6.0.18/webapps/docs/funcspecs/fs-admin-opers.html
apache-tomcat-6.0.18/webapps/docs/funcspecs/fs-default.html
apache-tomcat-6.0.18/webapps/docs/funcspecs/fs-invoker.html
apache-tomcat-6.0.18/webapps/docs/funcspecs/fs-jdbc-realm.html
apache-tomcat-6.0.18/webapps/docs/funcspecs/fs-jndi-realm.html
apache-tomcat-6.0.18/webapps/docs/funcspecs/fs-memory-realm.html
apache-tomcat-6.0.18/webapps/docs/funcspecs/index.html
apache-tomcat-6.0.18/webapps/docs/funcspecs/mbean-names.html
apache-tomcat-6.0.18/webapps/docs/funcspecs/printer/fs-admin-apps.html
apache-tomcat-6.0.18/webapps/docs/funcspecs/printer/fs-admin-objects.html
apache-tomcat-6.0.18/webapps/docs/funcspecs/printer/fs-admin-opers.html
apache-tomcat-6.0.18/webapps/docs/funcspecs/printer/fs-default.html
apache-tomcat-6.0.18/webapps/docs/funcspecs/printer/fs-invoker.html
apache-tomcat-6.0.18/webapps/docs/funcspecs/printer/fs-jdbc-realm.html
apache-tomcat-6.0.18/webapps/docs/funcspecs/printer/fs-jndi-realm.html
apache-tomcat-6.0.18/webapps/docs/funcspecs/printer/fs-memory-realm.html
apache-tomcat-6.0.18/webapps/docs/funcspecs/printer/index.html
apache-tomcat-6.0.18/webapps/docs/funcspecs/printer/mbean-names.html
apache-tomcat-6.0.18/webapps/docs/html-manager-howto.html
apache-tomcat-6.0.18/webapps/docs/images/add.gif
apache-tomcat-6.0.18/webapps/docs/images/asf-logo.gif
apache-tomcat-6.0.18/webapps/docs/images/code.gif
apache-tomcat-6.0.18/webapps/docs/images/design.gif
apache-tomcat-6.0.18/webapps/docs/images/docs.gif
apache-tomcat-6.0.18/webapps/docs/images/fix.gif
apache-tomcat-6.0.18/webapps/docs/images/printer.gif
apache-tomcat-6.0.18/webapps/docs/images/tomcat.gif
apache-tomcat-6.0.18/webapps/docs/images/tomcat.svg
apache-tomcat-6.0.18/webapps/docs/images/update.gif
apache-tomcat-6.0.18/webapps/docs/images/void.gif
apache-tomcat-6.0.18/webapps/docs/index.html
apache-tomcat-6.0.18/webapps/docs/introduction.html
apache-tomcat-6.0.18/webapps/docs/jasper-howto.html
apache-tomcat-6.0.18/webapps/docs/jndi-datasource-examples-howto.html
apache-tomcat-6.0.18/webapps/docs/jndi-resources-howto.html
apache-tomcat-6.0.18/webapps/docs/logging.html
apache-tomcat-6.0.18/webapps/docs/manager-howto.html
apache-tomcat-6.0.18/webapps/docs/maven-jars.html
apache-tomcat-6.0.18/webapps/docs/mbeans-descriptor-howto.html
apache-tomcat-6.0.18/webapps/docs/monitoring.html
apache-tomcat-6.0.18/webapps/docs/printer/BUILDING.txt
apache-tomcat-6.0.18/webapps/docs/printer/NOTICE
apache-tomcat-6.0.18/webapps/docs/printer/RUNNING.txt
apache-tomcat-6.0.18/webapps/docs/printer/aio.html
apache-tomcat-6.0.18/webapps/docs/printer/apr.html
apache-tomcat-6.0.18/webapps/docs/printer/balancer-howto.html
apache-tomcat-6.0.18/webapps/docs/printer/building.html
apache-tomcat-6.0.18/webapps/docs/printer/cgi-howto.html
apache-tomcat-6.0.18/webapps/docs/printer/changelog.html
apache-tomcat-6.0.18/webapps/docs/printer/class-loader-howto.html
apache-tomcat-6.0.18/webapps/docs/printer/cluster-howto.html
apache-tomcat-6.0.18/webapps/docs/printer/connectors.html
apache-tomcat-6.0.18/webapps/docs/printer/default-servlet.html
apache-tomcat-6.0.18/webapps/docs/printer/deployer-howto.html
apache-tomcat-6.0.18/webapps/docs/printer/developers.html
apache-tomcat-6.0.18/webapps/docs/printer/extras.html
apache-tomcat-6.0.18/webapps/docs/printer/html-manager-howto.html
apache-tomcat-6.0.18/webapps/docs/printer/index.html
apache-tomcat-6.0.18/webapps/docs/printer/introduction.html
apache-tomcat-6.0.18/webapps/docs/printer/jasper-howto.html
apache-tomcat-6.0.18/webapps/docs/printer/jndi-datasource-examples-howto.html
apache-tomcat-6.0.18/webapps/docs/printer/jndi-resources-howto.html
apache-tomcat-6.0.18/webapps/docs/printer/logging.html
apache-tomcat-6.0.18/webapps/docs/printer/manager-howto.html
apache-tomcat-6.0.18/webapps/docs/printer/maven-jars.html
apache-tomcat-6.0.18/webapps/docs/printer/mbeans-descriptor-howto.html
apache-tomcat-6.0.18/webapps/docs/printer/monitoring.html
apache-tomcat-6.0.18/webapps/docs/printer/proxy-howto.html
apache-tomcat-6.0.18/webapps/docs/printer/realm-howto.html
apache-tomcat-6.0.18/webapps/docs/printer/security-manager-howto.html
apache-tomcat-6.0.18/webapps/docs/printer/setup.html
apache-tomcat-6.0.18/webapps/docs/printer/ssi-howto.html
apache-tomcat-6.0.18/webapps/docs/printer/ssl-howto.html
apache-tomcat-6.0.18/webapps/docs/printer/virtual-hosting-howto.html
apache-tomcat-6.0.18/webapps/docs/printer/windows-service-howto.html
apache-tomcat-6.0.18/webapps/docs/proxy-howto.html
apache-tomcat-6.0.18/webapps/docs/realm-howto.html
apache-tomcat-6.0.18/webapps/docs/security-manager-howto.html
apache-tomcat-6.0.18/webapps/docs/setup.html
apache-tomcat-6.0.18/webapps/docs/ssi-howto.html
apache-tomcat-6.0.18/webapps/docs/ssl-howto.html
apache-tomcat-6.0.18/webapps/docs/tribes/faq.html
apache-tomcat-6.0.18/webapps/docs/tribes/introduction.html
apache-tomcat-6.0.18/webapps/docs/tribes/setup.html
apache-tomcat-6.0.18/webapps/docs/virtual-hosting-howto.html
apache-tomcat-6.0.18/webapps/docs/windows-service-howto.html
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/CookieExample.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/CookieExample.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/HelloWorldExample.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/HelloWorldExample.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/LocalStrings.properties
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/LocalStrings_en.properties
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/LocalStrings_es.properties
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/LocalStrings_fr.properties
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/LocalStrings_pt.properties
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/RequestHeaderExample.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/RequestHeaderExample.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/RequestInfoExample.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/RequestInfoExample.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/RequestParamExample.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/RequestParamExample.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/SessionExample.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/SessionExample.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/cal/Entries.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/cal/Entries.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/cal/Entry.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/cal/Entry.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/cal/JspCalendar.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/cal/JspCalendar.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/cal/TableBean.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/cal/TableBean.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/chat/ChatServlet$MessageSender.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/chat/ChatServlet.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/chat/ChatServlet.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/checkbox/CheckTest.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/checkbox/CheckTest.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/colors/ColorGameBean.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/colors/ColorGameBean.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/compressionFilters/CompressionFilter.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/compressionFilters/CompressionFilter.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/compressionFilters/CompressionFilterTestServlet.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/compressionFilters/CompressionFilterTestServlet.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/compressionFilters/CompressionResponseStream.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/compressionFilters/CompressionResponseStream.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/compressionFilters/CompressionServletResponseWrapper.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/compressionFilters/CompressionServletResponseWrapper.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/dates/JspCalendar.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/dates/JspCalendar.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/error/Smart.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/error/Smart.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/examples/ExampleTagBase.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/examples/ExampleTagBase.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/examples/FooTag.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/examples/FooTag.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/examples/FooTagExtraInfo.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/examples/FooTagExtraInfo.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/examples/LogTag.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/examples/LogTag.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/examples/ShowSource.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/examples/ShowSource.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/filters/ExampleFilter.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/filters/ExampleFilter.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/filters/RequestDumperFilter.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/filters/RequestDumperFilter.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/filters/SetCharacterEncodingFilter.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/filters/SetCharacterEncodingFilter.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/jsp2/examples/BookBean.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/jsp2/examples/BookBean.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/jsp2/examples/FooBean.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/jsp2/examples/FooBean.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/jsp2/examples/el/Functions.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/jsp2/examples/el/Functions.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/EchoAttributesTag.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/EchoAttributesTag.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/FindBookSimpleTag.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/FindBookSimpleTag.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/HelloWorldSimpleTag.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/HelloWorldSimpleTag.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/RepeatSimpleTag.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/RepeatSimpleTag.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/ShuffleSimpleTag.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/ShuffleSimpleTag.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/TileSimpleTag.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/TileSimpleTag.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/listeners/ContextListener.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/listeners/ContextListener.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/listeners/SessionListener.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/listeners/SessionListener.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/num/NumberGuessBean.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/num/NumberGuessBean.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/servletToJsp.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/servletToJsp.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/sessions/DummyCart.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/sessions/DummyCart.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/util/HTMLFilter.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/util/HTMLFilter.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/validators/DebugValidator.class
apache-tomcat-6.0.18/webapps/examples/WEB-INF/classes/validators/DebugValidator.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/jsp/applet/Clock2.java
apache-tomcat-6.0.18/webapps/examples/WEB-INF/jsp/debug-taglib.tld
apache-tomcat-6.0.18/webapps/examples/WEB-INF/jsp/example-taglib.tld
apache-tomcat-6.0.18/webapps/examples/WEB-INF/jsp2/jsp2-example-taglib.tld
apache-tomcat-6.0.18/webapps/examples/WEB-INF/lib/jstl.jar
apache-tomcat-6.0.18/webapps/examples/WEB-INF/lib/standard.jar
apache-tomcat-6.0.18/webapps/examples/WEB-INF/tags/displayProducts.tag
apache-tomcat-6.0.18/webapps/examples/WEB-INF/tags/helloWorld.tag
apache-tomcat-6.0.18/webapps/examples/WEB-INF/tags/panel.tag
apache-tomcat-6.0.18/webapps/examples/WEB-INF/tags/xhtmlbasic.tag
apache-tomcat-6.0.18/webapps/examples/WEB-INF/web.xml
apache-tomcat-6.0.18/webapps/examples/index.html
apache-tomcat-6.0.18/webapps/examples/jsp/cal/Entries.java.html
apache-tomcat-6.0.18/webapps/examples/jsp/cal/Entry.java.html
apache-tomcat-6.0.18/webapps/examples/jsp/cal/JspCalendar.java.html
apache-tomcat-6.0.18/webapps/examples/jsp/cal/TableBean.java.html
apache-tomcat-6.0.18/webapps/examples/jsp/cal/cal1.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/cal/cal1.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/cal/cal2.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/cal/cal2.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/cal/calendar.html
apache-tomcat-6.0.18/webapps/examples/jsp/cal/login.html
apache-tomcat-6.0.18/webapps/examples/jsp/chat/chat.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/chat/chat.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/chat/login.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/chat/login.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/chat/post.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/chat/post.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/checkbox/CheckTest.html
apache-tomcat-6.0.18/webapps/examples/jsp/checkbox/check.html
apache-tomcat-6.0.18/webapps/examples/jsp/checkbox/checkresult.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/checkbox/checkresult.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/checkbox/cresult.html
apache-tomcat-6.0.18/webapps/examples/jsp/colors/ColorGameBean.html
apache-tomcat-6.0.18/webapps/examples/jsp/colors/clr.html
apache-tomcat-6.0.18/webapps/examples/jsp/colors/colors.html
apache-tomcat-6.0.18/webapps/examples/jsp/colors/colrs.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/colors/colrs.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/dates/date.html
apache-tomcat-6.0.18/webapps/examples/jsp/dates/date.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/dates/date.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/error/er.html
apache-tomcat-6.0.18/webapps/examples/jsp/error/err.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/error/err.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/error/error.html
apache-tomcat-6.0.18/webapps/examples/jsp/error/errorpge.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/error/errorpge.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/forward/forward.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/forward/forward.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/forward/fwd.html
apache-tomcat-6.0.18/webapps/examples/jsp/forward/one.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/forward/one.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/forward/two.html
apache-tomcat-6.0.18/webapps/examples/jsp/images/code.gif
apache-tomcat-6.0.18/webapps/examples/jsp/images/execute.gif
apache-tomcat-6.0.18/webapps/examples/jsp/images/read.gif
apache-tomcat-6.0.18/webapps/examples/jsp/images/return.gif
apache-tomcat-6.0.18/webapps/examples/jsp/include/foo.html
apache-tomcat-6.0.18/webapps/examples/jsp/include/foo.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/include/foo.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/include/inc.html
apache-tomcat-6.0.18/webapps/examples/jsp/include/include.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/include/include.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/index.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/el/Functions.java.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/el/basic-arithmetic.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/el/basic-arithmetic.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/el/basic-arithmetic.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/el/basic-comparisons.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/el/basic-comparisons.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/el/basic-comparisons.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/el/functions.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/el/functions.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/el/functions.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/el/implicit-objects.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/el/implicit-objects.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/el/implicit-objects.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/jspattribute/FooBean.java.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/jspattribute/HelloWorldSimpleTag.java.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/jspattribute/ShuffleSimpleTag.java.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/jspattribute/TileSimpleTag.java.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/jspattribute/jspattribute.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/jspattribute/jspattribute.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/jspattribute/jspattribute.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/jspattribute/shuffle.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/jspattribute/shuffle.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/jspattribute/shuffle.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/jspx/basic.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/jspx/basic.jspx
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/jspx/basic.jspx.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/jspx/svgexample.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/jspx/textRotate.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/jspx/textRotate.jpg
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/jspx/textRotate.jspx
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/jspx/textRotate.jspx.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/misc/EchoAttributesTag.java.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/misc/coda.jspf
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/misc/coda.jspf.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/misc/config.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/misc/config.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/misc/config.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/misc/dynamicattrs.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/misc/dynamicattrs.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/misc/dynamicattrs.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/misc/prelude.jspf
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/misc/prelude.jspf.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/simpletag/BookBean.java.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/simpletag/FindBookSimpleTag.java.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/simpletag/Functions.java.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/simpletag/HelloWorldSimpleTag.java.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/simpletag/RepeatSimpleTag.java.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/simpletag/book.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/simpletag/book.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/simpletag/book.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/simpletag/hello.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/simpletag/hello.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/simpletag/hello.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/simpletag/repeat.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/simpletag/repeat.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/simpletag/repeat.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/tagfiles/displayProducts.tag.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/tagfiles/hello.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/tagfiles/hello.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/tagfiles/hello.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/tagfiles/helloWorld.tag.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/tagfiles/panel.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/tagfiles/panel.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/tagfiles/panel.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/tagfiles/panel.tag.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/tagfiles/products.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/tagfiles/products.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/tagfiles/products.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsp2/tagfiles/xhtmlbasic.tag.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsptoserv/hello.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/jsptoserv/hello.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsptoserv/jsptoservlet.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/jsptoserv/jsptoservlet.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsptoserv/jts.html
apache-tomcat-6.0.18/webapps/examples/jsp/jsptoserv/servletToJsp.java.html
apache-tomcat-6.0.18/webapps/examples/jsp/num/numguess.html
apache-tomcat-6.0.18/webapps/examples/jsp/num/numguess.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/num/numguess.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/plugin/applet/Clock2.class
apache-tomcat-6.0.18/webapps/examples/jsp/plugin/applet/Clock2.java
apache-tomcat-6.0.18/webapps/examples/jsp/plugin/plugin.html
apache-tomcat-6.0.18/webapps/examples/jsp/plugin/plugin.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/plugin/plugin.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/security/protected/error.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/security/protected/error.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/security/protected/index.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/security/protected/index.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/security/protected/login.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/security/protected/login.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/sessions/DummyCart.html
apache-tomcat-6.0.18/webapps/examples/jsp/sessions/carts.html
apache-tomcat-6.0.18/webapps/examples/jsp/sessions/carts.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/sessions/carts.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/sessions/crt.html
apache-tomcat-6.0.18/webapps/examples/jsp/simpletag/foo.html
apache-tomcat-6.0.18/webapps/examples/jsp/simpletag/foo.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/simpletag/foo.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/snp/snoop.html
apache-tomcat-6.0.18/webapps/examples/jsp/snp/snoop.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/snp/snoop.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/source.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/source.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/tagplugin/choose.html
apache-tomcat-6.0.18/webapps/examples/jsp/tagplugin/choose.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/tagplugin/choose.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/tagplugin/foreach.html
apache-tomcat-6.0.18/webapps/examples/jsp/tagplugin/foreach.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/tagplugin/foreach.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/tagplugin/howto.html
apache-tomcat-6.0.18/webapps/examples/jsp/tagplugin/if.html
apache-tomcat-6.0.18/webapps/examples/jsp/tagplugin/if.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/tagplugin/if.jsp.html
apache-tomcat-6.0.18/webapps/examples/jsp/tagplugin/notes.html
apache-tomcat-6.0.18/webapps/examples/jsp/xml/xml.html
apache-tomcat-6.0.18/webapps/examples/jsp/xml/xml.jsp
apache-tomcat-6.0.18/webapps/examples/jsp/xml/xml.jsp.html
apache-tomcat-6.0.18/webapps/examples/servlets/cookies.html
apache-tomcat-6.0.18/webapps/examples/servlets/helloworld.html
apache-tomcat-6.0.18/webapps/examples/servlets/images/code.gif
apache-tomcat-6.0.18/webapps/examples/servlets/images/execute.gif
apache-tomcat-6.0.18/webapps/examples/servlets/images/return.gif
apache-tomcat-6.0.18/webapps/examples/servlets/index.html
apache-tomcat-6.0.18/webapps/examples/servlets/reqheaders.html
apache-tomcat-6.0.18/webapps/examples/servlets/reqinfo.html
apache-tomcat-6.0.18/webapps/examples/servlets/reqparams.html
apache-tomcat-6.0.18/webapps/examples/servlets/sessions.html
apache-tomcat-6.0.18/webapps/host-manager/META-INF/context.xml
apache-tomcat-6.0.18/webapps/host-manager/WEB-INF/web.xml
apache-tomcat-6.0.18/webapps/host-manager/images/add.gif
apache-tomcat-6.0.18/webapps/host-manager/images/asf-logo.gif
apache-tomcat-6.0.18/webapps/host-manager/images/code.gif
apache-tomcat-6.0.18/webapps/host-manager/images/design.gif
apache-tomcat-6.0.18/webapps/host-manager/images/docs.gif
apache-tomcat-6.0.18/webapps/host-manager/images/fix.gif
apache-tomcat-6.0.18/webapps/host-manager/images/tomcat.gif
apache-tomcat-6.0.18/webapps/host-manager/images/update.gif
apache-tomcat-6.0.18/webapps/host-manager/images/void.gif
apache-tomcat-6.0.18/webapps/host-manager/manager.xml
apache-tomcat-6.0.18/webapps/manager/401.jsp
apache-tomcat-6.0.18/webapps/manager/META-INF/context.xml
apache-tomcat-6.0.18/webapps/manager/WEB-INF/web.xml
apache-tomcat-6.0.18/webapps/manager/images/add.gif
apache-tomcat-6.0.18/webapps/manager/images/asf-logo.gif
apache-tomcat-6.0.18/webapps/manager/images/code.gif
apache-tomcat-6.0.18/webapps/manager/images/design.gif
apache-tomcat-6.0.18/webapps/manager/images/docs.gif
apache-tomcat-6.0.18/webapps/manager/images/fix.gif
apache-tomcat-6.0.18/webapps/manager/images/tomcat.gif
apache-tomcat-6.0.18/webapps/manager/images/update.gif
apache-tomcat-6.0.18/webapps/manager/images/void.gif
apache-tomcat-6.0.18/webapps/manager/sessionDetail.jsp
apache-tomcat-6.0.18/webapps/manager/sessionsList.jsp
apache-tomcat-6.0.18/webapps/manager/status.xsd
apache-tomcat-6.0.18/webapps/manager/xform.xsl
所以安裝完後的路徑為 /opt/pache-tomcat-6.0.18,緊接著我們將 Tomcat 的目錄搬到 /opt/tomcat 去:
[root@KHXPROVS1 opt]# mv /opt/apache-tomcat-6.0.18 /opt/tomcat
[root@KHXPROVS1 opt]# ls -al
total 292800
drwxr-xr-x 6 root root 4096 Sep 8 16:14 .
drwxr-xr-x 25 root root 4096 Sep 4 10:43 ..
-rw-r--r-- 1 root root 6142197 Sep 3 19:04 apache-tomcat-6.0.18.tar.gz
drwxrwxrwx 8 501 501 4096 Jul 1 14:36 iperf-2.0.4
-rw-r--r-- 1 root root 248493 Jul 1 14:35 iperf-2.0.4.tar.gz
-rw-r--r-- 1 root root 61764 Sep 4 11:09 java-1.6.0-sun-compat-1.6.0.07-1jpp.i586.rpm
-rw-r--r-- 1 root root 65414959 Jun 10 18:38 jdk-6u7-linux-i586.rpm
-rwxr-xr-x 1 root root 74397909 Sep 4 09:37 jdk-6u7-linux-i586-rpm.bin
-rw-r--r-- 1 root root 19463427 Jun 10 18:36 jre-6u7-linux-i586.rpm
-rwxr-xr-x 1 root root 19216086 Sep 4 10:31 jre-6u7-linux-i586-rpm.bin
drwx------ 2 root root 16384 Jun 25 22:22 lost+found
drwxr-xr-x 3 root root 4096 Sep 4 09:40 sun
-rw-r--r-- 1 root root 463678 Aug 20 2007 sun-javadb-client-10.3.1-4.1.i386.rpm
-rw-r--r-- 1 root root 62801 Aug 20 2007 sun-javadb-common-10.3.1-4.1.i386.rpm
-rw-r--r-- 1 root root 3655834 Aug 20 2007 sun-javadb-core-10.3.1-4.1.i386.rpm
-rw-r--r-- 1 root root 996942 Aug 20 2007 sun-javadb-demo-10.3.1-4.1.i386.rpm
-rw-r--r-- 1 root root 4290799 Aug 20 2007 sun-javadb-docs-10.3.1-4.1.i386.rpm
-rw-r--r-- 1 root root 123721 Aug 20 2007 sun-javadb-javadoc-10.3.1-4.1.i386.rpm
drwxr-xr-x 9 root root 4096 Sep 4 11:24 tomcat
好了,安裝很簡單吧,接著要更改一下 Tomcat 的環境設定,主要是將下列兩行加進去:export JAVA_HOME=/usr/java/jdk1.6.0_07
export TOMCAT_HOME=/opt/tomcat
[root@KHXPROVS1 opt]# vi /etc/profile
# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}

# Path manipulation
if [ `id -u` = 0 ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi

pathmunge /usr/X11R6/bin after


# No core files by default
ulimit -S -c 0 > /dev/null 2>&1

USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"

HOSTNAME=`/bin/hostname`
HISTSIZE=1000

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC

for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done

unset i
unset pathmunge

########## for TOMCAT env. setup ######################
export JAVA_HOME=/usr/java/jdk1.6.0_07
export TOMCAT_HOME=/opt/tomcat
export CATALINA_BASE=/opt/tomcat
export CATALINA_HOME=/opt/tomcat
export CLASSPATH=./:${JAVA_HOME}/lib:${JAVA_HOME}/jre/lib/ext:${CATALINA_HOME}/common/lib
export PATH=${JAVA_HOME}/bin:${CATALINA_HOME}/bin:${PATH}
"/etc/profile" 53L, 983C written
直接讓目前的設定值生效:
[root@KHXPROVS1 opt]# source /etc/profile
設定環境變數,一樣的直接去修改 .bashrc 文件吧:
[root@KHXPROVS1 opt]# vi ~/.bashrc
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias vi='vim'

TERM=xterm-color; export TERM;

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

export JAVA_HOME=/usr/java/jdk1.6.0_07
export CATALINA_BASE=/opt/tomcat
export CATALINA_HOME=/opt/tomcat
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export TOMCAT_HOME=/opt/tomcat
"~/.bashrc" 22L, 459C
存檔然後離開這個 shell 再進來一次:
[root@KHXPROVS1 opt]# exit
logout
設定到這裡已經差不多囉,接著我們就來測試一下吧:
首先來啟動 Tomcat 服務試試看:
[root@KHXPROVS1 opt]# /opt/tomcat/bin/startup.sh
Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /usr/java/jdk1.6.0_07
[root@KHXPROVS1 ~]# ps -aef|grep tomcat
root 14377 1 23 16:49 pts/4 00:00:02 /usr/java/jdk1.6.0_07/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties -Djava.endorsed.dirs=/opt/tomcat/endorsed -classpath :/opt/tomcat/bin/bootstrap.jar -Dcatalina.base=/opt/tomcat -Dcatalina.home=/opt/tomcat -Djava.io.tmpdir=/opt/tomcat/temp org.apache.catalina.startup.Bootstrap start
root 14403 14302 0 16:49 pts/4 00:00:00 grep tomcat
[root@KHXPROVS1 ~]#
最後在瀏覽器中輸入 http://localhost:8080/ 便可看到 Tomcat 的 log 了, 到此安裝告一段落。

另外再測試一下關掉 Tomcat 吧:
[root@KHXPROVS1 opt]# /opt/tomcat/bin/shutdown.sh
Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /usr/java/jdk1.6.0_07
[root@KHXPROVS1 opt]#
(詳全文...)