安装Tomcat8.5
把Tomcat压缩包上传到tomcat服务器(tomcat专用服务测试服务器、生产服务器)
yum install java-1.8.0-openjdk* -y
wget https://ftp.wayne.edu/apache/tomcat/tomcat-9/v9.0.41/bin/apache-tomcat-9.0.41.tar.gz
tar xf apache-tomcat-9.0.41.tar.gz
mv apache-tomcat-9.0.41 /usr/local/
#启动tomcat
/usr/local/tomcat/bin/startup.sh
后续Jenkins部署项目到Tomcat服务器,需要用到Tomcat的用户,所以修改tomcat以下配置, 添加用户及权限。
vim /usr/local/apache-tomcat-9.0.41/conf/tomcat-users.xml
# 用户和密码都是:tomcat
<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,manager-script,tomcat,admin-gui,admin-script"/>
为了能够刚才配置的用户登录到Tomcat,还需要修改以下配置
vim /usr/local/apache-tomcat-9.0.41/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" /> -->