How To Install Gradle on CentOS 8 / 7 & RHEL 8 / 7 | Holhol24


Gradle is an open-source build automation system. It supports multiple programming languages such as
Java, C++, and Python development. It is based on the concepts of Apache Ant and Apache Maven.

Gradle uses Groovy to define project configurations.

In this post, we will install
Gradle on
CentOS 8 /
7 &
RHEL 8 /

Install JDK / JRE

Gradle’s only requirement is to have Java JDK or JRE version 8 or above to be installed on the system.

If you prefer Oracle Java JDK over OpenJDK, then:

How To Install Oracle Java on CentOS 8 / RHEL 8

How To Install Oracle Java on CentOS 7 / RHEL 7

Here, I will go with
OpenJDK 8. Install the OpenJDK package by using the
yum command.

yum install -y java

Verify the Java installation by running the following command.

java -version

openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-b08)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)

Install other required packages.

yum install -y wget unzip

Install Gradle

Download the latest version of the Gradle (v6.3) from its
official site. We will use the Gradle Binary-only zip file for the installation.


Use the below command to download Gradle (v6.3) in the terminal.

cd /tmp


Extract the downloaded zip file and copy it to /opt/gradle directory.

unzip gradle-*.zip

mkdir /opt/gradle

cp -pr gradle-*/* /opt/gradle

Verify the extracted files by listing the contents of /opt/gradle/ directory.

ls /opt/gradle/

LICENSE  NOTICE  bin  getting-started.html  init.d  lib  media

Setup environment variables

We will now configure the profile for the PATH environment variable to include the Gradle’s bin directory. Run the following command to add the environment.

echo "export PATH=/opt/gradle/bin:${PATH}" | tee /etc/profile.d/

Make the profile file executable by using the chmod command.

sudo chmod +x /etc/profile.d/

Load the environment variables to the current session by using the following command.

source /etc/profile.d/

Verify Gradle installation

Validate the Gradle installation using the below command.

gradle -v

Welcome to Gradle 6.3!

Here are the highlights of this release:
 - Java 14 support
 - Improved error messages for unexpected failures

For more details see

Gradle 6.3

Build time:   2020-03-24 19:52:07 UTC
Revision:     bacd40b727b0130eeac8855ae3f9fd9a0b207c60

Kotlin:       1.3.70
Groovy:       2.5.10
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          1.8.0_242 (Oracle Corporation 25.242-b08)
OS:           Linux 4.18.0-80.7.1.el8_0.x86_64 amd64


That’s All. You have successfully installed Gradle on
CentOS 8 /
7 &
RHEL 8 /
7. Visit the official
Gradle’s Documentation page to learn how to
get started with Gradle.