a instalação do Jenkins requer Java8 ou posterior, mas você está executando o 1.7.0

1

Desde 2017 , Jenkins abandonou o suporte para Java 7 e hoje em dia, usando o Java 8.

Estou tentando instalar o Jenkins em um Debian Jessie (contêiner docker) e estou usando o seguinte procedimento obtido por meio deste link :

wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins

No último passo do procedimento, isso aconteceu:

$ apt-get install jenkins
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have 
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 jenkins : Depends: default-jre-headless (>= 2:1.8) but 2:1.7-52 is to be installed or
                java8-runtime-headless but it is not installable
E: Unable to correct problems, you have held broken packages.

Encontrei uma solução aqui :

$ apt install -t jessie-backports  openjdk-8-jre-headless ca-certificates-java

De qualquer forma, eu consegui instalar o Jenkins, mas quando inicio o Jenkins, isso acontece:

$ sudo /etc/init.d/jenkins start
[FAIL] Starting Jenkins Automation Server: jenkins failed!


$ tail -f /var/log/jenkins/jenkins.log 
Jenkins requires Java8 or later, but you are running 1.7.0_151-b01
from /usr/lib/jvm/java-7-openjdk-amd64/jre
  java.lang.UnsupportedClassVersionError: 51.0
    at Main.main(Main.java:124)

Eu tenho que instalar o Java 8 no Debian Jessie, por exemplo?

    
por ivanleoncz 19.01.2018 / 20:42

1 resposta

2

Descobri que havia pacotes JRE que estavam causando conflitos.

Antes:

$ sudo dpkg -l | grep --color 'java\|jdk\|jre'
ii  ca-certificates-java          20161107~bpo8+1            all          Common CA certificates (JKS keystore)
ii  default-jre-headless          2:1.7-52                   amd64        Standard Java or Java compatible Runtime (headless)
ii  java-common                   0.52                       all          Base of all Java packages
ii  libatk-wrapper-java           0.30.5-1                   all          ATK implementation for Java using JNI
ii  libatk-wrapper-java-jni:amd64 0.30.5-1                   amd64        ATK implementation for Java using JNI (JNI bindings)
ii  openjdk-7-jre:amd64           7u151-2.6.11-2~deb8u1      amd64        OpenJDK Java runtime, using Hotspot JIT
pi  openjdk-7-jre-headless:amd64  7u151-2.6.11-2~deb8u1      amd64        OpenJDK Java runtime, using Hotspot JIT (headless)
ii  openjdk-8-jre-headless:amd64  8u131-b11-1~bpo8+1         amd64        OpenJDK Java runtime, using Hotspot JIT (headless)
ii  tzdata-java                   2017c-0+deb8u1             all          time zone and daylight-saving time data for use by java runtimes

Como remover pacotes:

$ sudo dpkg -P openjdk-7-jre:amd64
(Reading database ... 15248 files and directories currently installed.)
Removing openjdk-7-jre:amd64 (7u151-2.6.11-2~deb8u1) ...
Processing triggers for hicolor-icon-theme (0.13-1) ...

$ sudo dpkg -P openjdk-7-jre-headless:amd64
(Reading database ... 15222 files and directories currently installed.)
Removing openjdk-7-jre-headless:amd64 (7u151-2.6.11-2~deb8u1) ...
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/rmid to provide /usr/bin/rmid (rmid) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/keytool to provide /usr/bin/keytool (keytool) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/pack200 to provide /usr/bin/pack200 (pack200) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/rmiregistry to provide /usr/bin/rmiregistry (rmiregistry) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/unpack200 to provide /usr/bin/unpack200 (unpack200) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/orbd to provide /usr/bin/orbd (orbd) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/servertool to provide /usr/bin/servertool (servertool) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/tnameserv to provide /usr/bin/tnameserv (tnameserv) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jexec to provide /usr/bin/jexec (jexec) in auto mode
Purging configuration files for openjdk-7-jre-headless:amd64 (7u151-2.6.11-2~deb8u1) ...

Depois:

$ dpkg -l | grep --color 'java\|jdk\|jre'
ii  ca-certificates-java          20161107~bpo8+1            all          Common CA certificates (JKS keystore)
ii  java-common                   0.52                       all          Base of all Java packages
ii  libatk-wrapper-java           0.30.5-1                   all          ATK implementation for Java using JNI
ii  libatk-wrapper-java-jni:amd64 0.30.5-1                   amd64        ATK implementation for Java using JNI (JNI bindings)
ii  openjdk-8-jre-headless:amd64  8u131-b11-1~bpo8+1         amd64        OpenJDK Java runtime, using Hotspot JIT (headless)
ii  tzdata-java                   2017c-0+deb8u1             all          time zone and daylight-saving time data for use by java runtimes

Iniciando o Jenkins:

$ /etc/init.d/jenkins start
[ ok ] Starting Jenkins Automation Server: jenkins.
$ tail -f /var/log/jenkins/jenkins.log 
Jan 19, 2018 1:22:39 PM hudson.model.DownloadService$Downloadable load
INFO: Obtained the updated data file for hudson.tasks.Maven.MavenInstaller
Jan 19, 2018 1:22:41 PM hudson.model.DownloadService$Downloadable load
INFO: Obtained the updated data file for hudson.tools.JDKInstaller
Jan 19, 2018 1:22:41 PM hudson.model.AsyncPeriodicWork$1 run
INFO: Finished Download metadata. 9,126 ms
Jan 19, 2018 1:22:43 PM hudson.model.UpdateSite updateData
INFO: Obtained the latest update center data file for UpdateSource default
Jan 19, 2018 1:22:43 PM hudson.WebAppMain$3 run
INFO: Jenkins is fully up and running

Plus:

By default, Jenkins via localhost (port 8080).

User: admin

Password: cat /var/lib/jenkins/secrets/initialAdminPassword

    
por 19.01.2018 / 20:50