CenOS 7 - 搭建tomcat
安装
1.安装JDK
yum install java-1.8.0-openjdk* -y
2.上传tomcat 到 /root/~
tar -zxvf apache-tomcat-8.5.76.tar.gz 解压
mkdir -p /opt/tomcat
mv apache-tomcat-8.5.76/* /opt/tomcat 移动文件
3.启动tomcat
/opt/tomcat/bin/start.sh
4.访问:
配置tomcat用户
后续jenkins 部署项目到tomcat,需要用到tomcat的用户,所以需要配置用户和权限
manage - webap:
默认访问不了:
修改1:
vi /opt/tomcat/conf/tomcat-users.xml
<tomcat-users>
<!-- 添加以下内容 -->
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="manager-script"/>
<role rolename="manager-gui"/>
<role rolename="manager-status"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<user username="tomcat" password="tomcat" roles="manager-gui,managerscript,tomcat,admin-gui,admin-script"/>
</tomcat-users>
修改2:
vi /opt/tomcat/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后 ,再次点击manager-webapp,即可登录:
本文来自博客园,作者:chuangzhou,转载请注明原文链接:https://www.cnblogs.com/czzz/p/15996359.html