Amazon Corretto 8 Installation Instructions for Amazon Linux 2 and Amazon Linux 2023
This topic describes how to install and uninstall Amazon Corretto 8 on a host or container running the Amazon Linux 2 or Amazon Linux 2023 operating systems.
Option 1: Install using the yum Package Manager on Amazon Linux
-
Enable the yum repository in Amazon Linux 2. This is not required on Amazon Linux 2022 and later.
sudo amazon-linux-extras enable corretto8
-
You can install Amazon Corretto 8 as either the runtime environment (JRE) or the full development environment (JDK). The development environment includes the runtime environment.
Install Amazon Corretto 8 as JRE.
sudo yum install java-1.8.0-amazon-corretto
Install Amazon Corretto 8 as JDK.
sudo yum install java-1.8.0-amazon-corretto-devel
The installation location is /usr/lib/jvm/java-1.8.0-amazon-corretto.<cpu_arch>
.
Option 2: Download and Install RPMs Manually
-
Download RPMs from the Downloads page for your CPU architecture. To install the JDK, you will need to download the RPMs for both the JDK and the JRE.
-
Install using
yum localinstall
.sudo yum localinstall java-1.8.0-amazon-corretto*.rpm
Verify Your Installation
In the terminal, run the following command to verify the installation.
java -version
Expected output for 8u432:
openjdk version "1.8.0_432" OpenJDK Runtime Environment Corretto-8.432.06.1 (build 1.8.0_432-b06) OpenJDK 64-Bit Server VM Corretto-8.432.06.1 (build 25.432-b06, mixed mode)
If you see a version string that doesn't mention Corretto
,
run the following command to change the default java
or javac
providers.
sudo alternatives --config java
If using the JDK you should also run:
sudo alternatives --config javac
Uninstall Amazon Corretto 8
You can uninstall Amazon Corretto 8 with the following commands.
Uninstall JRE:
sudo yum remove java-1.8.0-amazon-corretto
Uninstall JDK:
sudo yum remove java-1.8.0-amazon-corretto-devel