1、什么是jenkins?

Jenkins is an automation engine with an unparalleled plugin ecosystem to support all of your favorite tools in your delivery pipelines, whether your goal is continuous integration, automated testing, or continuous delivery.

持续集成、自动测试、持续部署的超级引擎,支持自定义工具集、多种交付通道。

2、yum安装

安装依赖:

yum install java-1.8.0-openjdk java-1.8.0-openjdk-devel -y

安装yum源

wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins.io/redhat-stable/jenkins.repo
rpm --import http://pkg.jenkins.io/redhat/jenkins.io.key
or
rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key

安装Jenkins

yum -y install jenkins
/etc/init.d/jenkins start
chkconfig jenkins on

3、rpm安装

下载地址

https://pkg.jenkins.io/redhat-stable/
or
https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable/

rpm安装

rpm -ivh jenkins-2.164.1-1.1.noarch.rpm
/etc/init.d/jenkins start
chkconfig jenkins on

4、访问Jenkins

http://192.168.6.242:8080/

cat //var/lib/jenkins/secrets/initialAdminPassword
db704dc12f8640959fd81068e6bf7fce

解决上述问题方法:
1) 修改/var/lib/jenkins/updates/default.json
jenkins在下载插件之前会先检查网络连接,其会读取这个文件中的网址。默认是:

访问谷歌,这就很坑了,服务器网络又不能FQ,肯定监测失败呀,不得不说jenkins的开发者脑子锈了,所以将图下的google改为www.baidu.com即可,更改完重启服务。

2) 修改/var/lib/jenkins/hudson.model.UpdateCenter.xml

该文件为jenkins下载插件的源地址,改地址默认jenkins默认为:https://updates.jenkins.io/update-center.json,就是因为https的问题,此处我们将其改为http即可,之后重启jenkins服务即可。

其他国内备用地址(也可以选择使用):

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

http://mirror.esuni.jp/jenkins/updates/update-center.json

在修复完之后,我们发现离线问题已经解决,如图下所示:

安装推荐插件

》》》需要重启!!!!

/etc/init.d/jenkins restart
Restarting jenkins (via systemctl):                        [  OK  ]

至此部署完成。

文档更新时间: 2019-04-04 09:36   作者:李延召