安裝html
nohup java -DJENKINS_HOME=/home/jenkins/root -jar home/jenkins/jenkins.war --httpPort=8888 &
訪問java
http://192.168.1.102:8888 //若是不通,能夠關閉防火牆
修改官方倉庫地址git
sed -i "s/https:\/\/updates.jenkins.io\/update-center.json/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins\/updates\/update-center.json/g" /home/jenkins/root/hudson.model.UpdateCenter.xml
修改默認Jenkins插件源與鏈接檢測位置github
sed -i 's/http:\/\/updates.jenkins-ci.org\/download/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g' /home/jenkins/root/updates/default.json sed -i 's/http:\/\/www.google.com/https:\/\/www.baidu.com/g' /home/jenkins/root/updates/default.json
查看管理員密碼json
cat ./root/secrets/initialAdminPassword 447b5e78c2f1428dbbd9ab571209b75d
修改腳本
腳本post
pipeline { agent any; environment { //環境變量 GITURL="https://github.com/xiayu/"; } stages{ stage('獲取git代碼') { steps{ sh 'echo "$GITURL $BRANCH"' } } } post { //構建完成後置操做 aborted { //若是構建中斷,則執行 echo '構建被停止!' } success { //構建成功執行 echo '構建成功!' } failure { //構建失敗執行 echo '構建失敗!' } } }
參考:https://www.cnblogs.com/hellxz/p/jenkins_pipeline_helloworld.html
https://www.cnblogs.com/hellxz/p/install_jenkins.htmlgoogle