CentOS Install Java SDK using yum Command

To install the Java SDK on a CentOS system using the yum command, follow these steps:

  1. Import the Oracle GPG key by running the following command:
sudo rpm --import https://yum.oracle.com/RPM-GPG-KEY-oracle-ol7
  1. Create a file called /etc/yum.repos.d/java.repo with the following content:
[ol7_developer_EPEL]
name=Oracle Linux $releasever Developer (EPEL)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/developer/EPEL/x86_64/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
  1. Update the package index by running sudo yum update.
  2. Install the Java SDK by running the following command:
sudo yum install java-1.8.0-openjdk
  1. Verify the installation by checking the version of Java installed by running the following command:
java -version

That’s it! You have successfully installed the Java SDK on your CentOS system using the yum command.

Leave a Comment