官方下载地址:https://tomcat.apache.org/download-80.cgi
新建tomcat文件夹
mkdir -p /usr/local/tomcat
上传安装包到上面文件夹下
解压
tar -zxvf apache-tomcat-8.5.34.tar.gz
加入环境变量配置
vi /etc/profile
注意:CATALINA_BASE和CATALINA_HOME和/$CATALINA_HOME/bin属于tomcat需要配置的 。其他的属于java配置
JAVA_HOME=/usr/local/java/jdk1.8.0_191
CLASSPATH=%JAVA_HOME%/lib:%JAVA_HOME%/jre/lib
CATALINA_BASE=/usr/local/tomcat/apache-tomcat-8.5.34
CATALINA_HOME=/usr/local/tomcat/apache-tomcat-8.5.34
PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:/$CATALINA_HOME/bin
export PATH CLASSPATH JAVA_HOME CATALINA_BASE CATALINA_HOME
生效 source /etc/profile
启动tomcat
[root@192 bin]# startup.sh
Using CATALINA_BASE: /usr/local/tomcat/apache-tomcat-8.5.34
Using CATALINA_HOME: /usr/local/tomcat/apache-tomcat-8.5.34
Using CATALINA_TMPDIR: /usr/local/tomcat/apache-tomcat-8.5.34/temp
Using JRE_HOME: /usr/local/java/jdk1.8.0_191
Using CLASSPATH: /usr/local/tomcat/apache-tomcat-8.5.34/bin/bootstrap.jar:/usr/local/tomcat/apache-tomcat-8.5.34/bin/tomcat-juli.jar
Tomcat started.
停止tomcat
[root@192 bin]# shutdown.sh
Using CATALINA_BASE: /usr/local/tomcat/apache-tomcat-8.5.34
Using CATALINA_HOME: /usr/local/tomcat/apache-tomcat-8.5.34
Using CATALINA_TMPDIR: /usr/local/tomcat/apache-tomcat-8.5.34/temp
Using JRE_HOME: /usr/local/java/jdk1.8.0_191
Using CLASSPATH: /usr/local/tomcat/apache-tomcat-8.5.34/bin/bootstrap.jar:/usr/local/tomcat/apache-tomcat-8.5.34/bin/tomcat-juli.jar
防火墙开放8080端口
[root@192 bin]# firewall-cmd --zone=public --add-port=8080/tcp --permanent
success
[root@192 bin]# firewall-cmd --reload
success