Signup/Sign In

How to Install Gradle on Ubuntu 18.04


Gradle is a multi-purpose build tool that's mostly used for Java applications. It combines Ant and Maven's greatest features. Gradle's scripting language is Groovy, rather than XML.

We'll teach you how to install the newest version of Gradle on Ubuntu 18.04 LTS / Ubuntu 16.04 LTS in this article.


To install Gradle, you'll need to be signed in as a user with sudo access.

1. Download and install OpenJDK

Gradle needs the installation of Java JDK or JRE version 7 or above. To install OpenJDK 8, use the command below.

sudo apt-get update
apt install openjdk-8-jdk $ sudo apt install openjdk-8-jdk –

Run the following command to see whether Java was successfully installed:

$ java -version
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-0ubuntu0.18.04.1-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)

2. Install Gradle

Visit the Gradle releases page to get the most recent version of Gradle. To download the Gradle zip file to the /tmp directory, use the wget command:

wget $ -P /tmp –

After the download is finished, unpack the zip file into the /opt/gradle directory as follows:

unzip -d /opt/gradle /tmp/gradle-*.zip $ sudo unzip -d /opt/gradle /tmp/gradle-*.zip

3. Configure the variables in the environment

To include the Gradle bin location in the PATH environment variable. As seen below, create a new file called in the /etc/profile.d/ directory.

$ sudo vi /etc/profile.d/
export GRADLE_HOME=/opt/gradle/gradle-6.4.1
export PATH=${GRADLE_HOME}/bin:${PATH}

Use the following command to load the environment variables:

/etc/profile.d/ $ source

4. Double-check your Gradle installation

To check whether Gradle is installed correctly, use the gradle -v command, which will show you the Gradle version:

$ gradle -v
Welcome to Gradle 6.4.1!

Here are the highlights of this release:
 - Java 14 support
 - Improved error messages for unexpected failures

For more details see

Gradle 6.4.1

Build time:   2020-03-24 19:52:07 UTC
Revision:     bacd40b727b0130eeac8855ae3f9fd9a0b207c60

Kotlin:       1.3.70
Groovy:       2.5.10
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          11.0.6 (Oracle Corporation 11.0.6+10-LTS)
OS:           Linux 4.18.0-80.11.2.el8_0.x86_64 amd64


Gradle has been installed successfully on Ubuntu 18.04 LTS / Ubuntu 16.04 LTS.

About the author:
Pradeep has expertise in Linux, Go, Nginx, Apache, CyberSecurity, AppSec and various other technical areas. He has contributed to numerous publications and websites, providing his readers with insightful and informative content.