前言:
Jenkins是一个免费且开源的自动化工具,提供持续集成、持续交付以及持续部署,无论你使用任何平台Jenkins都可以处理任何类型的构建和部署。
环境:
CentOS Linux release 7.4.1708 (Core)
java-1.8.0-openjdk.x86_64 1:1.8.0.171-8.b10.el7_5 //2.54(2017-04)和更新版本:java1.8+
安装条件:
最低硬件要求:
256MB的RAM
1GB的磁盘空间(如果将Jenkins作为Docker容器运行,建议最小值为10GB)
小团队的推荐硬件配置:
1GB+RAM
50GB+的磁盘空间
以上内容来自Jenkins官网:https://jenkins.io/doc/book/installing/
安装部署:
安装jdk环境:
[root@Jenkins ~]# yum -y install java-1.8.0-openjdk
此次省略一万行……
[root@Jenkins ~]# java -version
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-b10)
OpenJDK 64-Bit Server VM (build 25.171-b10, mixed mode)
安装Jenkins:
[root@Jenkins ~]# wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
--2018-07-20 14:22:21-- https://pkg.jenkins.io/redhat-stable/jenkins.repo
Resolving pkg.jenkins.io (pkg.jenkins.io)... 52.202.51.185
Connecting to pkg.jenkins.io (pkg.jenkins.io)|52.202.51.185|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 85
Saving to: ‘/etc/yum.repos.d/jenkins.repo’
100%[======================================>] 85 --.-K/s in 0s
2018-07-20 14:22:23 (2.11 MB/s) - ‘/etc/yum.repos.d/jenkins.repo’ saved [85/85]
[root@Jenkins ~]# rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
[root@Jenkins ~]# yum -y install jenkins
此处仍然省略一万行……
[root@Jenkins ~]# systemctl start jenkins
[root@Jenkins ~]# systemctl status jenkins
● jenkins.service - LSB: Jenkins Automation Server
Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)
Active: active (running) since 五 2018-07-20 14:26:17 CST; 5s ago
Docs: man:systemd-sysv-generator(8)
Process: 1360 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/jenkins.service
└─1379 /etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized -D...
7月 20 14:26:16 Jenkins systemd[1]: Starting LSB: Jenkins Automation Server...
7月 20 14:26:16 Jenkins runuser[1365]: pam_unix(runuser:session): session o...)
7月 20 14:26:17 Jenkins jenkins[1360]: Starting Jenkins [ 确定 ]
7月 20 14:26:17 Jenkins systemd[1]: Started LSB: Jenkins Automation Server.
Hint: Some lines were ellipsized, use -l to show in full.
在浏览器上输入http://ip:8080/
[root@Jenkins ~]# cat /var/lib/jenkins/secrets/initialAdminPassword
69377335a92b4ddfab420ea0777e91da
选择安装推荐的插件;
等待插件安装完成;
创建一个全新的管理员用户;
到此为止Jenkins的安装已经完成
参考文章:Jenkins结合gitlab实现持续集成
http://www.linuxops.cc/2018/07/12/Jenkins%E7%BB%93%E5%90%88gitlab%E5%AE%9E%E7%8E%B0%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90/