---
title: "How to Install Java on CentOS"
description: "Java is required for running some games on your Linux VPS including Minecraft. The object-oriented programming language powers many websites and applications on computers and mobile devices. Below we..."
url: https://www.inmotionhosting.com/support/product-guides/vps-hosting/install-java-on-centos/
date: 2020-01-29
modified: 2024-01-04
author: "InMotion Hosting Contributor"
categories: ["VPS Hosting"]
type: post
lang: en
---

# How to Install Java on CentOS

![Install Java on CentOS](https://www.inmotionhosting.com/support/wp-content/uploads/2020/01/canva-install-java-centos-1024x538.jpg)

**Java** is required for running some games on your [Linux VPS](https://www.inmotionhosting.com/vps-hosting) 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 CentOS](#install) wp:list /wp:list
  - [Install OpenJDK](#openjdk)
  - [Install Oracle JRE/JDK](#oracle)
- [Check Java Download Version](#check)
- [Uninstall Java](#uninstall)

You need root access to your linux server on your VPS or Dedicated server to continue.

## Install Java on CentOS

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. As of January 25, 2021: yum install java-11-openjdk
4. You may see the following command afterward: `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).`If so, run the following to finish incomplete commands:yum-complete-transaction --cleanup-onlyyum history redo last

### Install Oracle JRE/JDK

1. Visit [https://www.oracle.com/java/technologies/javase-downloads.html](https://www.oracle.com/java/technologies/javase-downloads.html)
2. Select **JDK Download** for the latest Java SE version (version 15 as of January 25, 2021)
3. Download the Linux RPM package
4. (Optional) Verify the SHA256 checksum of the downloaded file on your Windows, Mac, or Linux machine against the checksum on the downloads page
5. Upload the RPM file package to your server via cPanel, FTP, or SSH
6. Install the RPM package as user root: yum install /path-to-file/jdk-.rpm

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

## Check Java Download Version

Check your Java status to ensure it's installed correctly:

java -version

You should see similar results to below:

![Java version 15.0.2 information](https://www.inmotionhosting.com/support/wp-content/uploads/2021/01/java-download-15.png)

## Uninstall Java

If you no longer need Java, uninstall the CentOS repo in SSH.

Learn more about managing your linux server with our Managed VPS Hosting Product Guide.
