How to Install Gradle on Ubuntu 20.04

How to Install Gradle on Ubuntu 20.04

Gradle is a general purpose tool used to build, automate, and deliver software. This is mainly used for Java, C ++, and Swift projects.

Gradle combines the best features of Ant and Maven. Unlike its predecessor, which uses XML for scripts, Gradle uses Groovy, a dynamic object-oriented programming language for the Java platform to define projects and build scripts.

This guide explains how to install Gradle on Ubuntu 20.04. We will download the latest Gradle release from their official website.


The instructions assume that you are logged in as root or as a user with sudo privileges.

Install OpenJDK

Gradle requires Java SE 8 or newer to be installed on the machine.

Enter the following command to install OpenJDK 11:
sudo apt update
sudo apt install openjdk-11-jdk

Verify the Java installation by printing a Java version:

java -version

The output will look like this:

openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-3ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-3ubuntu1, mixed mode, sharing)

Downloading Gradle

At the time of writing this article, the latest version of Gradle is 6.5.1. Before proceeding with the next step, check the Gradle release page to see if a newer version is available.

Download the binary Gradation zip file only in the / tmp directory using the following wget command:
wget${VERSION} -P /tmp

After the download is complete, open the zip file in the / opt / gradle directory:

sudo unzip -d /opt/gradle /tmp/gradle-${VERSION}

Gradle is regularly updated with security patches and new features. To have more control over versions and updates, we will create a symbolic link with the latest name, which points to the Gradle installation directory:

sudo ln -s /opt/gradle/gradle-${VERSION} /opt/gradle/latest

Then, when upgrading Gradle, open a newer version and change the symlink to direct it.

Setting up Environmental Variables

We need to add the Gradle Trash directory to the PATH environment variable system. To do this, open your text editor and create a new file named in the /etc/profile.d/ directory.

sudo nano /etc/profile.d/

Paste the following configuration:

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

Save and close the file. This script will be sourced from the startup shell.

Make the script executable:

sudo chmod +x /etc/profile.d/

Load the environment variable in the current shell session using the source command:

source /etc/profile.d/

Verifying Gradle Installation

To validate that Gradle is installed correctly, use the gradle -v command which will display the Gradle version:

gradle -v

You should see something like the following:

Output :

Welcome to Gradle 6.5.1!

Here are the highlights of this release:
 - Experimental file-system watching
 - Improved version ordering
 - New samples

For more details see

Gradle 6.5.1

Build time:   2020-06-30 06:32:47 UTC
Revision:     66bc713f7169626a7f0134bf452abde51550ea0a

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-3ubuntu1)
OS:           Linux 5.4.0-26-generic amd64

There she is. You have installed the latest version of Gradle on your Ubuntu system, and you can start using it.


We have shown you how to install Gradle on Ubuntu 20.04. You can now visit the official Gradle Documentation page and learn how to get started with Gradle.

If you experience problems or get feedback, leave a comment below.

Related posts

How to Install and Configure Fail2ban on Ubuntu 20.04


How to install Linux Kernel 5.7 on Ubuntu


How to install Chef Server and Chef Client on Ubuntu 20.04


How to Install Xrdp Server (Remote Desktop) on Ubuntu 20.04


How to delete a Terminal on Ubuntu and other Linux distributions


How to Install the Open Source Computer Vision Library (OpenCV) on CentOS 8


How to Install Laravel on Ubuntu 20.04


How to use BleachBit on Linux


How to Install the ElkArte Forum Software on Ubuntu 20.04