#前提
先建好/opt/app 目录
#将/opt/app 目录指定给用户jenkins
用root 账号 chown jenkins:jenkins /opt/app
1、从jenkins 官网下载war
2、将jenkins.war -> ROOT.war 这个的目的是为了 定义的jenkins的端口 直接映射到 /下
3、在/opt/app/bin 下创建创建 网站启动脚本
tomcat-jenkins-start.sh
#!/bin/bash
export LB_LIBRAR_PATH="/usr/local/apache-tomcat/bin/native"
export JAVA_HOME="/usr/lib/jdk1.7.0_79"
export CATALINA_OPTS="-Dtomcat.server.port=8083 -Dtomcat.http.port=8089 -Dtomcat.instance.name=jenkins -Xmx512m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError"
export CATALINA_OUT="/opt/app/logs/jenkins/catalina.out"
export CATALINA_PID="/opt/app/run/tomcat-jenkins.pid"
export CATALINA_BASE="/opt/app/webapps/jenkins"
# rm -rf /opt/app/webapps/jenkins/work
# rm -rf /opt/app/webapps/jenkins/webapps/ROOT
/usr/local/apache-tomcat/bin/catalina.sh start
exit $?
4、创建jenkins 停止脚本
tomcat-jenkins-stop.sh
#!/bin/bash
export JAVA_HOME="/usr/lib/jdk1.7.0_79"
export JAVA_OPTS="-Dtomcat.server.port=8083 -Dtomcat.http.port=8089 -Dtomcat.instance.name=jenkins"
export CATALINA_PID="/opt/app/run/tomcat-jenkins.pid"
export CATALINA_BASE="/opt/app/webapps/jenkins"
/usr/local/apache-tomcat/bin/catalina.sh stop 30 -force
exit $?
5、把 tomcat 目录下的conf/ 目录复制到/opt/app/webapps/jenkins/下,同时修改server.xml,在host节点中添加
<Context path="/" docBase="../webapps/ROOT/" debug="0" reloadable="true"/>
这样 执行tomcat-jenkins-start 就可以启动站点了