如何在我的 AWS Linux Ec2 实例上安装 JDK 15?

How do I install JDK 15 on my AWS Linux Ec2 instance?

我需要在我的 Amazon ami linux EC2 实例上安装 jdk 15。我似乎无法使用命令 sudo yum list available | grep java 找到它 如有任何答案,我们将不胜感激!

OpenJDK Java 15 不适用于 Linux AMI,我认为不会。

根据 https://aws.amazon.com/amazon-linux-ami/. AMI has entered the maintenance support phase 其生命周期结束。这意味着:

"During this maintenance support period:

  • The Amazon Linux AMI will only receive critical and important security updates for a reduced set of packages.
  • It will no longer be guaranteed to support new EC2 platform capabilities, or new AWS features."

在 AMI 上做新东西(即涉及 Java 15)是个坏主意。


AMI 的替代品是 Amazon Linux 2。我找不到可浏览的软件包列表,所以我无法告诉您 Java 是否可用。 (但我对此表示怀疑。)


当我搜索 AWS Java 15 时,我找到 link 到 Amazon Corretto: Corretto 15 User Guide。这个里面有很多OS的安装说明,AMI和Amazon的相关Linux2如下:

To use Corretto RPM repositories with the yum package manager, import the Corretto public key and then add the repository to the system list. For most systems, you must run the following commands:

sudo rpm --import https://yum.corretto.aws/corretto.key  
sudo curl -L -o /etc/yum.repos.d/corretto.repo https://yum.corretto.aws/corretto.repo

After the repository is added, you can install Corretto 15 by running this command:

sudo yum install -y java-15-amazon-corretto-devel

值得注意的是,许多其他供应商为通用 Linux 提供 Java(许多版本)。人们会期望它们可以安装在 AWS AMI 实例上。 您只需按照相关说明进行操作即可。

我会尝试按照他们的 instructions.

安装 AdoptOpenJDK