How to install Gradle on Ubuntu 20.04 LTS

How To Install Gradle on Ubuntu 20.04 LTS

Gradle is a open-source build tool automation system used primarily for Java projects. It combines the best features of Apache Ant and Apache Maven. Gradle uses a Groovy-based domain-specific language instead of the XML form used by Maven for declaring the project configuration. Gradle supports incremental builds and designed for multi-project builds. Gradle initial relealsed on 2007 or about 13 years ago, and the last stable release on June 30, 2020 with Gradle version 6.5.1.

On this article we will discuss how to install Gradle on Ubuntu 20.04. When this article is being written, we use Gradle version 6.4.1. The Gradle installation will be consist of several steps as described below.

  1. Prerequisite
  2. Download and Exttact The Gradle binary files
  3. Setup Environment Variable
  4. Verify the Gradle installation


Before Gradle installation process we will check the requirement first. We need sufficient space for Gradle binnary files and also root account or and account with sudo privilege. Gradle requires Java JDK or JRE version 7 or above to be installed on the system. Before continuing to the next step, just ensure our Java installed on the system. And if we have no Java installed ye, just install it. For your reference, I have written an article about : How To Install Java (OpenJDK 11) on Ubuntu 20.04 LTS.

ramans@otodiginet:~$ java --version
Gradle required java installed on the system

Download and Extract The Gradle Package

As mentioned above, if on this article we have been using Gradle version 6.4.1. So the download command will be as follow. We will use the /home/ramans directory to accommodate the binnary files.

ramans@otodiginet:~$ wget
Download Gradle binary files from the source

Then we extract the files and move to the /opt/gradle directory.

ramans@otodiginet:~$ sudo mkdir /opt/gradle
ramans@otodiginet:~$ sudo unzip -d /opt/gradle /home/ramans/
Extrax or unzip Gradle downloaded files

Verifying all files are under /opt/gradle directory.

Unzip Gradle source file

Setup Environment Variable

The next step is to configure the PATH environment variable which will be used bu Gradle. We must create a new file named inside the /etc/profile.d/ directory as below.

ramans@otodiginet:/etc/profile.d$ sudo vi /etc/profile.d/

And add the following text inside the file.

export GRADLE_HOME=/opt/gradle/gradle-6.4.1
export PATH=${GRADLE_HOME}/bin:${PATH}
Gradle setup  environment variable
ramans@otodiginet:/etc/profile.d$ sudo chmod +x /etc/profile.d/
ramans@otodiginet:/etc/profile.d$ source /etc/profile.d/

Verify The Gradle installation

After all steps are passed, then we verify the Gradle installation by querying its version, submitting command line as below.

ramans@otodiginet:/etc/profile.d$ gradle --v

The output is as below :

Welcome to Gradle 6.4.1!
Here are the highlights of this release:
Support for building, testing and running Java Modules
Precompiled script plugins for Groovy DSL
Single dependency lock file per project
For more details see

Gradle 6.4.1
Build time: 2020-05-15 19:43:40 UTC
Revision: 1a04183c502614b5c80e33d603074e0b4a2777c5
Kotlin: 1.3.71
Groovy: 2.5.10
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 11.0.7 (Ubuntu 11.0.7+10-post-Ubuntu-3ubuntu1)
OS: Linux 5.4.0-39-generic amd64
gradle --v for verifying Gradle version


So far, the Gradle installation on Ubuntu 20.04 LTS was completed done. For Gradle guidance, please see the Gradle user guide. Have a nice day !!

Share this article via :

Leave a Reply

Your email address will not be published. Required fields are marked *