1. 程式人生 > >apt-get install jdk8 失敗

apt-get install jdk8 失敗

背景:elasticsearch 需要安裝jdk8

apt-cache search java | grep jdk   # 無版本8
apt-get update   # 更新後執行,仍沒有

add-apt-repository ppa:webupd8team/java
apt-get update    #更新系統,重新整理軟體源
apt-get install oracle-java8-installer   
#網路來源 https://blog.csdn.net/infoflow/article/details/77856088

 

 報錯:

Downloading Oracle Java 8... --2018-06-12 10:49:41-- http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz Connecting to 10.0.10.117:3142... connected. Proxy request sent, awaiting response... 501 Redirected to invalid target 2018-06-12 10:49:41 ERROR 501: Redirected to invalid target.
download failed
Oracle JDK 8 is NOT installed. dpkg: error processing package oracle-java8-installer (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: oracle-java8-installer E: Sub-process /usr/bin/dpkg returned an error code (1)

排查原因:
oracle 原來下載地址無法下載

JRE Expiration Date
The JRE expires whenever a new release with security vulnerability fixes becomes available. 
Critical patch updates, which contain security vulnerability fixes, are announced one year in advance on Critical Patch Updates, Security Alerts and Third Party Bulletin. 
This JRE (version 8u144) will expire with the release of the next critical patch update scheduled for October 17, 2017.
Seems to be hardcoded in the installer.
Code:
PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/$FILENAME #must be modified for each release 

https://stackoverflow.com/questions/43587635/dpkg-error-processing-package-oracle-java8-installer-configure 

其中解決方法未確認,按以下官方解壓方法解決安裝