Jenkins最初是由日本人Kohsuke Kawaguchi在Sun公司主导开发,项目最初被称为Hudson。
环境初始化:
软件版本:jre 11, Jenkins 2.394,tomcat 8 jenkins 版本对jre版本有要求自行测试。
-
jdk
#apt-get install fontconfig freetype2-demos yum install fontconfig freetype
安装jdk wget https://download.java.net/java/ga/jdk11/openjdk-11_linux-x64_bin.tar.gz tar xf openjdk-11_linux-x64_bin.tar.gz -C /opt ln -svf /opt/{jdk-11,jdk} cat>>/etc/profile<<EOF export JAVA_HOME=/opt/jdk export JAVA_JRE=\$JAVA_HOME/jre export CLASSPATH=\$JAVA_HOME/lib:\$JAVA_HOME/jre/lib export PATH=\$JAVA_HOME/bin:\$JAVA_JRE/bin:$PATH:. EOF source /etc/profile [root@lavm-ioreaqndwv ~]# java -version openjdk version "11" 2018-09-25 OpenJDK Runtime Environment 18.9 (build 11+28) OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
java11及以上本版提示缺少java.lang 文件,解决办法从java8中拷贝issue
cp jdk1.8.0_391/jre/lib/fontconfig.bfc /opt/jdk/lib/ cp -a jdk1.8.0_391/jre/lib/fonts/ /opt/jdk/lib/
-
tomcat
wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.99/bin/apache-tomcat-8.5.99.tar.gz tar xf apache-tomcat-8.5.99.tar.gz -C /opt ln -svf /opt/apache-tomcat-8.5.99/ /opt/tomcat
-
jenkins
wget https://mirrors.tuna.tsinghua.edu.cn/jenkins/war/2.394/jenkins.war
启动jenkins
-
部署war包
cp jenkins.war /opt/tomcat/webapps/
启动tomcat
# 前台启动 /opt/tomcat/bin/catalina.sh run
# 守护进程启动 /opt/tomcat/bin/catalina.sh start /opt/tomcat/bin/catalina.sh stop
访问jenkins
# 初始化密码位置 cat /$USER/.jenkins/secrets/initialAdminPassword http://localhost:8080/jenkins/
-
启动
Jenkins内置jetty应用服务器,Jetty 是 Java 实现的一个轻量级的 Servlet 容器
java -jar jenkins.war
访问jenkins
# 初始化密码位置 cat /$USER/.jenkins/secrets/initialAdminPassword http://localhost:8080
该方式支持一些参数和java 环境变量
--httpPort=8080 --httpsPort=8083 --prefix=/jenkins --webroot=/var/cache/jenkins --argumentsRealm.passwd.admin=admin --argumentsRealm.roles.admin=admin --httpsPrivateKey=/var/lib/jenkins/pk --httpsCertificate=/var/lib/jenkins/cert
-Djenkins.install.runSetupWizard=true -Djenkins.security.ApiTokenProperty.adminCanGenerateNewTokens=false -Dcom.cloudbees.hudson.plugins.folder.computed.ThrottleComputationQueueTaskDispatcher.LIMIT=10
-
docker run -p 9090:8080 --rm jenkinszh/jenkins-zh:2.238 docker run -p 9090:8080 --rm jenkins/jenkins:2.238