http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
tar zvxf jdk-7u60-linux-x64.tar.gz
mv jdk1.7.0_60/ /usr/local/jdk1.7.0_60/
配置环境变量
vi /etc/profile
export JAVA_HOME=/usr/local/jdk1.7.0_60/
export CATALINA_BASE=/usr/local/tomcat
export CATALINA_HOME=/usr/local/tomcat
export CATALINA_2_BASE=/usr/local/tomcat_2
export CATALINA_2_HOME=/usr/local/tomcat_2
export CLASSPATH=$JAVA_HOME/lib
source /etc/profile //让环境变量生效
2.安装tomcat:
wget http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.11/bin/apache-tomcat-7.0.11.tar.gz
tar zxf apache-tomcat-7.0.11.tar.gz
mv apache-tomcat-7.0.11 /usr/local/tomcat
mkdir -p /data/htdocs/www
cp -rf /usr/local/tomcat/webapps/* /data/htdocs/www/
3.安装多个tomcat (需要修改tomcat配置)
vi /etc/profile
export JAVA_HOME=/usr/local/jdk
export PATH=$CATALINA_HOME/bin:$JAVA_HOME/bin:$PATH
export CLASSPATH=$JAVA_HOME/lib
修改 tomcat/bin/catalina.sh
增加
export JAVA_HOME=$JAVA_HOME
export CLASSPATH=$JAVA_HOME/lib
export CATALINA_BASE=$CATALINA_2_BASE (引用上面配置的环境变量)
export CATALINA_HOME=$CATALINA_2_HOME
export PATH=$CATALINA_HOME/bin:$JAVA_HOME/bin:$PATH
每个tomcat文件都需要配置 一一对应
然后修改
tomcat/conf/server.xml
把里面的端口换成 不要跟其他tomcat重复
比如 tomcat-1 8080 tomcat-2 8082等... 共需要修改4处端口
之后依次启动tomcat进行测试,