yum install -y --downloaddir=./root java
mkdir /server && cd /server
http://mirror.bit.edu.cn/apache/tomcat/ 找现在的版本
wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-9/v9.0.31/bin/apache-tomcat-9.0.31.tar.gz
tar -xf apache-tomcat-9.0.31.tar.gz
cd apache-tomcat-9.0.31
mkdir /server &&mv /server/tomcat
mkdir /server/tomcat/instance{1..3}
cp -r /server/tomcat/{conf,logs,temp,work} /server/tomcat/instance1/
cp -r /server/tomcat/{conf,logs,temp,work} /server/tomcat/instance2/
cp -r /server/tomcat/{conf,logs,temp,work} /server/tomcat/instance3/
vim /server/tomcat/instance1/conf/server.xml
中三个站点里面改下面数据
Connector port="8081/8082/8083" protocol="HTTP/1.1
Server port="8091/8092/8093" shutdown="SHUTDOWN"
appBase="/webapps"
------------------------------------
#!/bin/bash
#instance1
. /etc/init.d/functions
export CATALINA_BASE="/server/tomcat/instance1/2/3"
case "$1" in
start)
$CATALINA_HOME/bin/startup.sh
;;
stop)
$CATALINA_HOME/bin/shutdown.sh
;;
restart)
$CATALINA_HOME/bin/shutdown.sh
sleep 5
$CATALINA_HOME/bin/startup.sh
;;
esac
export JAVA_OPTS='-Xms64m -Xmx128m'
------------------------------------------------------
chmod +x /usr/local/tomcat/instance1【2】【3】/ins1【2】【3】.sh
cp -r /usr/local/tomcat/webapps/ROOT/ /webapps/
/usr/local/tomcat/instance1[2][3]/ins1[2][3].sh start/stop/restart
netstat -lntup|egrep '8081|8082|8083|8091|8092|8093'
http://ip:8081/[2]/[3]