无法在Debian Jessie上安装openjdk-8-jre-headless


28

这个星期五,我看到我因为运行原因出于某种原因保留了2个软件包apt-get upgrade,所以自然地我做了所有没有经验的sysadmin都会做的事情,并卸载了软件包,希望我可以简单地重新安装它们并解决问题。

我不知道,我只是使情况变得更糟。当我尝试重新安装时openjdk-8-jre-headless,我得到了:

$ apt-get install openjdk-8-jre-headless
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-jre-headless : Depends: ca-certificates-java but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

我尝试手动升级提到的软件包,但无济于事。

$ apt-get upgrade ca-certificates-java
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... ca-certificates-java is already the newest version.
Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

环顾四周,我在任何地方都没有提到该确切错误的解决方案。

我在重新启动的服务器上使用ElasticSearch,但我应该期望它不会在此时启动。所以现在我没有Java了,我的用户也没有搜索了。这是怎么回事,我该如何解决?

Answers:



22
  1. 首先,您需要添加jessie-backports回购。

    echo "deb http://http.debian.net/debian jessie-backports main" > /etc/apt/sources.list.d/jessie-backports.list
    
  2. 安装命令

    sudo apt-get update
    sudo apt-get install -t jessie-backports openjdk-8-jre-headless
    
  3. 切换到新的Java

    sudo /usr/sbin/update-java-alternatives -s java-1.8.0-openjdk-amd64
    

参考:https : //github.com/OpenTreeOfLife/germinator/wiki/Debian-upgrade-notes : -jessie-and-openjdk-8


我认为您想要这样做--jre-headless/usr/sbin/update-java-alternatives所以您不会尝试更新诸如appletviewer之类的东西。
MSalters

1

我在Debian Buster上遇到了这个问题,后者也没有此软件包。由于此页面上的答案均不适合我,并且被接受的答案将我引向另一个我也无法使用的SE答案,因此我只想在Buster上发布对我有用的内容。

按照debian网站上的说明,我将以下行添加到/etc/apt/sources.list

deb http://security.debian.org/debian-security stretch/updates main

当时我能sudo apt updatesudo apt install openjdk-8-jre-headless


-1

这对我有用

apt-get install software-properties-common
add-apt-repository "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main"
apt-get update
apt-get install oracle-java8-installer

指南


您的答案包含ubuntu xenial但有问题的标签debian
-SeinopSys
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.