- 复制三个tomcat压缩包分别解压到三个文件夹下
- 配置profile
vim /etc/profile
- 加入如下代码
##########8081 tomcat###########
CATALINA_BASE=/usr/java/apache-tomcat-9.0.13
CATALINA_HOME=/usr/java/apache-tomcat-9.0.13
TOMCAT_HOME=/usr/java/apache-tomcat-9.0.13
export CATALINA_BASE CATALINA_HOME TOMCAT_HOME
##########first tomcat############
##########8082 tomcat##########
CATALINA_2_BASE=/usr/java/apache-tomcat-9.0.13_2
CATALINA_2_HOME=/usr/java/apache-tomcat-9.0.13_2
TOMCAT_2_HOME=/usr/java/apache-tomcat-9.0.13_2
export CATALINA_2_BASE CATALINA_2_HOME TOMCAT_2_HOME
##########second tomcat#########
##########8083 tomcat##########
CATALINA_3_BASE=/usr/java/apache-tomcat-9.0.13_3
CATALINA_3_HOME=/usr/java/apache-tomcat-9.0.13_3
TOMCAT_3_HOME=/usr/java/apache-tomcat-9.0.13_3
export CATALINA_3_BASE CATALINA_3_HOME TOMCAT_3_HOME
##########third tomcat##########
##########8080 tomcat##########
CATALINA_0_BASE=/usr/java/apache-tomcat-9.0.0.M26
CATALINA_0_HOME=/usr/java/apache-tomcat-9.0.0.M26
TOMCAT_0_HOME=/usr/java/apache-tomcat-9.0.0.M26
export CATALINA_0_BASE CATALINA_0_HOME TOMCAT_0_HOME
##########8080 tomcat##########
- 保存退出、使生效(必须)
:wq
# 生效
source /etc/profile
- 配置catalina.sh (apache-tomcat-9.0.13_2)
vim usr/java/apache-tomcat-9.0.13_2/bin/catalina.sh
vim usr/java/apache-tomcat-9.0.13_3/bin/catalina.sh
- 在代码
# OS specific support. $var _must_ be set to either true or false.
下面增加如下代码
export CATALINA_BASE=$CATALINA_2_BASE
export CATALINA_HOME=$CATALINA_2_HOME
- 配置catalina.sh (apache-tomcat-9.0.13_3)
vim usr/java/apache-tomcat-9.0.13_3/bin/catalina.sh
- 在代码
# OS specific support. $var _must_ be set to either true or false.
下面增加如下代码
export CATALINA_BASE=$CATALINA_3_BASE
export CATALINA_HOME=$CATALINA_3_HOME
只配置(apache-tomcat-9.0.13_2)和(apache-tomcat-9.0.13_3)相关,(apache-tomcat-9.0.13)保持不变
- 进入tomcat配置文件server.xml
cd /usr/java/apache-tomcat-9.0.13_3/conf
- 编辑server.xml
vim server.xml
- 修改三个地方即可
<Server port="8008" shutdown="SHUTDOWN">
<Connector port="8083" protocol="HTTP/1.1"
<Connector port="8011" protocol="AJP/1.3" redirectPort="8443" />
apache-tomcat-9.0.13_2同理配置即可
- 分别进入tomcat的bin目录后台启动
./startup.sh | tail -f ../logs/catalina.out &
记得tail查看日志(养成良好的习惯),控制台正常无报错。
apache-tomcat-9.0.13:8081端口号
apache-tomcat-9.0.13_2:8082端口号
apache-tomcat-9.0.13_3:8083端口号