How to Install Java on Your CentOS VPS

Java is required for running some PC games on your Linux web server including Minecraft. The object-oriented programming language powers many websites and applications on computers and mobile devices. Below we cover how to install Java on your CentOS VPS.

You need root access to your VPS / Dedicated server to continue.

VPS Installation

The installation process consists of installing OpenJDK, the open source Java implementation which includes Font Renderer, or proprietary Oracle JRE/JDK with Flight Recorder which builds on top of OpenJDK.

We recommend OpenJDK for the latest features. You may prefer Oracle JRE/JDK for stability.

Install OpenJDK

  1. Log into SSH as root
  2. Search for the latest Java version: yum search openjdk
  3. Install the latest version: yum install java-11-openjdk as of January 28, 2020
  4. If you see the following the command afterwards, run yum-complete-transaction --cleanup-only, then yum history redo last to finish incomplete commands:
    There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).

Install Oracle JRE/JDK

  1. Visit
  2. Select Download for the latest Java SE version (version 13.0.2 as of January 28, 2020)
  3. Download the Linux RPM package
  4. (Optional) Verify the SHA256 checksum on your Windows, Mac, or Linux machine against the checksum
  5. Upload the RPM file package to your server via cPanel, FTP, or SSH (required on Cloud VPS)
  6. Install the RPM package as user root: yum install /path-to-file/jdk-[version].rpm

Using Ansible? Consider using the Ansible Java role within your playbooks. Learn more about the possibilities with IT automation in our Ansible Education Channel.

Check Java Version

Check your Java status to ensure it’s installed correctly: java -version

You should see similar results to below:

java version "13.0.2" 2020-01-14
Java(TM) SE Runtime Environment (build 13.0.2+8)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)

Uninstall Java

If you no longer need Java, uninstall the CentOS repo in SSH to harden your VPS Hosting.

Only pay for what you need with our tiered pricing options for Cloud VPS Hosting.

Was this article helpful? Let us know!