Install Java Yum May 2026

sudo yum search openjdk Or search for a specific version:

echo $JAVA_HOME List installed Java packages:

java -version Sample output:

Here’s a step-by-step write-up on installing Java using yum on a RHEL-based Linux distribution (such as CentOS, Rocky Linux, AlmaLinux, or Amazon Linux). 1. Overview Java is a essential runtime and development environment for many applications. On Red Hat-based systems, yum (or dnf on newer versions) provides an easy way to install various Java versions, including OpenJDK (the open-source reference implementation) and, optionally, Oracle Java (via third-party repos).

sudo yum install java-17-openjdk-devel On many systems, you can install the default Java set by the distribution: install java yum

sudo yum install oraclelinux-release-el8 sudo yum install java-11-oraclejdk-devel For other distributions, download the RPM from Oracle JDK Downloads and install:

sudo yum list available | grep -i java Option A: Install Headless JRE (Minimal runtime, no GUI) sudo yum install java-11-openjdk-headless Option B: Install Full JRE (Includes sound, graphics support) sudo yum install java-11-openjdk Option C: Install JDK (For development) sudo yum install java-11-openjdk-devel Option D: Install a Different Java Version Replace 11 with another version, e.g., 8 , 17 , 21 : sudo yum search openjdk Or search for a

sudo yum localinstall jdk-11.0.22_linux-x64_bin.rpm | Issue | Solution | |--------|----------| | No package available | Enable EPEL repo: sudo yum install epel-release | | Unable to find a match | Ensure repository metadata is updated: sudo yum clean all && sudo yum update | | Multiple versions conflict | Use sudo alternatives --config java to resolve | | java: command not found after install | Logout & login, or check /usr/bin/java symlink | 10. Conclusion Installing Java via yum is straightforward, offering flexibility to choose between JRE, JDK, and various versions. The alternatives system simplifies managing multiple installations. Always verify with java -version and set JAVA_HOME for production environments. Need a specific Java version or distribution? Adjust the package names accordingly (e.g., java-1.8.0-openjdk for Java 8). For containers or minimal environments, the -headless variant saves space.

Top