How To Install Gradle On Ubuntu

Source –

Gradle is a free and open source automation toolset based on Apache Ant and Apache Maven and builds support for development lifecycle. It uses domain specific language rather than XML form for project configuration. This tutorial explains the installation procedure of Gradle on Ubuntu.

Installation procedure

To start the installation procedure, first update the system repositories using the apt-get update command.

root@linuxhelp1:~# apt-get update
Hit:1 xenial-security InRelease
Hit:2 xenial InRelease
Hit:3 xenial-updates InRelease
Hit:4 xenial-backports InRelease
Reading package lists... Done

The Gradle requires Java Development Kit version 7 or higher version to be installed. So use the below command to install JDK version 8.

root@linuxhelp1:~# apt-get install openjdk-8-jdk -y
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following additional packages will be installed:
  ca-certificates-java fonts-dejavu-extra java-common libbonobo2-0 libbonobo2-common libgif7 libgnome-2-0 libgnome2-common libgnomevfs2-0 libgnomevfs2-common libice-dev
  liborbit-2-0 libpthread-stubs0-dev libsm-dev libx11-dev libx11-doc libxau-dev libxcb1-dev libxdmcp-dev libxt-dev openjdk-8-jdk-headless openjdk-8-jre openjdk-8-jre-headless
  x11proto-core-dev x11proto-input-dev x11proto-kb-dev xorg-sgml-doctools xtrans-dev
Suggested packages:
  default-jre libbonobo2-bin desktop-base libgnomevfs2-bin libgnomevfs2-extra gamin | fam gnome-mime-data
Adding debian:NetLock_Notary_=Class_A=_Root.pem
Adding debian:Visa_eCommerce_Root.pem
Adding debian:PSCProcert.pem
Adding debian:QuoVadis_Root_CA_1_G3.pem
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Processing triggers for ca-certificates (20160104ubuntu1) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...

After installing Java check its version by running the following command.

root@linuxhelp1:~# java -version
openjdk version "1.8.0_121"
OpenJDK Runtime Environment (build 1.8.0_121-8u121-b13-0ubuntu1.16.04.2-b13)
OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)

Next download the package for gradle using the below command.

root@linuxhelp1:~# wget
--2017-04-06 18:00:22--
Resolving (,,, ...
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: [following]
--2017-04-06 18:00:23--
Resolving (,,, ...
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 70310446 (67M) [application/zip]
Saving to: ‘’                          100%[===============================================================================================>]  67.05M   987KB/s    in 90s     
2017-04-06 18:01:53 (763 KB/s) - ‘’ saved [70310446/70310446]

Now to install gradle inside /opt/ directory, create a directory for gradle inside /opt/ by running the following command.

root@linuxhelp1:~# mkdir /opt/gradle

Extract the package directly into /opt/gradle/ directory.

root@linuxhelp1:~# unzip -d /opt/gradle
   creating: /opt/gradle/gradle-3.4.1/
  inflating: /opt/gradle/gradle-3.4.1/LICENSE 
   creating: /opt/gradle/gradle-3.4.1/media/
  inflating: /opt/gradle/gradle-3.4.1/media/gradle-icon-16x16.png 
  inflating: /opt/gradle/gradle-3.4.1/media/gradle-icon-24x24.png 
  inflating: /opt/gradle/gradle-3.4.1/media/gradle.icns 
  inflating: /opt/gradle/gradle-3.4.1/media/gradle-icon-512x512.png 
  inflating: /opt/gradle/gradle-3.4.1/media/gradle-icon-32x32.png 
  inflating: /opt/gradle/gradle-3.4.1/media/gradle-icon-128x128.png 
  inflating: /opt/gradle/gradle-3.4.1/media/gradle-icon-64x64.png 
  inflating: /opt/gradle/gradle-3.4.1/media/gradle-icon-256x256.png
  inflating: /opt/gradle/gradle-3.4.1/lib/plugins/xml-apis-1.3.04.jar 
  inflating: /opt/gradle/gradle-3.4.1/lib/plugins/plexus-component-annotations-1.5.5.jar 
  inflating: /opt/gradle/gradle-3.4.1/lib/plugins/hamcrest-core-1.3.jar 
  inflating: /opt/gradle/gradle-3.4.1/lib/gradle-version-info-3.4.1.jar

To configure path environment variable, run the following command and execute the variable.

root@linuxhelp1:~# export PATH=$PATH:/opt/gradle/gradle-3.4.1/bin

Now gradle is installed on the target machine. Verify it’s version using the below command.

root@linuxhelp1:~# gradle -v
Gradle 3.4.1
Build time:   2017-03-03 19:45:41 UTC
Revision:     9eb76efdd3d034dc506c719dac2955efb5ff9a93
Groovy:       2.4.7
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.8.0_121 (Oracle Corporation 25.121-b13)
OS:           Linux 4.4.0-21-generic amd64

Wasn’t that an easy installation? Gradle is designed to use multi project builds that can grow to a substantial size.

Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x