Jenkins是基于Java开发的一种持续集成工具,用于监控持续重复的工作,功能包括:
1、持续的软件版本发布/测试项目。
2、监控外部调用执行的工作。
所以安装Jenkins包含安装相应的jdk环境和Jenkins工具。
1、下载Jenkins最新版本
到官网https://jenkins.io/download/下载相应的版本,本次安装选择的是最新的2.62版本,选择适用于fedora系统


2、下载JDK8最新版本

3、安装JDK8和Jenkins
把两个安装包上传到fedora系统指定路径下

查看当前的JDK版本

安装新的JDK替换openJDK

安装Jenkins

到此,Jenkins相关的环境就安装完成了。
4、启动Jenkins
编辑配置文件,可以看到默认启用端口为8080
[root@localhost ~]# vi /etc/sysconfig/jenkins

如果端口被使用可以修改为其他端口,此处不修改
[root@localhost ~]# netstat -ntulp |grep 8080
启动Jenkins服务
[root@localhost ~]# service jenkins start
Starting jenkins (via systemctl): [ 确定 ]
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# netstat -ntulp |grep 8080
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# netstat -ntulp |grep 8080
tcp6 0 0 :::8080 :::* LISTEN 3429/java
[root@localhost ~]#
[root@localhost ~]#
访问Jenkins,http://192.168.0.199:8080

根据提示用初始密码进行登录

登录后选择安装推荐的插件

安装完成后创建一个管理员用户。

5、配置Jenkins的用户认证(LDAP)
进入 系统管理>Configure Global Security,选择LDAP方式的访问控制,配置以下三个地方即可:
同时增加矩阵授权,先配置匿名用户有管理员权限,避免LDAP配置错误或者无法认证登录导致用户登录不了:

(如果不小心配置错误保存后无法认证登录,可以修改配置文件/var/lib/jenkins/config.xml,将<useSecurity>true</useSecurity>的值改为false,重启Jenkins服务后再重新配置即可)
可以测试一下LDAP的用户是否可以认证通过。
退出重新使用LDAP的用户登录,登录成功后,进入 系统管理>Configure Global Security,重新修改矩阵授权为指定管理员才有管理权限,其他登录用户的权限通过配置匿名用户来控制:
初始化配置完成。