1. 安装JDK【java8】
1.1. 软件安装
[yun@mini05 software]# pwd
/app/software
[yun@mini05 software]# tar xf jdk1.8.0_112.tar.gz
[yun@mini05 software]# ll
total 201392
drwxr-xr-x 8 10 143 4096 Dec 20 13:27 jdk1.8.0_112
-rw-r--r-- 1 root root 189815615 Mar 12 16:47 jdk1.8.0_112.tar.gz
[yun@mini05 software]# mv jdk1.8.0_112/ /app/
[yun@mini05 software]# cd /app/
[yun@mini05 app]# ll
total 8
drwxr-xr-x 8 10 143 4096 Dec 20 13:27 jdk1.8.0_112
[yun@mini05 app]# ln -s jdk1.8.0_112/ jdk
[yun@mini05 app]# ll
total 8
lrwxrwxrwx 1 root root 13 May 16 23:19 jdk -> jdk1.8.0_112/
drwxr-xr-x 8 10 143 4096 Dec 20 13:27 jdk1.8.0_112
1.2. 环境变量
[root@mini05 ~]$ pwd
/app
[root@mini05 ~]$ ll -d jdk*
lrwxrwxrwx 1 yun yun 11 Mar 15 14:58 jdk -> jdk1.8.0_112
drwxr-xr-x 8 yun yun 4096 Dec 20 13:27 jdk1.8.0_112
[root@mini05 profile.d]$ pwd
/etc/profile.d
[root@mini05 profile.d]$ cat jdk.sh # java环境变量
export JAVA_HOME=/app/jdk
export JRE_HOME=/app/jdk/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$PATH[root@mini05 profile.d]# source /etc/profile
[root@mini05 profile.d]$ java -version
java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b15, mixed mode)
2. 安装jenkins
2.1. 软件安装
[root@mini05 ~]# cd /etc/yum.repos.d/
[root@mini05 yum.repos.d]# wget http://pkg.jenkins.io/redhat/jenkins.repo
[root@mini05 yum.repos.d]# rpm --import http://pkg.jenkins.io/redhat/jenkins.io.key
[root@mini05 yum.repos.d]# yum install -y jenkins
2.2. 启动jenkins
[root@mini05 ~]# systemctl start jenkins
Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.
[root@mini05 ~]# systemctl status jenkins.service # 查看Jenkins状态【因为有问题】
● jenkins.service - LSB: Jenkins Automation Server
Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2018-10-07 10:28:30 CST; 5s ago
Docs: man:systemd-sysv-generator(8)
Process: 2483 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=1/FAILURE)Oct 07 10:28:30 mini05 systemd[1]: Starting LSB: Jenkins Automation Server...
Oct 07 10:28:30 mini05 runuser[2488]: pam_unix(runuser:session): session opened for user jenkins by (uid=0)
Oct 07 10:28:30 mini05 jenkins[2483]: Starting Jenkins bash: /usr/bin/java: No such file or directory
Oct 07 10:28:30 mini05 runuser[2488]: pam_unix(runuser:session): session closed for user jenkins
Oct 07 10:28:30 mini05 jenkins[2483]: [FAILED]
Oct 07 10:28:30 mini05 systemd[1]: jenkins.service: control process exited, code=exited status=1
Oct 07 10:28:30 mini05 systemd[1]: Failed to start LSB: Jenkins Automation Server.
Oct 07 10:28:30 mini05 systemd[1]: Unit jenkins.service entered failed state.
Oct 07 10:28:30 mini05 systemd[1]: jenkins.service failed.
解决方法修改 jenkins 启动脚本
[root@mini05 ~]# vim /etc/rc.d/init.d/jenkins
# 添加了 /app/jdk/bin/java 这样信息
………………
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
/app/jdk/bin/java
"
………………
再次报错修改
1 [root@mini05 ~]# systemctl start jenkins
2 Warning: jenkins.service changed on disk. Run 'systemctl daemon-reload' to reload units.
3 [root@mini05 ~]# systemctl daemon-reload # 执行该命令
重启Jenkins服务
[root@mini05 ~]# systemctl stop jenkins
[root@mini05 ~]# systemctl start jenkins
3.首次访问Jenkins
http://10.0.0.15
根据页面提示找密码,输入即可
离线问题
说明:在网上找了很多文章去解决该离线问题,但是最后都没有解决。所以只能进入页面后再手动安装常用插件。
创建用户
Jenkins URL
完毕
本文原创发布于公众号 OpenInfo,转载请务必注明出处!