Home Linux Server Upgrade Java 8 to Java 14 on CentOS 7

Upgrade Java 8 to Java 14 on CentOS 7

by Thạch Phạm

In this tutorial, AZDIGI will show you how to upgrade Java 8 to Java 14 on CentOS 7.

Necessary conditions:

  • You have SSH permissions or direct access to the server.
  • Permission to execute sudo or access with root administrator is required.

I. Introduction

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:

AZDIGI Tutorial
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:

AZDIGI Tutorial
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.

how-to-upgrade-java-8-to-java-14-on-centos-7
Download and install Java 14 on CentOS 7.

We choose y and Enter to allow the installation to take place.

how-to-upgrade-java-8-to-java-14-on-centos-7
Installed Java 14 on CentOS 7 complete.

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:

AZDIGI Tutorial
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.

AZDIGI Tutorial
[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-1.8.0.282.b08-1.el7_9.x86_64/jre/bin/java)
   2           java-latest-openjdk.x86_64 (/usr/lib/jvm/java-14-openjdk-14.0.2.12-1.rolling.el7.x86_64/bin/java)

Enter to keep the current selection[+], or type selection number: 2
    
how-to-upgrade-java-8-to-java-14-on-centos-7
Change the default Java version.

Then we use the following command to check the default Java version on the system:

AZDIGI Tutorial
java -version
    
how-to-upgrade-java-8-to-java-14-on-centos-7
Java version 14 on CentOS 7 server.

So we have finished upgrading Java 8 to Java 14 on CentOS 7.

III. Summary

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:

Đánh giá

Tham gia nhóm hỗ trợ Server - Hosting

Tham gia nhóm Hỗ trợ Server - Hosting & WordPress để cùng nhau hỏi đáp và hỗ trợ các vấn đề về WordPress, tối ưu máy chủ/server.

Tham gia ngay

Bài viết cùng chuyên mục

AZDIGI – Không chỉ là đơn vị hàng đầu trong lĩnh vực Web Hosting và Máy chủ, chúng tôi mong muốn mang lại những kiến thức bổ ích nhất và luôn cập nhật thường xuyên cho cộng đồng người đam mê thiết kế website, công nghệ,…

Vui lòng không sao chép nội dung nếu chưa xin phép. Designed and Developed by PenciDesign