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 cover how to:
- Install Java on CentOS
- Check Java Download Version
- Uninstall Java
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.
- Log into SSH as root
- Search for the latest Java version:
yum search openjdk
- Install the latest version. As of January 25, 2021:
yum install java-11-openjdk
- 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 history redo last
Install Oracle JRE/JDK
- Visit https://www.oracle.com/java/technologies/javase-downloads.html
- Select JDK Download for the latest Java SE version (version 15 as of January 25, 2021)
- Download the Linux RPM package
- (Optional) Verify the SHA256 checksum of the downloaded file on your Windows, Mac, or Linux machine against the checksum on the downloads page
- Upload the RPM file package to your server via cPanel, FTP, or SSH
- Install the RPM package as user root:
yum install /path-to-file/jdk-[version].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:
You should see similar results to below:
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.