Debian
無法在 Debian Jessie 上安裝 openjdk-8-jre-headless
這個星期五,我在跑步時看到由於某種原因我有 2 個被保留的軟體包
apt-get upgrade
,所以我自然而然地做了任何沒有經驗的系統管理員都會做的事情並解除安裝了這些軟體包,希望我可以簡單地重新安裝它們並解決問題。我幾乎不知道,我只是讓情況變得更糟。當我嘗試重新安裝
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,我的使用者也沒有搜尋。發生了什麼事,我該如何解決?
這對我有用:
apt install -t jessie-backports openjdk-8-jre-headless ca-certificates-java
- 首先你需要添加
jessie-backports
repo。echo "deb http://http.debian.net/debian jessie-backports main" > /etc/apt/sources.list.d/jessie-backports.list
- 安裝命令
sudo apt-get update sudo apt-get install -t jessie-backports openjdk-8-jre-headless
- 切換到新的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