简体   繁体   English

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

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

I need to install jdk 15 on my Amazon ami linux instance of EC2.我需要在 EC2 的 Amazon ami linux 实例上安装 jdk 15。 I can't seem to find it using the command sudo yum list available | grep java我似乎无法使用命令sudo yum list available | grep java找到它sudo yum list available | grep java Any answers would be appreciated! sudo yum list available | grep java任何答案将不胜感激!

OpenJDK Java 15 is not available for Linux AMI, and I don't imagine it will be. OpenJDK Java 15 不适用于 Linux AMI,我不认为它会。

According to https://aws.amazon.com/amazon-linux-ami/ .根据https://aws.amazon.com/amazon-linux-ami/ AMI has entered the maintenance support phase of its end-of-life. AMI 已进入其生命周期结束的维护支持阶段 That means:这意味着:

"During this maintenance support period: “在此维护支持期间:

  • The Amazon Linux AMI will only receive critical and important security updates for a reduced set of packages. Amazon Linux AMI 将仅接收针对数量减少的软件包的关键和重要安全更新。
  • It will no longer be guaranteed to support new EC2 platform capabilities, or new AWS features."将不再保证支持新的 EC2 平台功能或新的 AWS 功能。”

Doing new stuff (ie involving Java 15) on AMI is a bad idea.在 AMI 上做新的东西(即涉及 Java 15)是个坏主意。


The replacement for AMI is Amazon Linux 2 . AMI 的替代品是Amazon Linux 2 I can't find a browsable list of packages, so I can't tell you whether Java is available for it.我找不到可浏览的软件包列表,所以我无法告诉您 Java 是否可用。 (But I doubt it.) (但我对此表示怀疑。)


When I search for AWS Java 15, I find a link to the Amazon Corretto: Corretto 15 User Guide .当我搜索 AWS Java 15 时,我找到了指向Amazon Corretto:Corretto 15 用户指南的链接。 This has installation instructions for a number of OSes, and the relevant ones for AMI and Amazon Linux 2 are as follows:这有许多操作系统的安装说明,AMI 和 Amazon Linux 2 的相关安装说明如下:

To use Corretto RPM repositories with the yum package manager, import the Corretto public key and then add the repository to the system list.要将 Corretto RPM 存储库与 yum package 管理器一起使用,请导入 Corretto 公钥,然后将存储库添加到系统列表中。 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:添加存储库后,您可以通过运行以下命令安装 Corretto 15:

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

It is worth noting that many other vendors provide Java (many version) for generic Linux.值得注意的是,许多其他供应商为通用 Linux 提供了 Java(许多版本)。 One would expect that they could be installed on an AWS AMI instance.人们会期望它们可以安装在 AWS AMI 实例上。 You would just need to follow the relevant instructions.您只需要按照相关说明进行操作。

I would try to install AdoptOpenJDK by following their instructions .我会尝试按照他们的说明安装 AdoptOpenJDK。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM