×


Gradle Installation and Configuration on Linux

Gradle is basically a build automation tool for multi-language software development. It helps teams to build, automate and deliver better software with efficiency in mind.
Here at Ibmi Media, we regularly help our Customers to perform Software Installation on their servers as part of our Server Management Services.

In this context, we shall look into the steps to take to install and configure Gradle on Linux and Windows system.

How to install Gradle on a Linux server?

To start with Gradle installation, you need to log into your server via an ssh tool such as putty and create a directory for it by executing the following command;

mkdir /opt/gradle


Next, download Gradle binary by running the command below;

curl -L https://services.gradle.org/distributions/gradle-6.5-bin.zip --output gradle.zip


Note that this command will download Gradle version 6.5. You can download newer versions as well.

Now, unzip the downloaded zipped file into the directory "/opt/gradle" by running the command;

unzip -d /opt/gradle/ gradle.zip


How to configure Linux environment for Gradle?

To make the Gradle command accessible run the following command to add a "gradle.sh" file to "/etc/profile.d" to include Gradle in the system PATH variable:

echo PATH=$PATH:/opt/gradle/gradle-6.5/bin > /etc/profile.d/gradle.sh


Finally, source the newly created gradle.sh file to update the PATH environment variable:

source /etc/profile.d/gradle.sh


To verify the installation, run the following command:

gradle -v


You will see an output such as;

------------------------------------------------------------
Gradle 6.5
------------------------------------------------------------
Build time: 2020-06-02 20:46:21 UTC
Revision: a27f41e4ae5e8a41ab9b19f8dd6d86d7b384dad4
Kotlin: 1.3.72
Groovy: 2.5.11
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 11.0.7 (Ubuntu 11.0.7+10-post-Ubuntu-2ubuntu218.04)
OS: Linux 4.15.0-91-generic amd64


This means that Gradle installation is successful.

How to install Gradle on Windows?

To start with, you need to download the Latest version of Gradle.
Start by opening up a command prompt and creating a directory for Gradle as shown below:

mkdir C:\Gradle


Then, Download Gradle into the newly created Gradle directory by running the following curl command:

curl -L https://services.gradle.org/distributions/gradle-6.5-bin.zip --output C:\Gradle\gradle.zip


Next, open an instance of File Explorer and navigate to the C:\Gradle directory.

Now, extract the gradle.zip file by right-clicking the file and selecting “Extract All…”.

Before hitting the Extract button, adjust the path to extract the files directly to the Gradle directory. Once it does, hit the Extract button:



Configure Environment in Windows

After the Gradle installation, it is time to set up the Environmental Variable for it. Right-click "This PC" in the File Explorer and select "Properties".

To do this, in the System menu, select Advanced system settings. Then in the System Properties dialog hit the "Environment Variables…" button.

Find "Path" under the "System variables" header and select it and hit the "Edit" button.

After that, hit the “New” button enter C:\Gradle\gradle-6.5\bin then hit the “OK” button to save the new variable.

How to Verify Gradle Installation on Windows?

To verify that Gradle has been installed and is available, close the current command prompt, open a new one, and run the following command:

gradle -v


You will get an output such as this;

Welcome to Gradle 6.5!
Here are the highlights of this release:
- Experimental file-system watching
- Improved version ordering
- New samples
For more details see https://docs.gradle.org/6.5/release-notes.html

------------------------------------------------------------
Gradle 6.5
------------------------------------------------------------

Build time: 2020-06-02 20:46:21 UTC
Revision: a27f41e4ae5e8a41ab9b19f8dd6d86d7b384dad4
Kotlin: 1.3.72
Groovy: 2.5.11
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 14.0.1 (Oracle Corporation 14.0.1+7)
OS: Windows Server 2019 10.0 amd64


[Need More help to install Gradle on Linux or Windows? – We are available to help you today]


Conclusion

This guide will show the steps to install and configure Gradle on Linux and Windows.