Step 1: Install JDK 1.6 reference download
mkdir /usr/java cd /usr/java cd /home/admin/ download jdk-6u45-linux-x64-rpm.bin chmod a+x jdk-6u45-linux-x64-rpm.bin ./jdk-6u45-linux-x64-rpm.bin cp ~/jdk-6u45-linux-amd64.rpm ./usr/lib/java-1.6.0 chmod a+x jdk-6u45-linux-amd64.rpm sudo rpm -ivh jdk-6u45-linux-amd64.rpm設定給使用者設定環境變數
vi ~/.bash_profile設定給每個使用者設定環境變數
vi /etc/profile內容
JAVA_HOME=/usr/java/jdk1.6.0_45 export JAVA_HOME PATH=$JAVA_HOME/bin:$PATH export PATH
echo $JAVA_HOMEStep 2:Download and Unpack Tomcat Download Tomcat 5.5.26
cd /usr/share tar -xzf apache-tomcat-5.5.26.tar.gz設定CATALINA_HOME
vi /etc/profile.d/script.shStep 3: Configure Tomcat to Run as a Service. 在 /etc/init.d新增tomcat檔案
cd /etc/init.d vi tomcat內容
#!/bin/bash # description: Tomcat Start Stop Restart # processname: tomcat # chkconfig: 234 20 80 JAVA_HOME=/usr/java/jdk1.6.0_45 export JAVA_HOME PATH=$JAVA_HOME/bin:$PATH export PATH CATALINA_HOME=/usr/share/tomcat case $1 in start) sh $CATALINA_HOME/bin/startup.sh ;; stop) sh $CATALINA_HOME/bin/shutdown.sh ;; restart) sh $CATALINA_HOME/bin/shutdown.sh sh $CATALINA_HOME/bin/startup.sh ;; esac exit 0修改權限
chmod 755 /etc/init.d/tomcat檢查
chkconfig --add tomcat chkconfig --level 234 tomcat on chkconfig --list tomcat啟動/停止/重啟
service tomcat start service tomcat stop service tomcat restartreference:參考
沒有留言:
張貼留言