centos安装jenkins并自动部署java web项目总结

安装jenkins:

wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
yum install -y jenkins
systemctl enable jenkins
systemctl start jenkins

jenkins安装以下插件:
Publish Over SSH(可选)
Maven Integration plugin
Git plugin
Deploy to container

修改/usr/local/tomcat/conf/tomcat-users.xml:
<tomcat-users xmlns=”http://tomcat.apache.org/xml”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=”http://tomcat.apache.org/xml tomcat-users.xsd”
version=”1.0″>
<role rolename=”manager-gui”/>
<role rolename=”manager-script”/>
<role rolename=”admin-gui”/>
<user username=”admin” password=”jiupai@123″ roles=”manager-gui,manager-script,admin-gui”/>
</tomcat-users>

修改/usr/local/tomcat/webapps/manager/META-INF/context.xml:
<Context antiResourceLocking=”false” privileged=”true” >
<!–
<Valve className=”org.apache.catalina.valves.RemoteAddrValve”
allow=”127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1″ />
–>
<Manager sessionAttributeValueClassNameFilter=”java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap”/>
</Context>

注释掉这段代码即可,这样就可以用用户名和密码访问Manager App了。

 

项目配置截图:

Leave a Reply

Your email address will not be published. Required fields are marked *