在這以前咱們已經將jdk環境配置好,那麼接下來咱們須要將tomcat給解壓了,須要unzip命令,若是你係統沒有就java
yum -y install zip unzip
    而後 unzip apache-tomcat-6.0.30.zip就ok了apache
    接下來建立目錄,我這裏有/usr/tomcat1,/usr/tomcat2,/usr/tomcat2而後將解壓後的tomcat向每一個目錄拷貝一份瀏覽器
    修改/etc/profile文件tomcat
  這裏是以前你配置的jdk的環境spa
export JAVA_HOME=/usr/jdk1.6.0_26 exportCLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar PATH=$PATH:$JAVA_HOME/bin
   我這裏有三個tomcat因此code
CATALINA_BASE=/usr/tomcat1/apache-tomcat-6.0.30 CATALINA_HOME=/usr/tomcat1/apache-tomcat-6.0.30 export CATALINA_BASE CATALINA_HOME CATALINA_2_BASE=/usr/tomcat2/apache-tomcat-6.0.30 CATALINA_2_HOME=/usr/tomcat2/apache-tomcat-6.0.30 export CATALINA_2_BASE CATALINA_2_HOME CATALINA_3_BASE=/usr/tomcat3/apache-tomcat-6.0.30 CATALINA_3_HOME=/usr/tomcat3/apache-tomcat-6.0.30 export CATALINA_3_BASE CATALINA_3_HOME TOMCAT_HOME=/usr/tomcat1/apache-tomcat-6.0.30 export TOMCAT_HOME TOMCAT_2_HOME=/usr/tomcat2/apache-tomcat-6.0.30 export TOMCAT_2_HOME TOMCAT_3_HOME=/usr/tomcat3/apache-tomcat-6.0.30 export TOMCAT_3_HOME export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
這樣固然仍是不行的,還須要繼續改配置  /usr/tomcat2/apache-tomcat-6.0.30/bin/startup.shserver
# Better OS/400 detection: see Bugzilla 31132 os400=false darwin=false case "`uname`" in CYGWIN*) cygwin=true;; OS400*) os400=true;; Darwin*) darwin=true;; esac export JAVA_HOME=/usr/jdk1.6.0_26 export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar export PATH=$PATH:$JAVA_HOME/bin export CATALINA_HOME=$CATALINA_2_HOME export CATALINA_BASE=$CATALINA_2_BASE
#上面是須要加入的代碼
xml
# resolve links - $0 may be a softlink
PRG="$0"ip
tomcat1不用改,tomcat3中的按以上配置修改。io
這樣固然仍是不行的,還須要繼續改配置  /usr/tomcat2/apache-tomcat-6.0.30/bin/shutdown.sh
每一個tomcat的對應的shutdown.sh還須要按照步驟三那樣,將環境加入,不然再咱們關閉tomcat2的時候,會影響其餘的tomcat
    修改tomcat/conf/server.xml中的三處端口
<Server port="9005" shutdown="SHUTDOWN"> 端口:8005->9005 <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 --> <Connector port="9080" maxHttpHeaderSize="8192" 端口:8080->9080 maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" /> <!-- Define an AJP 1.3 Connector on port 8009 --> <Connector port="9009" 端口:8009->9009 enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
而後啓動tomcat到瀏覽器中訪問不一樣的端口,就能夠看到tomcat貓了,那麼到了這裏就說明你安裝成功了