Install Gradle on Ubuntu 18.04 / Debian 9 / Ubuntu 16.04 from PPA

(: December 3, 2018)

Welcome to our guide on How to install Gradle on Ubuntu 18.04 / Debian 9 / Ubuntu 16.04. Gradle is an open-source build automation tool that is focused on performance, speed and flexibility. Gradle build scripts are written using a Groovy or Kotlin domain-specific language.

Gradle has been designed to be highly customizable and extensible. It is able to achieve higher speeds by executing tasks in parallel, re-using results from previous executions and processing only inputs that changed.

Install Gradle on Ubuntu 18.04 / Debian 9 / Ubuntu 16.04

This guide will take your through all the steps to install the latest release of Gradle on Ubuntu 18.04 / Debian 9 / Ubuntu 16.04.{text-align:left} img{margin:0 auto 0 0}

Step 1: Install Pre-requisites

Gradle requires Java JRE or OpenJDK to function. If you don’t have Java installed, use our guide below:

How to Install Java 11 on Ubuntu 18.04 /16.04 / Debian 9

Check if your Java has been installed by querying for the version:

$ java --version
openjdk 11.0.1 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)

Step 2: Download and Install Gradle

Once you have Java installed, the next step is to download and install Gradle. The latest release of Gradle can be checked from the link.

Install Gradle on Ubuntu 18.04/16.04 from PPA Repository

We will use a PPA repository to install Gradle on Ubuntu 18.04/16.04 for easy updates and management.

Add PPA repository to your system by running the following commands:

sudo apt -y install vim apt-transport-https dirmngr wget software-properties-common
sudo add-apt-repository ppa:cwchien/gradle

Update system and install Gradle

sudo apt-get update
sudo apt -y install gradle

Install Gradle on Debian 9 from PPA Repository

For Debian 9, install the following packages:

sudo apt -y install vim apt-transport-https dirmngr wget software-properties-common

Then import GPG key:

sudo apt-key adv --keyserver --recv-keys D7CC6F019D06AF36

You should receive output similar to below

Executing: /tmp/apt-key-gpghome.eGRTsZJki3/ --keyserver --recv-keys D7CC6F019D06AF36
gpg: key D7CC6F019D06AF36: public key "Launchpad PPA for Cheng-Wei Chien" imported
gpg: Total number processed: 1
gpg:               imported: 1

Once key is imported, add PPA repository

sudo add-apt-repository ppa:cwchien/gradle

Update your Debian 9 package list

$ sudo apt update
Hit:1 stretch-backports InRelease
Ign:4 sarge InRelease                                                                                  
Get:2 disco InRelease [15.4 kB]
Hit:5 sarge Release                      
Get:6 disco/main amd64 Packages [740 B]  
Ign:3 stretch InRelease                               
Hit:8 stretch Release
Fetched 16.1 kB in 3s (4351 B/s)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.

Finally install Gradle by running:

sudo apt install gradle

Verify the version of Gradle installed on your Ubuntu 18.04 / Ubuntu 16.04 & Debian 9 system.

$ gradle --version

Gradle 5.0

Build time:   2018-11-26 11:48:43 UTC
Revision:     7fc6e5abf2fc5fe0824aec8a0f5462664dbcd987

Kotlin DSL:   1.0.4
Kotlin:       1.3.10
Groovy:       2.5.4
Ant:          Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM:          11.0.1 (Oracle Corporation 11.0.1+13)
OS:           Linux 4.9.0-8-amd64 amd64

You have successfully installed Gradle on Ubuntu 18.04 / Debian 9 / Ubuntu 16.04 from PPA repository. Kudos!.{text-align:left} img{margin:0 auto 0 0}

Related Posts