JDK 1.6
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Apache Ant
http://ftp.twaren.net/Unix/Web/apache//ant/binaries/apache-ant-1.8.1-bin.tar.gz
Apache Tomcat
http://apache.stu.edu.tw//tomcat/tomcat-6/v6.0.29/bin/apache-tomcat-6.0.29.tar.gz
== Install 安裝 ==
安裝SDK
cd /opt mkdir java cd java sh jdk-6u22-linux-i586.bin
解壓縮Ant, Tomcat
tar -zxv -f apache-ant-1.8.1-bin.tar.gz -C /opt/ tar -zxv -f apache-tomcat-6.0.29.tar.gz -C /opt/ ln -s /opt/apache-ant-1.8.1/bin/ant /usr/bin
複製serlet-api.jar給ant
cp /opt/apache-tomcat-6.0.29/lib/servlet-api.jar /opt/apache-ant-1.8.1/lib
設定環境變數
export ANT_HOME=/opt/apache-ant-1.8.1/ export JAVA_HOME=/opt/java/jdk1.6.0_22/ export PATH=${PATH}:${ANT_HOME}/bin
啟動Tomcat
cd /opt/apache-tomcat-6.0.29/bin ./startup.sh
檢查Server Log
less /opt/apache-tomcat-6.0.29/logs/catalina.out
== Automate startup 自動啟動Tomcat ==
cd /etc/init.d vim tomcat
#!/bin/bash # chkconfig: 234 20 80 # description: Tomcat Server start/shutdown script # processname: tomcat JAVA_HOME=/opt/java/jdk1.6.0_22 export JAVA_HOME TOMCAT_HOME=/opt/apache-tomcat-6.0.29/bin START_TOMCAT=/opt/apache-tomcat-6.0.29/bin/startup.sh STOP_TOMCAT=/opt/apache-tomcat-6.0.29/bin/shutdown.sh start() { echo "Starting tomcat: " cd $TOMCAT_HOME ${START_TOMCAT} echo "Tomcat start done." } stop() { echo "Shutting down tomcat: " cd $TOMCAT_HOME ${STOP_TOMCAT} echo "Tomcat shutdown done." } case "$1" in start) start ;; stop) stop ;; restart) stop sleep 10 start ;; *) echo "Usage: $0 {start|stop|restart}" esac exit 0
chmod 755 tomcat /sbin/chkconfig --add tomcat /sbin/chkconfig --level 234 tomcat on /sbin/chkconfig --list tomcat