Jenkins 安装教程
第一部分,安装Jenkins
1、首先在Jenkins repo yum源和Key
[root@jenkins ~]# wget http://pkg.jenkins.io/redhat-stable/jenkins.repo -O /etc/yum.repos.d/jenkins.repo [root@jenkins ~]# rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
2、安装Java
[root@jenkins ~]# yum install -y java [root@jenkins ~]# java -version openjdk version "1.8.0_191" OpenJDK Runtime Environment (build 1.8.0_191-b12) OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
3、安装最新版本Jenkins
[root@jenkins ~]# yum install jenkins -y
4、查看Jenkins配置文件,确保JENKINS_USER="jenkins"
[root@jenkins ~]# vim /etc/sysconfig/jenkins JENKINS_USER="jenkins"
5、创建Jenkins Home目录,并赋予Jenkins宿主
[root@jenkins ~]# mkdir /home/jenkins/ [root@jenkins ~]# chown jenkins:jenkins /home/jenkins
6、启动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 Tue 2019-03-05 17:13:23 EST; 7s ago Docs: man:systemd-sysv-generator(8) Process: 49539 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=0/SUCCESS) CGroup: /system.slice/jenkins.service └─49560 /etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/var/lib... Mar 05 17:13:22 jenkins.pso.com systemd[1]: Starting LSB: Jenkins Automation Server... Mar 05 17:13:22 jenkins.pso.com runuser[49544]: pam_unix(runuser:session): session opened for user jenkins by (uid=0) Mar 05 17:13:23 jenkins.pso.com runuser[49544]: pam_unix(runuser:session): session closed for user jenkins Mar 05 17:13:23 jenkins.pso.com systemd[1]: Started LSB: Jenkins Automation Server. Mar 05 17:13:23 jenkins.pso.com jenkins[49539]: Starting Jenkins [ OK ]
第二部分,初始化Jenkins
1、登录Jenkins Web页面(http://jenkins-ip:8080),从/var/lib/jenkins/secrets/initialAdminPassword中查看administrator初始密码
2、选择安装推荐的插件
3、设置管理员账号和密码
4、确认URL
5、配置完成