简体   繁体   中英

Install Jenkins on Ubuntu 18.04.4. Jenkins didn´t start

Information:

After updating Java to version 8, I also installed Jenkins according to the steps defined below. When I tried to start Jenkins, it couldn't start. I am using Ubuntu 18.04.04.

Steps to reproduce the problem

The steps contain the procedure which one can use to install Jenkins with Ubuntu 18.04 with Java 8. Can these steps be used with Ubuntu 18.04.04?

 sudo add-apt-repository ppa:webupd8team/java
    sudo apt install oracle-java8-installer
    wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
    sudo apt-add-repository "deb https://pkg.jenkins.io/debian-stable binary/"
    sudo apt install jenkins

Issue Overview after install

jenkins.service - LSB: Start Jenkins at boot time
   Loaded: loaded (/etc/init.d/jenkins; generated)
   Active: failed (Result: exit-code) since Wed 2019-01-09 11:47:20 CET; 3min 6s
     Docs: man:systemd-sysv-generator(8)
  Process: 692 ExecStart=/etc/init.d/jenkins start (code=exited, status=1/FAILUR

Jan 09 11:47:19 Jenkins systemd[1]: Starting LSB: Start Jenkins at boot time...
Jan 09 11:47:19 Jenkins jenkins[692]: Found an incorrect Java version
Jan 09 11:47:19 Jenkins jenkins[692]: Java version found:
Jan 09 11:47:20 Jenkins jenkins[692]: openjdk version "10.0.2" 2018-07-17
Jan 09 11:47:20 Jenkins jenkins[692]: OpenJDK Runtime Environment (build 10.0.2+
Jan 09 11:47:20 Jenkins jenkins[692]: OpenJDK 64-Bit Server VM (build 10.0.2+13-
Jan 09 11:47:20 Jenkins jenkins[692]: Aborting
Jan 09 11:47:20 Jenkins systemd[1]: jenkins.service: Control process exited, cod
Jan 09 11:47:20 Jenkins systemd[1]: jenkins.service: Failed with result 'exit-co
Jan 09 11:47:20 Jenkins systemd[1]: Failed to start LSB: Start Jenkins at boot t
lines 1-16/16 (END)

You installed OracleJDK but Jenkins found OpenJDK

try

sudo update-alternatives --config java

Thanks @GaRaOne, choosing correct Java version helped me:

$ sudo update-alternatives --config java 
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      auto mode
  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      manual mode
* 2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM