搭建环境 | 系统:centos 7 | Java 1.8 | jenkins 2.121.3-1.1 2.1

  • [root@master ~]# /etc/init.d/jenkins start

Starting jenkins (via systemctl): Job for jenkins.service failed
because the control process exited with error code. See “systemctl
status jenkins.service” and “journalctl -xe” for details.
[FAILED]

查看日志

● jenkins.service - LSB: Jenkins Automation Serve
Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2018-09-11 20:39:41 EDT; 2min 48s ago
Docs: man:systemd-sysv-generator(8)
Sep 11 20:39:38 master systemd[1]: Starting LSB: Jenkins Automation Server…
_Sep 11 20:39:40 master runuser[11110]: pam_unix(runuser:session): session opened for …=0)_
Sep 11 20:39:41 master jenkins[11104]: Starting Jenkins bash: /usr/jdk1.8: Is a directory
_Sep 11 20:39:41 master runuser[11110]: pam_unix(runuser:session): session closed for …oot_
Sep 11 20:39:41 master jenkins[11104]: [FAILED]
Sep 11 20:39:41 master systemd[1]: jenkins.service: control process exited, code=exit…s=1
Sep 11 20:39:41 master systemd[1]: Failed to start LSB: Jenkins Automation Server.
Sep 11 20:39:41 master systemd[1]: Unit jenkins.service entered failed state.
Sep 11 20:39:41 master systemd[1]: jenkins.service failed.
Hint: Some lines were ellipsized, use -l to show in full.


  • 修改配置文件:

    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/jdk1.8

    /usr/jdk1.8/bin/java


    (注释掉原有jdk路径,添加自己的)

  • 在candidates里插入自己的jdk java路径,其他的全部注释掉

  • #JENKINS_USER=”jenkins”
    JENKINS_USER=”root”
    JENKINS_USER 改成root

再次启动 jenkins 错误解决

[root@master ~]# /etc/init.d/jenkins start
Starting jenkins (via systemctl): Warning: jenkins.service changed on disk. Run ‘systemctl daemon-reload’ to reload units.
[ OK ]


本文原创–支持原创

联系我--strivedeer@163.com