How To Set up Gradle on Ubuntu 20.04

In this guide, we want to teach you How To Set up Gradle on Ubuntu 20.04.

Let’s see a brief look at what Gradle is.

What is Gradle?

Gradle is a build automation tool known for its flexibility to build software. A build automation tool is used to automate the creation of applications. The building process includes compiling, linking, and packaging the code. The process becomes more consistent with the help of build automation tools.

It is popular for its ability to build automation in languages like Java, Scala, Android, C/C++, and Groovy. The tool supports groovy-based Domain Specific Language over XML. Gradle provides building, testing, and deploying software on several platforms.

The tool is popular for building any software and large projects. Gradle includes the pros of Ant and Maven and curbs the cons of both.

How To Set up Gradle on Ubuntu 20.04

Before you start to install Gradle on Ubuntu 20.04, you need to log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide the Initial Server Setup with Ubuntu 20.04.

Now follow the steps below to install the latest release of Gradle from their official website.

Install OpenJDK on Ubuntu 20.04

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

First, update your local package index with the following command:

sudo apt update

Then, install OpenJDK 11 on your server with the command below:

sudo apt install openjdk-11-jdk

Verify your Java installation by checking its version:

java -version
openjdk version "11.0.15" 2022-04-19
OpenJDK Runtime Environment (build 11.0.15+10-Ubuntu-0ubuntu0.20.04.1)
OpenJDK 64-Bit Server VM (build 11.0.15+10-Ubuntu-0ubuntu0.20.04.1, mixed mode, sharing)

Install Gradle on Ubuntu 20.04

At this point, you need to visit the Gradle Downloads page and check for the latest release of the Gradle.

Download the Gradle with the wget command on your server:


Then, make a directory for your Gradle in the opt directory on Ubuntu 20.04:

mkdir /opt/gradle

Next, unzip your downloaded file in the Gradle directory:

unzip -d /opt/gradle

To have more control over versions and updates, you can create a symbolic link named latest, which points to the Gradle installation directory:

sudo ln -s /opt/gradle/gradle-7.4.2 /opt/gradle/latest

At this point, you need to add the Gradle bin directory to the system PATH environment variable. To do this, create a new file with your favorite text editor inside of the /etc/profile.d/ directory:

sudo vi /etc/profile.d/

Add the following content to the file:

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

When you are done, save and close the file.

Now make your file executable:

sudo chmod +x /etc/profile.d/

Load the environment variables in the current shell session using the source command

source /etc/profile.d/

At this point, you can verify your Gradle installation on Ubuntu 20.04 by checking its version:

gradle -v
Welcome to Gradle 7.4.2!

Here are the highlights of this release:
- Aggregated test and JaCoCo reports
- Marking additional test source directories as tests in IntelliJ
- Support for Adoptium JDKs in Java toolchains

For more details see

Gradle 7.4.2

Build time: 2022-03-31 15:25:29 UTC
Revision: 540473b8118064efcc264694cbcaa4b677f61041

Kotlin: 1.5.31
Groovy: 3.0.9
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 11.0.15 (Private Build 11.0.15+10-Ubuntu-0ubuntu0.20.04.1)
OS: Linux 5.4.0-29-generic amd64

That’s it. You have installed the latest version of Gradle on your Ubuntu system, and you can start using it.


At this point, you learn to Set up Gradle on Ubuntu 20.04.

Hope you enjoy it.

You may be interested in these articles on the orcacore website:

How To Set up VNC on Ubuntu 20.04

How To Install PHP 8.1 on Ubuntu 20.04

Set up Python 3.10 on Ubuntu 20.04

Install Ntopng on Ubuntu 20.04

Related Articles


Please enter your comment!
Please enter your name here

Latest Articles


Most Popular