问题说明
参照官网安装jenkins:
https://pkg.jenkins.io/redhat-stable/
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
yum install fontconfig java-11-openjdk
yum install jenkins
安装完成后通过
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.
使用提示的
systemctl status jenkins.service
命令查看详细状态:
[root@VM-8-2-centos ~]# systemctl status jenkins.service
● jenkins.service - Jenkins Continuous Integration Server
Loaded: loaded (/usr/lib/systemd/system/jenkins.service; disabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Thu 2023-05-25 15:18:53 CST; 2s ago
Process: 17367 ExecStart=/usr/bin/jenkins (code=exited, status=1/FAILURE)
Main PID: 17367 (code=exited, status=1/FAILURE)
May 25 15:18:53 VM-8-2-centos systemd[1]: jenkins.service: main process exited, code=exited, status=1/FAILURE
May 25 15:18:53 VM-8-2-centos systemd[1]: Failed to start Jenkins Continuous Integration Server.
May 25 15:18:53 VM-8-2-centos systemd[1]: Unit jenkins.service entered failed state.
May 25 15:18:53 VM-8-2-centos systemd[1]: jenkins.service failed.
May 25 15:18:53 VM-8-2-centos systemd[1]: jenkins.service holdoff time over, scheduling restart.
May 25 15:18:53 VM-8-2-centos systemd[1]: Stopped Jenkins Continuous Integration Server.
May 25 15:18:53 VM-8-2-centos systemd[1]: start request repeated too quickly for jenkins.service
May 25 15:18:53 VM-8-2-centos systemd[1]: Failed to start Jenkins Continuous Integration Server.
May 25 15:18:53 VM-8-2-centos systemd[1]: Unit jenkins.service entered failed state.
May 25 15:18:53 VM-8-2-centos systemd[1]: jenkins.service failed.
网上大多都说是jdk路径问题和jdk版本不符。而我换了很多版本,路径也加上了安装路径依然无法解决systemctl
启动的问题
解决方式
以下方式可能只针对我服务器下的环境有效,可供参考
-
方式一:
cd /etc/init.d # 启动 ./jenkins start # 停止 ./jenkins stop # 状态 ./jenkins status
-
方式二:
修改配置文件中的用户名为root
老版本
# vim /etc/sysconfig/jenkins 修改为: JENKINS_USER="root"
新版本
# vim /usr/lib/systemd/system/jenkins.service 修改为: User=root Group=root
修改完成后执行
# systemctl daemon-reload
重载配置
参考
版权声明:本文为qq_33982898原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。