image.png

1.一键安装jenkins脚本

1.1 周更新(Weekly)版本

  1. #!/bin/bash
  2. #this is a shell for install jenkins
  3. echo --------------------开始安装jenkins_weekly(周更新版本)----------
  4. wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
  5. sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
  6. sudo apt-get update
  7. sudo apt-get install -y jenkins
  8. #指定jenkins的版本为2.60.3
  9. #sudo apt-get install -y jenkins=2.60.3
  10. echo "----启动Jenkins----"
  11. sudo /etc/init.d/jenkins start
  12. echo ------安装完毕---------
  13. echo -------下面显示的是jenkins安装口令,请将口令复制到浏览器中。--------
  14. #./jenkins_key.sh
  15. #./jenkins_key.sh
  16. echo "-----modity /ect/soduers that add some setting of user jenkins----"
  17. sudo chmod 775 /ect/sudoers
  18. sudo echo " jenkins ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
  19. sudo source /ect/sudoers
  20. sudo chown -R jenkins /var/lib/jenkins/
  21. #sudo cat /var/lib/jenkins/secrets/initialAdminPassword
  22. echo "启动Jenkins"
  23. echo ------全部安装完成-----------

1.2 稳定(Stable)版本

  1. #!/bin/bash
  2. #this is a shell for install jenkins
  3. echo --------------------开始安装jenkinsstable版本----------
  4. wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
  5. sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
  6. sudo apt-get update
  7. sudo apt-get install -y jenkins
  8. echo "----启动Jenkins----"
  9. sudo /etc/init.d/jenkins start
  10. echo ------安装完毕---------
  11. echo -------下面显示的是jenkins安装口令,请将口令复制到浏览器中。--------
  12. #./jenkins_key.sh
  13. echo "-----modity /ect/soduers that add some setting of user jenkins----"
  14. sudo chmod 775 /ect/sudoers
  15. sudo echo " jenkins ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
  16. sudo source /ect/sudoers
  17. sudo chown -R jenkins /var/lib/jenkins/
  18. sudo cat /var/lib/jenkins/secrets/initialAdminPassword
  19. echo "启动Jenkins"
  20. echo ------全部安装完成-----------

2.Shell安装文件地址

版本类型 文件名
周更新 install_jenkins.sh
stable install_jenkins_stable.sh

[建议]使用stable版本

3.用法(举例使用stable版本):

  1. wget https://coding.net/u/jamesz2011/p/ubuntu_lib/git/raw/master/jenkins/install_jenkins_statble.sh
  2. sudo chmod a+x install_jenkins_stable.sh
  3. sudo source install_jenkins_stable.sh

4.jenkins 操作

4.1 jenkins服务操作

  1. 【命令行:Ubuntu下】> /etc/init.d/jenkins start|stop|restart

4.2 jenkins的”服务器”配置文件目录:

  1. #此文件可修改jenkins的8080端口
  2. /etc/default/jenkins

5.jenkins配置

1.(国内)插件源

  1. https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json

image.png

原始镜像源:https://updates.jenkins.io/update-center.json

2.jdk配置

image.png

/usr/local/java/jdk1.8.0_121

3.maven配置

image.png

/usr/local/maven3/apache-maven-3.5.0

4.allure配置

image.png

/opt/allure-2.17.3

6.一些好文章

  1. 《Jenkins迁移及日常操作的一点总结》