//将tomcat压缩包解压到对应目录
tar zxvf apache-tomcat-8.5.100.tar.gz -C /usr/local/tomcat
//新建setenv.sh文件
touch /usr/local/tomcat/apache-tomcat-8.5.100/bin/setenv.sh
//修改setenv.sh文件
vi /usr/local/tomcat/apache-tomcat-8.5.100/bin/setenv.sh
//tomcat:setenv.sh配置
# 需要事先安装好JDK,可自行上网找教程
JAVA_HOME=/usr/local/jdk1.8.0_351
CATALINA_HOME=/usr/local/tomcat/apache-tomcat-8.5.100
CATALINA_PID=/usr/local/tomcat/apache-tomcat-8.5.100/bin/tomcat.pid
JAVA_OPTS="-server-Dfile.encoding=UTF-8 -Xms4096m -Xmx4096m-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom"
//修改端口为8083(选做)
sed -i "s/8080/8083/g" /usr/local/tomcat/apache-tomcat-8.5.100/conf/server.xml
<Resources cachingAllowed="true" cacheMaxSize="262144"/>
) <WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
#新增的配置
<Resources cachingAllowed="true" cacheMaxSize="262144"/>
//启停tomcat,查看日志
# 启动tomcat
/usr/local/tomcat/apache-tomcat-8.5.100/bin/startup.sh
# 或者
cd /usr/local/tomcat/apache-tomcat-8.5.100/bin
./startup.sh
# 停止tomcat
/usr/local/tomcat/apache-tomcat-8.5.100/bin/shutdown.sh
# 或者
cd /usr/local/tomcat/apache-tomcat-8.5.100/bin
./shutdown.sh
# 查看日志
tail -f /usr/local/tomcat/apache-tomcat-8.5.100/logs/catalina.out