Jenkins fails when running “service start jenkins”

前端 未结 21 2253
不知归路
不知归路 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:27

    ~>$ sudo vim /etc/rc.d/init.d/jenkins


    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/java/jdk1.8.0_162/bin/java ##add your java path

    "


    0 讨论(0)
  • 2021-01-30 21:27

    You just need to install Java. It did work after installing Java version 8, using this command : sudo apt install openjdk-8-jre-headless

    0 讨论(0)
  • 2021-01-30 21:32

    Still fighting the same error on both ubuntu, ubuntu derivatives and opensuse. This is a great way to bypass and move forward until you can fix the actual issue.

    Just use the docker image for jenkins from dockerhub.

    docker pull jenkins/jenkins

    docker run -itd -p 8080:8080 --name jenkins_container jenkins

    Use the browser to navigate to:

    localhost:8080 or my_pc:8080

    To get at the token at the path given on the login screen:

    docker exec -it jenkins_container /bin/bash

    Then navigate to the token file and copy/paste the code into the login screen. You can use the edit/copy/paste menus in the kde/gnome/lxde/xfce terminals to copy the terminal text, then paste it with ctrl-v

    War File

    Or use the jenkins.war file. For development purposes you can run jenkins as your user (or as jenkins) from the command line or create a short script in /usr/local or /opt to start it.

    Download the jenkins.war from the jenkins download page:

    https://jenkins.io/download/

    Then put it somewhere safe, ~/jenkins would be a good place.

    mkdir ~/jenkins; cp ~/Downloads/jenkins.war ~/jenkins

    Then run:

    nohup java -jar ~/jenkins/jenkins.war > ~/jenkins/jenkins.log 2>&1

    To get the initial admin password token, copy the text output of:

    cat /home/my_home_dir/.jenkins/secrets/initialAdminPassword

    and paste that into the box with ctrl-v as your initial admin password.

    Hope this is detailed enough to get you on your way...

    0 讨论(0)
  • 2021-01-30 21:32

    I faced same issue while setting up jenkins, the problem is that java is not installed and hence not available in path.

    The simplest way is to use scp here to copy jdk binaries to aws ec2 box, script won't work if you make one as they keep on updating download urls(Orale, i mean): scp -i C:/Users/key-pair.pem jdk-8u191-linux-x64.tar.gz ec2- user@54.183.220.7:~/

    $cd /opt
    
    $sudo cp /home/ec2-user/jdk* .
    
    $sudo chmod +x jdk*
    
    $sudo tar xzf jdk-8u191-linux-x64.tar.gz
    
    $sudo tar xzf jdk-8u191-linux-x64.tar.gz
    
    $cd jdk1.8.0_191/
    
    $sudo alternatives --install /usr/bin/java java /opt/jdk1.8.0_191/bin/java 2
    
    $sudo alternatives --config java
    

    Here I download tar.gz file in loal windows and transferred over scp to AWS ec2-user, default dir. Hope it helps.

    0 讨论(0)
  • 2021-01-30 21:32
    vi /etc/init.d/jenkins
    

    add:

    /usr/lib/jvm/java/jre/bin/java
    
    0 讨论(0)
  • 2021-01-30 21:35

    I had below error:

    Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.

    Solution was to revert the NAME to jenkins in the below file (Earlier I have changed it to 'NAME=ubuntu'):

    sudo vi /etc/default/jenkins
        NAME=jenkins
    

    Now restart passed:

    sudo service jenkins restart
    sudo systemctl restart jenkins.service
    

    Hope that helps.

    0 讨论(0)
提交回复
热议问题