To install Java 11 (Amazon Corretto) on RHEL8 machines, you can 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 $ sudo yum install -y java-11-amazon-corretto-devel
After running the above commands, check if Java 11 is successfully installed:
$ java -version openjdk version "11.0.15" 2022-04-19 LTS OpenJDK Runtime Environment Corretto-11.0.15.9.1 (build 11.0.15+9-LTS) OpenJDK 64-Bit Server VM Corretto-11.0.15.9.1 (build 11.0.15+9-LTS, mixed mode)
That’s it!