DebianにJDK 8をインストールする

DebianにJDK 8をインストールする

DebianにJDK 8をインストールしようとしています。似たようなトピックをたくさん見つけましたが、そのどれも私の問題を解決できませんでした。ほとんどのテーマでは、解決策は次のコマンドです。

sudo apt-get install software-properties-common
sudo apt-get install python-software-properties

sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk

しかし、このエラーが発生しました。

パッケージのリストを読み込んでいます...完了依存関係ツリーの作成ステータス情報を読み込んでいます...完了一部のパッケージをインストールできません。これは、不可能な状況を要求した場合、または不安定なディストリビューションを使用している場合、一部の必須パッケージが作成されていないか、着信パッケージから移動されたことを意味します。次の情報は、この状況を解決するのに役立ちます。

次のパッケージには満たされていない依存関係があります。 openjdk-8-jdk : 依存関係: openjdk-8-jre (= 8u111-b14-2~bpo8+1) ただし、依存関係はインストールされません: openjdk-8-jdk-headless ( = 8u111- b14-2~bpo8+1 )しかしインストールされません。 E: 問題を解決できません。パッケージが破損しています。

アップデートも確認しました。

sudo update-alternatives --config java

出力は次のとおりです

Java接続グループ(/usr/bin/java提供)には1つの選択肢があります。/usr/lib/jvm/java-7-openjdk-i386/jre/bin/java構成は必要ありません。

答え1

openjdk-8は、デフォルトのJessie / stableインストールで利用できます。インストールにはapt-getが必要です(openjdk-8-jdkと必要な/必要なものは何でも推奨または依存します)。

もちろん、contribや無料以外のリポジトリを含む/etc/apt/sources.listファイルによって異なります。

/etc/apt/sources.list は次のようになります。

deb http://ftp.us.debian.org/debian/ jessie main contrib non-free
deb http://security.debian.org/ jessie/updates main contrib non-free
deb http://ftp.us.debian.org/debian/ jessie-updates main contrib non-free
deb http://ftp.us.debian.org/debian/ jessie-backports main contrib non-free

答え2

どのオプションが利用可能かを確認するには、常にDebian PTSを最初に確認してください。たとえば、私が行くなら -

https://tracker.debian.org/pkg/openjdk-8

左側にはバージョンというものがあります。見えますか?こう書いてあります。

  stable-bpo: 8u121-b13-1~bpo8+1
     testing: 8u121-b13-3
    unstable: 8u121-b13-4

これで、stable-bpoはバックポートされた状態であることを意味します。バックポートページでその機能について詳しく説明しています。https://backports.debian.org/

したがって、@Retoが共有したものとバックポートアドレスを既存のパッケージリストに追加する必要があります。

deb http://ftp.us.debian.org/debian/ jessie main contrib non-free
deb http://security.debian.org/ jessie/updates main contrib non-free
deb http://ftp.us.debian.org/debian/ jessie-updates main contrib non-free
deb http://ftp.us.debian.org/debian/ jessie-backports main contrib non-free

これでインデックスを更新すると、最後に次のように表示されます。

Reading package lists... Done
Building dependency tree       
Reading state information... Done
6 packages can be upgraded. Run 'apt list --upgradable' to see them.

アップグレードできるパッケージの数を確認する方法はありません。アップグレードできるパッケージの数、更新の頻度などによって異なります。 4行が上記と似ている場合は、インデックスの更新がエラーなしにスムーズに行われたことを意味します。

完了したら簡単にできます -

$ aptitude search openjdk-8

リストまたはリストされていないさまざまな openjdk-8 パッケージの数のリストを取得します。たとえば、テスト中ですが、ここにはたくさんあります。 openjdk-9もあります。

ダウンロードしたら、以前にインストールしようとしていたようにインストールしてください。

$ sudo aptitude install openjdk-8 

そして、適性がすべての依存関係解決に対処するようにしてください。それでも質問がある場合は、ここにお知らせください。

答え3

ここでは問題は解決しません。

#猫/etc/apt/sources.list

#deb hxxp://debian.mirrors.ovh.net/debian/ jessie main contrib non-free
#deb-src hxxp://debian.mirrors.ovh.net/debian/ jessie main contrib non-free

deb hxxp://security.debian.org/ jessie/updates main contrib non-free
deb-src hxxp://security.debian.org/ jessie/updates main contrib non-free

# jessie-updates, previously known as 'volatile'
deb hxxp://debian.mirrors.ovh.net/debian/ jessie-updates main contrib non-free
deb-src hxxp://debian.mirrors.ovh.net/debian/ jessie-updates main contrib non-free

# jessie-backports, previously on backports.debian.org
deb hxxp://debian.mirrors.ovh.net/debian/ jessie-backports main contrib non-free
deb-src hxxp://debian.mirrors.ovh.net/debian/ jessie-backports main contrib non-free

deb hxxp://debian.mirrors.ovh.net/debian/ jessie main contrib non-free
deb-src hxxp://debian.mirrors.ovh.net/debian/ jessie main contrib non-free

#apt-getのインストールopenjdk-8-jdk

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:
 openjdk-8-jdk : Depends: openjdk-8-jre (= 8u121-b13-1~bpo8+1) but it is not going to be installed
                 Depends: openjdk-8-jdk-headless (= 8u121-b13-1~bpo8+1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

関連情報