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.

Command:

1
sudo yum install java-17-amazon-corretto-devel

This installs the JDK dev tools and the headless version of the JDK:

1
2
3
4
5
6
7
========================================================================================================================
 Package                                    Arch             Version                         Repository            Size
========================================================================================================================
Installing:
 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:

/usr/lib/jvm/java-17-amazon-corretto.x86_64

Version details:

1
2
3
4
$ bin/java -version
openjdk version "17.0.1" 2021-10-19 LTS
OpenJDK Runtime Environment Corretto-17.0.1.12.3 (build 17.0.1+12-LTS)
OpenJDK 64-Bit Server VM Corretto-17.0.1.12.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:

1
sudo rpm --import https://yum.corretto.aws/corretto.key

Followed by:

1
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.