Corretto is Amazon’s distribution of Open JDK.
Linux 2 is an operating system provided by Amazon.
The full installation instructions for Java 17 are here.
sudo yum install java-17-amazon-corretto-devel
This installs the JDK dev tools and the headless version of the JDK:
Package Arch Version Repository Size
java-17-amazon-corretto-devel x86_64 1:17.0.1+12-3.amzn2.1 amzn2-core 134 k
Installing for dependencies:
java-17-amazon-corretto-headless x86_64 1:17.0.1+12-3.amzn2.1 amzn2-core 94 M
Corretto is installed here:
$ bin/java -version
openjdk version "17.0.1" 2021-10-19 LTS
OpenJDK Runtime Environment Corretto-18.104.22.168.3 (build 17.0.1+12-LTS)
OpenJDK 64-Bit Server VM Corretto-22.214.171.124.3 (build 17.0.1+12-LTS, mixed mode, sharing)
If you are using a different flavor of Linux, you probably do not have the required Corretto RPM repository. Therefore you may first need to 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 that, you should be able to run the
yum install command.