[Jenkins] Failed to start Jenkins Continuous Integration Server

问题

如果你在安装Jenkins的时候,总是出现下方的错误,而且配置了jdk路径也无法解决,请参考本文的解决办法:
错误信息:

jenkins.service - Jenkins Continuous Integration Server
   Loaded: loaded (/usr/lib/systemd/system/jenkins.service; disabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Tue 2022-06-07 17:09:46 CST; 20s ago
  Process: 5706 ExecStart=/usr/bin/jenkins (code=exited, status=1/FAILURE)
 Main PID: 5706 (code=exited, status=1/FAILURE)

Jun 07 17:09:45 k8s-master systemd[1]: jenkins.service: main process exited, code=exited, status=1/FAILURE
Jun 07 17:09:45 k8s-master systemd[1]: Failed to start Jenkins Continuous Integration Server.
Jun 07 17:09:45 k8s-master systemd[1]: Unit jenkins.service entered failed state.
Jun 07 17:09:45 k8s-master systemd[1]: jenkins.service failed.
Jun 07 17:09:46 k8s-master systemd[1]: jenkins.service holdoff time over, scheduling restart.
Jun 07 17:09:46 k8s-master systemd[1]: Stopped Jenkins Continuous Integration Server.
Jun 07 17:09:46 k8s-master systemd[1]: start request repeated too quickly for jenkins.service
Jun 07 17:09:46 k8s-master systemd[1]: Failed to start Jenkins Continuous Integration Server.
Jun 07 17:09:46 k8s-master systemd[1]: Unit jenkins.service entered failed state.
Jun 07 17:09:46 k8s-master systemd[1]: jenkins.service failed.

主要看这里,如果你按照普遍的方法解决不了,那一定是报错信息不一样,Process: 5706 ExecStart=/usr/bin/jenkins (code=exited, status=1/FAILURE)
在这里插入图片描述

解决办法(一)

首先安装jdk信息,如果你服务器上已经安装了jdk8,那么就执行

 yum install fontconfig java-8-openjdk

可能会出现已经存在或者其他的提示,不用管,也不影响。
接下来完善Jenkins加载到jdk的配置,
两种办法:

  • 方法一

    可以直接在配置文件配置/etc/init.d下的jenkins文件中增加现有jdk的路径:
    [Jenkins] Failed to start Jenkins Continuous Integration Server_第1张图片
    记得systemctl daemon-reload一下

  • 方法二
    也可以直接创建软链接,就像windows创建快捷方式一样简单,不用的时候可以删除这个软链接即可。

    ln -s /usr/local/java/jdk1.8.0_291/bin/java /usr/bin/java
    

    随后再次启动Jenkins即可

    systemctl start jenkins
    

解决办法(二)

如果不想卸载,那么你也可以不使用systemctl的方式去启动暂停Jenkins,直接用Jenkins自带的服务启动,其实systemctl最终也是执行的这个命令。

cd /etc/init.d

# 启动
./jenkins start
# 停止
./jenkins stop
# 状态
./jenkins status

解决办法(三)

如果按照上边的方法和网上其他的方法都无法解决,你可以卸载了重新按照官方的步骤坐下来,也是可以的。
[Jenkins] Failed to start Jenkins Continuous Integration Server_第2张图片
好啦,至此,问题解决,还解决不了,那就自求多福吧。

你可能感兴趣的:(错误记录,jenkins,运维,ci)