1.一键安装jenkins脚本
1.1 周更新(Weekly)版本
#!/bin/bash
#this is a shell for install jenkins
echo --------------------开始安装jenkins_weekly(周更新版本)----------
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install -y jenkins
#指定jenkins的版本为2.60.3
#sudo apt-get install -y jenkins=2.60.3
echo "----启动Jenkins----"
sudo /etc/init.d/jenkins start
echo ------安装完毕---------
echo -------下面显示的是jenkins安装口令,请将口令复制到浏览器中。--------
#./jenkins_key.sh
#./jenkins_key.sh
echo "-----modity /ect/soduers that add some setting of user jenkins----"
sudo chmod 775 /ect/sudoers
sudo echo " jenkins ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
sudo source /ect/sudoers
sudo chown -R jenkins /var/lib/jenkins/
#sudo cat /var/lib/jenkins/secrets/initialAdminPassword
echo "启动Jenkins"
echo ------全部安装完成-----------
1.2 稳定(Stable)版本
#!/bin/bash
#this is a shell for install jenkins
echo --------------------开始安装jenkins的stable版本----------
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install -y jenkins
echo "----启动Jenkins----"
sudo /etc/init.d/jenkins start
echo ------安装完毕---------
echo -------下面显示的是jenkins安装口令,请将口令复制到浏览器中。--------
#./jenkins_key.sh
echo "-----modity /ect/soduers that add some setting of user jenkins----"
sudo chmod 775 /ect/sudoers
sudo echo " jenkins ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
sudo source /ect/sudoers
sudo chown -R jenkins /var/lib/jenkins/
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
echo "启动Jenkins"
echo ------全部安装完成-----------
2.Shell安装文件地址
版本类型 | 文件名 |
---|---|
周更新 | install_jenkins.sh |
stable | install_jenkins_stable.sh |
3.用法(举例使用stable版本):
wget https://coding.net/u/jamesz2011/p/ubuntu_lib/git/raw/master/jenkins/install_jenkins_statble.sh
sudo chmod a+x install_jenkins_stable.sh
sudo source install_jenkins_stable.sh
4.jenkins 操作
4.1 jenkins服务操作
【命令行:Ubuntu下】> /etc/init.d/jenkins start|stop|restart
4.2 jenkins的”服务器”配置文件目录:
#此文件可修改jenkins的8080端口
/etc/default/jenkins
5.jenkins配置
1.(国内)插件源
https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
2.jdk配置
/usr/local/java/jdk1.8.0_121
3.maven配置
/usr/local/maven3/apache-maven-3.5.0
4.allure配置
/opt/allure-2.17.3