版权声明:转载原创文章请以超链接形式请注明原文章出处,尊重作者,尊重原创!
恰饭广告
环境准备,配置jdk: https://www.idaobin.com/archives/117.html 注意:Tomcat版本对应着jdk版本,参考文档http://tomcat.apache.org/whichversion.html
wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-9/v9.0.10/bin/apache-tomcat-9.0.10.tar.gz
注意:tomcat官网下载地址http://tomcat.apache.org/ 创建tomcat文件夹
mkdir /usr/local/tomcat
解压下载文件
tar zxvf apache-tomcat-9.0.10.tar.gz
移动
mv apache-tomcat-9.0.10/* /usr/local/tomcat
修改tomcat环境变量
vim /etc/profile
末尾添加:
export TOMCAT_HOME=/usr/local/tomcat export CATALINA_HOME=/usr/local/tomcat export PATH=$PATH:/usr/local/java/bin:/usr/local/tomcat/bin
启动tomcat
/usr/local/tomcat/bin/startup.sh
注意:启动之前要保证8080端口不被占用
重启tomcat
/usr/local/tomcat/bin/shutdown.sh
/usr/local/tomcat/bin/startup.sh
加入开机自启
vim /etc/rc.d/rc.local
添加
/usr/local/tomcat/bin/startup.sh
tomcat启动缓慢的解决方案
yum -y install rng-tools
编辑配置文件
vim /usr/lib/systemd/system/rngd.service
找到
ExecStart=/sbin/rngd -f
改为
ExecStart=/sbin/rngd -f -r /dev/urandom
编辑java配置文件
vim /usr/local/java/jdk1.8.0_131/jre/lib/security/java.security
找到
securerandom.source=file:/dev/random
改为
securerandom.source=file:/dev/urandom
重新载入服务
systemctl daemon-reload
启动rngd
systemctl restart rngd
开机自启
systemctl enable rngd
修改Tomcat端口
vim /usr/local/tomcat/conf/server.xml
找到
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
注意:8080为默认端口,修改8080为其他端口即可
防火墙开放端口
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --reload
注意:Tomcat的网站根目录
/usr/local/tomcat/webapps/
原文链接:https://www.idaobin.com/archives/1324.html
让我恰个饭吧.ヘ( ̄ω ̄ヘ)
恰饭广告