Linux安装Tomcat
1.安装Tomcat
下载Tomcat
wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.53/bin/apache-tomcat-8.5.53.tar.gz
解压文件
tar -zxvf apache-tomcat-8.5.53.tar.gz
2.环境配置
开机启动
vim /etc/rc.d/rc.local
export JAVA_HOME=/usr/local/java/jdk1.8.0_231
/usr/local/java/apache-tomcat-8.5.53/bin/startup.sh start
可执行权限
chmod 777 /etc/rc.d/rc.local
3.Tomcat8.5启动过慢
修改jdk安装路径下java.security内容
/jdk/jre/lib/security/java.security
securerandom.source=file:/dev/random
修改为
securerandom.source=file:/dev/./urandom
4.Manager App配置
新增权限
vim /usr/local/java/apache-tomcat-8.5.53/conf/tomcat-users.xml
<role rolename = "manager-gui"/>
<user username = "用户名" password = "密码" roles = "manager-gui"/>
允许外网访问
vim /usr/local/java/apache-tomcat-8.5.53/webapps/manager/META-INF/context.xml
注释这部分内容
<!--
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
-->
重启Tomcat
输入之前配置的用户名及密码即可进入管理界面