安装Jenkins
安装java
cd /usr/local
[ -e /usr/local/jdk ] && echo ">>> Already installed" && exit 1
package_name="jdk-8u221-linux-x64"
tar xf ${package_name}.tar.gz
ln -s ${package_name} jdk
ln -s /usr/local/jdk/bin/java /usr/bin/java
cat >> /etc/profile <<EOF
export JAVA_HOME=/usr/local/jdk
export JRE_HOME=\$JAVA_HOME/jre
export PATH=\$PATH:\$JAVA_HOME/bin:\$JRE_HOME/bin
EOF
sleep 3s
source /etc/profile
echo "检验安装"
java -version
我的下载地址
提取码:ikgi
unzip jdk1.8.0_171.zip # First
package_name="jdk1.8.0_171"
安装定制化的tomcat
#!/bin/bash
data_dir="/data/apps"
[ -e /usr/local/tomcat* ] && echo ">>> Already installed" && exit 1
[ -e ${data_dir} ] || mkdir -p ${data_dir}/tomcat/webapps_jenkins/ /data/logs/tomcat
cd ${data_dir}
git clone https://github.com/pctxiaozhu/tomcat8.git
tar -xf tomcat8/tomcat.tar.gz -C /usr/local
chown -R web:web /usr/local/tomcat* /data/logs ${data_dir}
mv ${data_dir}/script/* /home/web/
echo "下载war包"
cd ${data_dir}/tomcat/webapps_jenkins/
wget http://mirrors.jenkins.io/war-stable/latest/jenkins.war
mv jenkins.war ROOT.war
修改/usr/local/tomcat2/conf/server.xml
<Host name="localhost" appBase="/data/apps/tomcat/webapps_jenkins"
unpackWARs="true" autoDeploy="true">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
修改 webapps_jenkins/ROOT/WEB-INF/web.xml
<!-- if specified, this value is used as the Hudson home directory -->
<env-entry>
<env-entry-name>HUDSON_HOME</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value></env-entry-value>
</env-entry>
定制jenkins home 路径
修改为
<!-- if specified, this value is used as the Hudson home directory -->
<env-entry>
<env-entry-name>HUDSON_HOME</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>/home/jenkins</env-entry-value>
</env-entry>