2019-06-11(更) :写的不是很清晰... 待重构文章
[ Linux安装Tomcat8]
卸载Tomcat - 先暂停Tomcat
# systemctl stop tomcat
# yum remove tomcat
rpm安装的可以用yum remove tomcat移除
安装 Apache Tomcat8 使用华中师范科技大学开源镜像下载
# wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-8/v8.5.37/bin/apache-tomcat-8.5.37.tar.gz
解压Tomcat,删除安装包 -解压的时候可以设置自己所需要存储的位置
# rm -rf apache-tomcat-8.5.37.tar.gz
# tar -vzxf apache-tomcat-8.5.37.tar.gz
移动Tomcat到/usr/local/下-并重命名
# mv apache-tomcat-8.5.37 /usr/local/tomcat
启动Tomcat
# cd /usr/local/tomcat/bin
# ./startup.sh
查看Tomcat服务是否启动
# ps -ef|grep tomcat
关闭Tomcat
# cd /usr/local/tomcat/bin
# ./shutdown.sh
查看Tomcat版本
# cd /usr/local/tomcat/bin
# ./version.sh
server.xml配置
# vim /usr/local/tomcat/conf/server.xml
protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="1000" minSpareThreads="100" maxSpareThreads="200"
acceptCount="1000" disableUploadTimeout="true" connectionTimeout="20000"
URIEncoding="UTF-8" enableLookups="false" compression="on"
compressionMinSize="2048"
compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain,image/gif,image/jpg,image/png" redirectPort="8443" />
设置开机启动
编辑rc.local文件
# vim /etc/rc.d/rc.local
最后一行添加/root/apache-tomcat-8.5.37/bin/startup.sh
/usr/local/tomcat/bin/startup.sh
重启服务器生效(虚拟机会重启)
# reboot
Tomcat的目录结构
webapps目录结构