Home Linux Server How to install Java 8 on CentOS 7

How to install Java 8 on CentOS 7

by Thạch Phạm
Published: Last Updated on
A+A-
Reset

In today’s tutorial, I will help you install Java 8 on CentOS 7 in an understandable and fastest way possible.

I. Introduction

In this guide, AZDIGI will show you how to install Oracle’s Java 8 programming language specifically on CentOS 7 server. 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.

II. How to install Java 8 on CentOS 7

To install Java 8 on CentOS 7, we need to perform the following 3 steps.

Step 1: SSH into your server

To install Java 8 on CentOS 7, we first need to SSH or access your VPS/server with root privileges. If you don’t know how to SSH into your VPS/Server, you can refer to the following tutorial:

After successfully SSHing, we continue with step 2 to check if our CentOS 7 server has Java installed previously.

Step 2: Check if the server has Java installed

To check if the server has Java installed, we just need to execute the following command:

AZDIGI Tutorial
java -version
    

If the result is -bash: java: command not found, your server doesn’t have Java installed.

how-to-install-java-8-on-centos-7
The server has not been installed with Java.

We will proceed to step 3 to execute commands to install Java 8 on CentOS 7.

Step 3: Commands to install Java 8 on CentOS 7

Before executing commands to install Java, we should update our CentOS 7 operating system with the following command:

AZDIGI Tutorial
yum -y update
    

After everything is updated, we use the following command to install Java 8:

AZDIGI Tutorial
yum -y install java-1.8.0-openjdk
    
how-to-install-java-8-on-centos-7
Install Java 8 on CentOS 7.

After the installation is complete, we can use the command in step 2 again to recheck.

AZDIGI Tutorial
java -version
    

If you get the following results, then we have successfully installed Java 8.

AZDIGI Tutorial
[root@sv ~]# java -version
openjdk version "1.8.0_282"
OpenJDK Runtime Environment (build 1.8.0_282-b08)
OpenJDK 64-Bit Server VM (build 25.282-b08, mixed mode)
[root@sv ~]#
    
how-to-install-java-8-on-centos-7

III. Summary

So with only 3 basic steps, we have successfully installed Java 8 on CentOS 7. Having Java pre-installed on your server will help when you install software that requires Java to be used, you will no longer be required to install Java.

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