How to install Gradle on CentOS 8


Gradle is an open-source build automation tool that is used mostly in Java projects. It automates the building process of applications which includes compiling, linking, and packaging of code without manual input.Gradle also supports Groovy, which is an object-oriented dynamic language created for Java applications.

Install OpenJDK on CentOS 8

We need to install OpenJDK first to ensure that it runs smoothly without a problem. We are going to install OpenJDK 11 which offers Long Term Support execute:

# yum install java-11-openjdk

Verify the installation of OpenJDK :

# java -version

The output clearly shows that we have installed OpenJDK version 11.0.11.

Download Gradle

So the next step is to download Gradle. As I am penning this article, Gradle 7.1.1 is the latest version. Feel free to glance at the Gradle releases page for newer versions.

For now, let’s download the current Gradle zip file as shown.

# wget

Then move the zip file to the /opt directory as shown.

# mv /opt

In addition to go to /opt directory and Unzip the contents of the Gradle zip file as follows.

# cd /opt
# unzip

So Unzipping yields a Gradle folder labeled gradle-7.1.1.To confirm that all the Gradle files are in place, run the command:

# ls gradle-7.1.1

Configure the environment variables

We need to set the PATH variable to the Gradle bin directory. So we will create a script file as shown in the directory /etc/profile.d

# vim /etc/profile.d/

Define the path variable as shown

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

Save and exit the Gradle script file. Proceed and assign execute permissions to the Gradle script as shown.

# chmod +x /etc/profile.d/

To apply the changes and notify the shell, use the source command.

# source /etc/profile.d/

Confirm installation of Gradle

The only thing we are left to do is to verify if the installation of Gradle was successful. To achieve this, execute the command:

# gradle -v

The output provides a decent amount of information including the version of Gradle, highlights about the latest release, build time, and versions of Kotlin and Groovy.


We have managed to successfully install the latest version of Gradle on CentOS 8.

unixcop Admin


Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook