安裝Tomcat7

  1. 安裝jdk
    至http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html下載 (此處以jdk-7u10-linux-x64.rpm為例)

rpm -ivh jdk-7u10-linux-x64.rpm

設定jdk環境

cat << EOF > /etc/profile.d/java.sh

export JAVA_HOME=/usr/java/default
export PATH=$JAVA_HOME/bin:$PATH
EOF

cat << EOF > /etc/profile.d/java.csh

set JAVA_HOME=/usr/java/default
set PATH=$JAVA_HOME/bin:$PATH
EOF

. /etc/profile.d/java.sh

  1. 安裝tomcat7
    至http://tomcat.apache.org/download-70.cgi下載 (此處以apache-tomcat-7.0.40.tar.gz為例)

wget http://ftp.twaren.net/Unix/Web/apache/tomcat/tomcat-7/v7.0.40/bin/apache-tomcat-7.0.40.tar.gz

tar zxvf apache-tomcat-7.0.40.tar.gz

mkdir /usr/data

mv apache-tomcat-7.0.40 /usr/data/

vim /etc/init.d/tomcat

#!/bin/bash

description: Tomcat start stop restart

processname: tomcat

chkconfig: 234 20 80

CATALINA_HOME=/usr/data/apache-tomcat-7.0.40
case $1 in
start)
bash $CATALINA_HOME/bin/startup.sh
;;
stop)
bash $CATALINA_HOME/bin/shutdown.sh
;;
restart)
bash $CATALINA_HOME/bin/shutdown.sh
bash $CATALINA_HOME/bin/startup.sh
;;
esac
exit 0

chkconfig –add tomcat

service tomcat start

This entry was posted in JSP. Bookmark the permalink.