Jenkins fails when running “service start jenkins”

前端 未结 21 2856
不知归路
不知归路 2021-01-30 20:46

I installed jenkins on Cnetos 7 using the following:

sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --impor         


        
21条回答
  •  别跟我提以往
    2021-01-30 21:18

    Similar problem on Ubuntu 16.04.

    Setting up jenkins (2.72) ...
    Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.
    invoke-rc.d: initscript jenkins, action "start" failed.
    ● jenkins.service - LSB: Start Jenkins at boot time
    Loaded: loaded (/etc/init.d/jenkins; bad; vendor preset: enabled)
    Active: failed (Result: exit-code) since Tue 2017-08-01 05:39:06 UTC; 7ms ago
    Docs: man:systemd-sysv-generator(8)
    Process: 3700 ExecStart=/etc/init.d/jenkins start (code=exited, status=1/FAILURE)
    
    Aug 01 05:39:06 ip-0 systemd[1]: Starting LSB: Start Jenkins ....
    Aug 01 05:39:06 ip-0 jenkins[3700]: ERROR: No Java executable ...
    Aug 01 05:39:06 ip-0 jenkins[3700]: If you actually have java ...
    Aug 01 05:39:06 ip-0 systemd[1]: jenkins.service: Control pro...1
    Aug 01 05:39:06 ip-0 systemd[1]: Failed to start LSB: Start J....
    Aug 01 05:39:06 ip-0 systemd[1]: jenkins.service: Unit entere....
    Aug 01 05:39:06 ip-0 systemd[1]: jenkins.service: Failed with....
    

    To fix the issue manually install Java Runtime Environment:

    JDK version 9:

    sudo apt install openjdk-9-jre
    

    JDK version 8:

    sudo apt install openjdk-8-jre
    

    Open Jenkins configuration file:

    sudo vi /etc/init.d/jenkins
    

    Finally, append path to the new java executable (line 16):

    PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/lib/jvm/java-8-openjdk-amd64/bin/
    

提交回复
热议问题