詹金斯未能在centOS7上开始

时间:2017-02-21 07:09:37

标签: linux jenkins centos7

我在我的centOS7 / linux服务器上使用jenkins。当我开始jenkins并检查状态时它向我显示了这个。

>jenkins.service - Jenkins Service  
>   Loaded: loaded (/etc/systemd/system/jenkins.service; enabled; vendor preset:  >  disabled)  
>   Active: failed (Result: exit-code) since Mon 2017-02-20 22:52:19 PST; 22s   > ago  
>  Process: 40251 ExecStart=/usr/bin/java -jar /usr/local/bin/jenkins.war    
>(code=exited, status=1/FAILURE)  
> Main PID: 40251 (code=exited, status=1/FAILURE)  
>Feb 20 22:52:19 CentOS7 systemd[1]: Started Jenkins Service.  
>Feb 20 22:52:19 CentOS7 systemd[1]: Starting Jenkins Service...  
>Feb 20 22:52:19 CentOS7 java[40251]: Error: Unable to access jarfile >/usr/l...ar  
>Feb 20 22:52:19 CentOS7 systemd[1]: jenkins.service: main process exited, >c...RE  
>Feb 20 22:52:19 CentOS7 systemd[1]: Unit jenkins.service entered failed state.  
>Feb 20 22:52:19 CentOS7 systemd[1]: jenkins.service failed.  
>Hint: Some lines were ellipsized, use -l to show in full.  

所以我通过此命令卸载了jenkins sudo yum remove jenkins,并再次安装sudo yum install jenkins
现在再次面临同样的问题。

任何人都可以告诉我该怎么做。

谢谢!

1 个答案:

答案 0 :(得分:0)

在安装Jenkins之前,您需要在系统上设置Java虚拟机

yum install java-1.8.0-openjdk.x86_64

并设置两个环境变量:JAVA_HOMEJRE_HOME

echo 'export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk' | sudo tee -a /etc/profile
echo 'export JRE_HOME=/usr/lib/jvm/jre' | sudo tee -a /etc/profile
source /etc/profile

然后安装jenkins并允许端口8080上的入站流量。

您可以从how to install jenkins on Centos 7查看更多详情。

希望这有帮助。