一、安装JDK
Jenkins是Java编写的,所以需要先安装JDK,这里采用yum安装
[root@jenkins ~]# yum install -y java-1.8.0 [root@jenkins ~]# java -version openjdk version "1.8.0_141" OpenJDK Runtime Environment (build 1.8.0_141-b16) OpenJDK 64-Bit Server VM (build 25.141-b16, mixed mode)
二、安装Jenkins
[root@jenkins ~]# cd /etc/yum.repos.d/ [root@jenkins yum.repos.d]# wget http://pkg.jenkins.io/redhat/jenkins.repo [root@jenkins yum.repos.d]# rpm --import http://pkg.jenkins.io/redhat/jenkins.io.key [root@jenkins yum.repos.d]# yum -y install jenkins [root@jenkins yum.repos.d]# /etc/init.d/jenkins start [root@jenkins yum.repos.d]# ps -ef | grep jenkins jenkins 1249 1 22 22:34 ? 00:00:04 /etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/jenkins/jenkins.war --logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war --daemon --httpPort=8080 --debug=5 --handlerCountMax=100 --handlerCountMaxIdle=20 root 1272 1119 0 22:34 pts/0 00:00:00 grep jenkins [root@jenkins yum.repos.d]# netstat -nlput | grep 8080 tcp 0 0 :::8080 :::* LISTEN 1249/java
三、访问Jenkins
在浏览器输入 http://IP:8080 来访问Jenkins
请在/var/lib/jenkins/secrets/initialAdminPassword中查看文件
[root@jenkins yum.repos.d]# cat /var/lib/jenkins/secrets/initialAdminPassword
727b28ca0cd3434780ee6f807e8af190
选择需要安装的插件:
选择默认即可,会安装通用的社区插件,剩下的可以在使用的时候再进行安装
提示:由于网络原因,有一些插件会安装失败
设置admin用户和密码
登录Jenkins