How To Install Gradle on Ubuntu 18.04 / 16.04, Linux Mint 19 & Debian 9


Gradle is an open-source build automation tool used for Java, Groovy and Scala development. It builds upon the concepts of Apache Ant and Apache Maven. Unlike Apache Maven which uses XML for declaring project configurations, Gradle uses Groovy, a dynamic, object-oriented programming language to define the project configurations.

In this post, we will install Gradle on Ubuntu 18.04 / Ubuntu 16.04, Linux Mint 19 & Debian 9.


Gradle’s only requirement is Java JDK or JRE version 7 or above to be installed.

If you prefer Oracle Java JDK over OpenJDK then follow the post about installation of Oracle Java on Ubuntu 18.04 / 16.04, Linux Mint 19 & Debian 9. Here, I will go with OpenJDK 8.

Update the repository index.

sudo apt update

Install the OpenJDK package by using the apt command.

sudo apt install -y openjdk-8-jdk-headless

Verify the Java installation by executing the following command.

java -version


openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.18.04.1-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

Install other supported packages.

sudo apt install -y wget unzip

Install Gradle on Ubuntu

Download the latest version of Gradle (V5.2.1) from the official site. Download Gradle Binary-only zip file.


Use the below command in terminal to download Gradle v5.2.1.

cd /tmp

Extract the downloaded zip file in the /opt/gradle directory.

unzip gradle-*.zip

Extract zipped package using unzip command.

sudo mkdir /opt/gradle
sudo cp -pr gradle-*/* /opt/gradle

Verify the extracted files by listing the /opt/gradle/ directory.

ls /opt/gradle/


LICENSE  NOTICE  bin  getting-started.html  init.d  lib  media

Setup environment variables

We will now configure the PATH environment variable to include the Gradle’s bin directory. To do that, create a new file named inside of the /etc/profile.d/ directory.

sudo nano /etc/profile.d/

Paste the following configuration:

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

Save and close the file.

Make the script executable by using the chmod command.

sudo chmod +x /etc/profile.d/

Load the environment variables for the current session by using the following command.

source /etc/profile.d/

Verify the Gradle installation

To validate the Gradle installation, use the below command.

gradle -v


Welcome to Gradle 5.2.1!

Here are the highlights of this release:
 - Define sets of dependencies that work together with Java Platform plugin
 - New C++ plugins with dependency management built-in
 - New C++ project types for gradle init
 - Service injection into plugins and project extensions

For more details see

Gradle 5.2.1

Build time:   2019-02-08 19:00:10 UTC
Revision:     f02764e074c32ee8851a4e1877dd1fea8ffb7183

Kotlin DSL:   1.1.3
Kotlin:       1.3.20
Groovy:       2.5.4
Ant:          Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM:          1.8.0_191 (Oracle Corporation 25.191-b12)
OS:           Linux 4.15.0-1027-gcp amd64


You have successfully installed Gradle (v5.2.1) on your Ubuntu 18.04 / Ubuntu 16.04, Linux Mint 19 & Debian 9. You can go to the official Gradle Documentation page to learn how to get started with Gradle.

You might also like