cd /opt
rpm -qpl jdk-8u201-linux-x64.rpm
rpm -ivh jdk-8u201-linux-x64.rpm
java -version
3、设置JDK环境变量
vim /etc/profile.d/java.sh
exportJAVA_HOME=/usr/java/jdk1.8.0_201-amd64
exportCLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
exportPATH=$JAVA_HOME/bin:$PATHsource /etc/profile.d/java.sh
java -version
4、安装 tomcat
cd /opt
tar zxvf apache-tomcat-9.0.16.tar.gz
mkdir /usr/local/tomcat
mv apache-tomcat-9.0.16 /usr/local/tomcat/tomcat1
cp -a /usr/local/tomcat/tomcat1 /usr/local/tomcat/tomcat2
5、配置 tomcat 环境变量
vim /etc/profile.d/tomcat.sh
#tomcat1exportCATALINA_HOME1=/usr/local/tomcat/tomcat1
exportCATALINA_BASE1=/usr/local/tomcat/tomcat1
exportTOMCAT_HOME1=/usr/local/tomcat/tomcat1
#tomcat2exportCATALINA_HOME2=/usr/local/tomcat/tomcat2
exportCATALINA_BASE2=/usr/local/tomcat/tomcat2
exportTOMCAT_HOME2=/usr/local/tomcat/tomcat2
source /etc/profile.d/tomcat.sh
vim /usr/local/tomcat/tomcat1/bin/startup.sh
# -----------------------------------------------------------------------------# Start Script for the CATALINA Server# -----------------------------------------------------------------------------##添加以下内容exportCATALINA_BASE=$CATALINA_BASE1exportCATALINA_HOME=$CATALINA_HOME1exportTOMCAT_HOME=$TOMCAT_HOME1vim /usr/local/tomcat/tomcat1/bin/shutdown.sh
# -----------------------------------------------------------------------------# Stop script for the CATALINA Server# -----------------------------------------------------------------------------exportCATALINA_BASE=$CATALINA_BASE1exportCATALINA_HOME=$CATALINA_HOME1exportTOMCAT_HOME=$TOMCAT_HOME1vim /usr/local/tomcat/tomcat2/bin/startup.sh
# -----------------------------------------------------------------------------# Start Script for the CATALINA Server# -----------------------------------------------------------------------------exportCATALINA_BASE=$CATALINA_BASE2exportCATALINA_HOME=$CATALINA_HOME2exportTOMCAT_HOME=$TOMCAT_HOME2vim /usr/local/tomcat/tomcat2/bin/shutdown.sh
# -----------------------------------------------------------------------------# Stop script for the CATALINA Server# -----------------------------------------------------------------------------exportCATALINA_BASE=$CATALINA_BASE2exportCATALINA_HOME=$CATALINA_HOME2exportTOMCAT_HOME=$TOMCAT_HOME2