In this tutorial, AZDIGI will show you how to upgrade Java 8 to Java 14 on CentOS 7.
- You have
SSHpermissions or direct access to the server.
- Permission to execute
sudoor access with
rootadministrator is required.
Java is a simple object-oriented language designed with classes to have as few execution dependencies as possible.
Java is commonly used for many applications and websites that you use today.
And in the process of using Linux in general and CentOS 7 in particular, you will need to install many software that require Java to be installed on your server.
Although the latest version is Java 15, currently, we can only install Java 14 in the usual way.
If you are interested in looking through the Java versions, you can learn more at the following link:
II. Upgrade Java 8 to Java 14 on CentOS 7
To upgrade Java 8 to Java 14 on CentOS 7, we need to follow these 3 steps.
Step 1: SSH into your server
To upgrade Java 8 to Java 14 on CentOS 7, we first need to SSH or access your VPS/server as root. If you don’t know how to SSH into your VPS/Server, you can refer to the following tutorial:
After successfully SSHing into step 2, update the yum package repository on your CentOS 7 server.
Step 2: Update the yum package repository
To update the yum package repository, run the following command:
yum update -y
After the update is complete, we continue to step 3 to perform the commands to upgrade Java 8 to Java 14 on CentOS 7.
Step 3: Commands to upgrade Java 8 to Java 14 on CentOS 7
First, we need to install the Java 14 version on the server with the command below:
yum install java-14-openjdk-devel
Then you will receive information about the packages installed on your server, with their download size and post-installation space.
y and Enter to allow the installation to take place.
So you have successfully installed Java 14 on the CentOS server. However, your server will still take the previous Java version as the default, so we need to configure the default version to change to Java 14.
To change the default Java version, we just need to use the following command:
alternatives --config java
Because I previously installed Java 8 on CentOS 7, the content of my results will be as below. And when asked which version to choose as default, I chose 2, corresponding to the Java 14 version I just installed above.
[root@sv ~]# alternatives --config java There are 2 programs which provide 'java'. Selection Command ----------------------------------------------- *+ 1 java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-188.8.131.522.b08-1.el7_9.x86_64/jre/bin/java) 2 java-latest-openjdk.x86_64 (/usr/lib/jvm/java-14-openjdk-184.108.40.206-1.rolling.el7.x86_64/bin/java) Enter to keep the current selection[+], or type selection number: 2
Then we use the following command to check the default Java version on the system:
So we have finished upgrading Java 8 to Java 14 on CentOS 7.
So AZDIGI has completed the steps to upgrade Java 8 to Have 14 on CentOS 7.
Wishing you success! See more useful articles about Linux at the following link:
If you need assistance, you can contact support in the ways below: