Install Gradle on Ubuntu

January 30, 2016 by Sandeep Bhardwaj | Tags:


1) Download the latest Gradle version from Gradle Download page.

2) Extract the binaries to the desired location.

3) Set the GRADLE_HOME environment variable.

Setting the environment variable in Ubuntu in really easy, just need to edit the /etc/profile. Just add your gradle installation directory as below.

Open the /etc/profile file in your favorite editor.

sudo gedit /etc/profile

Add below lines in end.

GRADLE_HOME=/data/dev/tools/gradle-2.10
PATH=$PATH:$GRADLE_HOME/bin
export GRADLE_HOME
export PATH

Verify the GRADLE_HOME

echo $GRADLE_HOME

Verify the Gradle version

gradle -v

Output

------------------------------------------------------------
Gradle 2.10
------------------------------------------------------------

Build time:   2015-12-21 21:15:04 UTC
Build number: none
Revision:     276bdcded730f53aa8c11b479986aafa58e124a6

Groovy:       2.4.4
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM:          1.8.0_60 (Oracle Corporation 25.60-b23)
OS:           Linux 3.19.0-47-generic amd64

Set GRADLE_USER_HOME on Ubuntu

Next if you wants to override the default location of gradle local repository.

Again edit the /etc/profile like we did it above and add below line in the end.

export GRADLE_USER_HOME=/data/dev/repository/gradle