Amazon-Ec2

如何在 AWS ec2 實例上升級到 Java SE Development Kit 9.0.1?

  • November 21, 2017

試過了

[ec2-user@server ~]$ sudo yum install java-1.9.0
Loaded plugins: priorities, update-motd, upgrade-helper
No package java-1.9.0 available.
Error: Nothing to do

所以檢查了包裹,但它不在那裡

[ec2-user@server ~]$ sudo yum list java*
Loaded plugins: priorities, update-motd, upgrade-helper
Installed Packages
java-1.8.0-openjdk.x86_64   1:1.8.0.151-1.b12.35.amzn1  @amzn-updates
java-1.8.0-openjdk-devel.x86_64 1:1.8.0.151-1.b12.35.amzn1  @amzn-updates
java-1.8.0-openjdk-headless.x86_64  1:1.8.0.151-1.b12.35.amzn1  @amzn-updates
javapackages-tools.noarch   0.9.1-1.5.amzn1 installed
Available   Packages
java-1.6.0-openjdk.x86_64   1:1.6.0.41-1.13.13.1.77.amzn1   amzn-main
java-1.6.0-openjdk-demo.x86_64  1:1.6.0.41-1.13.13.1.77.amzn1   amzn-main
java-1.6.0-openjdk-devel.x86_64 1:1.6.0.41-1.13.13.1.77.amzn1   amzn-main
java-1.6.0-openjdk-javadoc.x86_64   1:1.6.0.41-1.13.13.1.77.amzn1   amzn-main
java-1.6.0-openjdk-src.x86_64   1:1.6.0.41-1.13.13.1.77.amzn1   amzn-main
java-1.7.0-openjdk.x86_64   1:1.7.0.151-2.6.11.0.74.amzn1   amzn-main
java-1.7.0-openjdk-demo.x86_64  1:1.7.0.151-2.6.11.0.74.amzn1   amzn-main
java-1.7.0-openjdk-devel.x86_64 1:1.7.0.151-2.6.11.0.74.amzn1   amzn-main
java-1.7.0-openjdk-javadoc.noarch   1:1.7.0.151-2.6.11.0.74.amzn1   amzn-main
java-1.7.0-openjdk-src.x86_64   1:1.7.0.151-2.6.11.0.74.amzn1   amzn-main
java-1.8.0-openjdk-demo.x86_64  1:1.8.0.151-1.b12.35.amzn1  amzn-updates
java-1.8.0-openjdk-javadoc.noarch   1:1.8.0.151-1.b12.35.amzn1  amzn-updates
java-1.8.0-openjdk-javadoc-zip.noarch   1:1.8.0.151-1.b12.35.amzn1  amzn-updates
java-1.8.0-openjdk-src.x86_64   1:1.8.0.151-1.b12.35.amzn1  amzn-updates
java_cup.noarch 1:0.10k-5.7.amzn1   amzn-main
java_cup-javadoc.noarch 1:0.10k-5.7.amzn1   amzn-main
java_cup-manual.noarch  1:0.10k-5.7.amzn1   amzn-main
javacc.noarch   4.1-0.5.8.amzn1 amzn-main
javacc-demo.noarch  4.1-0.5.8.amzn1 amzn-main
javacc-manual.noarch    4.1-0.5.8.amzn1 amzn-main
javassist.noarch    3.9.0-6.4.amzn1 amzn-main
javassist-javadoc.noarch    3.9.0-6.4.amzn1 amzn-main

有沒有辦法通過yum安裝它?

您可以直接從 Oracle 下載 RPM 包並通過 yum 安裝它。

轉到下載頁面http://www.oracle.com/technetwork/java/javase/downloads/jdk9-downloads-3848520.html 並使用指向 RPM 包的連結:

wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/9.0.1+11/jdk-9.0.1_linux-x64_bin.rpm
sudo yum install jdk-9.0.1_linux-x64_bin.rpm

引用自:https://serverfault.com/questions/884431