Java Programming

Steps to Install Gradle on CentOS 8

In this tutorial, we’ll discuss about how to install Gradle on CentOS 8.

Gradle is an open-source build automation tool focused on flexibility and performance. Gradle build scripts are written using a Groovy or Kotlin DSL. Read about Gradle features to learn what is possible with Gradle.

  • Highly customizable — Gradle is modeled in a way that is customizable and extensible in the most fundamental ways.
  • Fast — Gradle completes tasks quickly by reusing outputs from previous executions, processing only inputs that changed, and executing tasks in parallel.
  • Powerful — Gradle is the official build tool for Android, and comes with support for many popular languages and technologies


Let’s get started with the installation.

1. Keep the server up to date

# dnf update -y

2. Install required package

# dnf install unzip -y

3. Install OpenJDK 8

# dnf install java-1.8.0-openjdk-devel -y

Verify the Java installation by printing the Java version :

java -version

Output will be similar like:

openjdk version “1.8.0_275”
OpenJDK Runtime Environment (build 1.8.0_275-b01)
OpenJDK 64-Bit Server VM (build 25.275-b01, mixed mode)

4. Download Gradle

At the time of writing this article, the latest version of Gradle is 6.7.1. Before continuing with the next step, you should check the Gradle releases page to see if a newer version is available.

Download the Gradle binary file in the /tmp directory using the following wget command:

# wget -P /tmp

Once the download is completed, unzip the file in the /opt/gradle directory:

# unzip -d /opt/gradle /tmp/gradle-*.zip

5. Configure the environment variables

Next, we’ll create one file named to configure the environmental variable PATH. Create a file in the /etc/profile.d directory. Use your favorite editor. For this demonstration purpose, we are using vi editor.

# vi /etc/profile.d/

Paste the following configuration:

export GRADLE_HOME=/opt/gradle/gradle-6.3
export PATH=${GRADLE_HOME}/bin:${PATH}

Save and exit.

Next, make the script executable by using chmod command like shown below:

# chmod +x /etc/profile.d/

Load the environment variables using the source command :

# source /etc/profile.d/

To validate that Gradle is installed properly run the following command which will display the Gradle version:

# gradle -v

Output will be similar like:

Welcome to Gradle 6.7.1!

Here are the highlights of this release:
– File system watching is ready for production use
– Declare the version of Java your build requires
– Java 15 support

For more details see

Gradle 6.7.1

Build time: 2020-11-16 17:09:24 UTC
Revision: 2972ff02f3210d2ceed2f1ea880f026acfbab5c0

Kotlin: 1.3.72
Groovy: 2.5.12
Ant: Apache Ant(TM) version 1.10.8 compiled on May 10 2020
JVM: 1.8.0_275 (Red Hat, Inc. 25.275-b01)
OS: Linux 4.18.0-240.1.1.el8_3.x86_64 amd64

That’s it. The installation has been completed successfully.

In this tutorial, we have seen how to install Gradle on CentOS 8.

Related Articles