web-dev-qa-db-ja.com

JenkinsのインストールにはJava8以降が必要ですが、1.7.0を実行しています

2017 以降、JenkinsはJava 7のサポートを終了し、現在ではJava 8.を使用しています。

私は、JenkinsをDebian Jessie(dockerコンテナー)にインストールしようとしています。この 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

手順の最後のステップで、これが起こりました:

$ 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.

私は解決策を見つけました ここ

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

とにかく、私はなんとかJenkinsをインストールしましたが、Jenkinsを起動すると、これが起こります。

$ 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)

たとえば、Java 8をDebian Jessieにインストールする必要がありますか?

1
ivanleoncz

競合を引き起こしているJREパッケージがあることがわかりました。

変更前:

$ 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

パッケージの削除:

$ 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) ...

後:

$ 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

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

プラス:

デフォルトでは、ローカルホスト経由のJenkins(ポート8080)。

ユーザー:管理者

パスワード: cat/var/lib/jenkins/secrets/initialAdminPassword

2
ivanleoncz