安装JDK
在ORACLE官网下载jdk
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
[root@localhost ~]#tar -zxvf jdk-8u144-linux-x64.tar.gz --directory=/usr/local
[root@localhost ~]# vim /etc/profile #在最后添加java的环境变量
export JAVA_HOME=/usr/local/jdk1.8.0_144
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOMR/bin
wq!
[root@localhost ~]# source /etc/profile #重新加载环境变量配置文件
[root@localhost ~]# java -version #验证java是否安装成功
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode) #表示安装成功
安装Jenkins
Jenkins下载地址 https://pkg.jenkins.io/redhat/
[root@localhost ~]# rpm -ivh jenkins-2.73.1-1.1.noarch.rpm #下载的是RPM包,直接安装就行
[root@localhost ~]# vim /etc/init.d/jenkins #编辑程序文件66行
candidates="
#/etc/alternatives/java
#/usr/lib/jvm/java-1.8.0/bin/java
#/usr/lib/jvm/jre-1.8.0/bin/java
#/usr/lib/jvm/java-1.7.0/bin/java
#/usr/lib/jvm/jre-1.7.0/bin/java
#/usr/bin/java
/usr/local/jdk1.8.0_144/bin/java #注释掉上面无用的路径,添加正确路径
"
[root@localhost ~]# vim /etc/sysconfig/jenkins
55# JENKINS_PORT="8080" #web端口
[root@localhost ~]# systemctl restart jenkins
Warning: jenkins.service changed on disk. Run 'systemctl daemon-reload' to reload units.
#jenkins.service在磁盘上更改。 运行'systemctl daemon-reload'来重新加载单元。
[root@localhost ~]# systemctl daemon-reload #重新加载单元
[root@localhost ~]# systemctl restart jenkins #再次启动就OK了
网页配置
复制上面文件中的密码到下面

根据需求选择如何安装(左边建议安装,右边按需安装)这是只是测试,我选择左边

创建管理员账户

到这里就部署完成了

网友评论