How To Install Gradle on Ubuntu 20.04 LTS

Install Gradle on Ubuntu 20.04

In this tutorial, we will show you how to install Gradle on Ubuntu 20.04 LTS. For those of you who didn’t know, Gradle is a general-purpose build tool used primarily for Java projects. It combines the best features of Ant and Maven. Gradle uses Groovy instead of using XML for scripting.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and, most importantly, host your site on your own VPS. The installation is quite simple and assumes you are running in the root account. If not, you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Gradle on the Ubuntu 20.04 LTS (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian-based distribution like Linux Mint.


  • A server running one of the following operating systems: Ubuntu 20.04, 18.04, 16.04, and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Gradle on Ubuntu 20.04 LTS Focal Fossa

Step 1. First, make sure that all your system packages are up-to-date by running the following aptcommands in the terminal.

sudo apt update
sudo apt upgrade

Step 2. Installing Java.

Gradle requires Java to be installed on your server. So first of all, Make sure you have Java installed on your system:

sudo add-apt-repository ppa:linuxuprising/java

Once the repository is added, proceed to install Java on Ubuntu Linux:

sudo apt update
sudo apt install oracle-java14-installer

Then, type below to confirm the Java version:

$ java --version

Step 3. Installing Gradle on Ubuntu 20.04.

Run the commands to download the latest Gradle distribution release binary file from its official download page. At the time of writing this tutorial:

wget -P /tmp

Then, extract the downloaded archive using the following command:

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

Step 4. Setup Environment Variables.

To configure the PATH environment variable to include the Gradle bin directory. create a new file named inside the /etc/profile.d/ directory as below:

sudo nano /etc/profile.d/

Paste the following configuration:

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

Finally, load the environment variables using the following command:

source /etc/profile.d/

Step 5. Verify the Gradle installation.

Finally, to verify if Gradle is installed properly use the gradle -v a command which will display the Gradle version:

$ gradle -v

Welcome to Gradle 6.5!

Here are the highlights of this release:
 - Experimental file-system watching
 - Improved version ordering
 - New samples

For more details see

Gradle 6.5

Build time:   2020-07-14 15:46:21 UTC
Revision:     a27f41e4ae5e8agamad6d86d7b3mona4

Kotlin:       1.3.72
Groovy:       2.5.11
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          12.0.7 (Ubuntu 11.0.7+10-post-Ubuntu-3ubuntu1)
OS:           Linux 5.4.0-33-generic amd64

Congratulations! You have successfully installed Gradle. Thanks for using this tutorial for installing Gradle on Ubuntu 20.04 LTS Focal Fossa system. For additional help or useful information, we recommend you to check the official Gradle website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!


r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button