How To Install Gradle on Debian 11 / Debian 10

Install Gradle on Debian 11
Install Gradle on Debian 11

Gradle is an open-source tool for build automation Java, Groovy, and Scala development. It relies on the concepts of Ant and Maven to automate the building process.

Unlike Apache Maven which relies on XML data files for declaring project configurations, Gradle uses Groovy, a dynamic programming language that defines project configurations.

In this post, we will install Gradle on Debian 11 / Debian 10.

Install JDK

Gradle’s only requirement is Java JDK version 8 or higher. So, install either OpenJDK or Oracle JDK.

Here, for the demo, we will use OpenJDK v11.

sudo apt update
sudo apt install -y default-jdk

Verify the Java installation by executing the following command.

java -version


openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment (build 11.0.12+7-post-Debian-2)
OpenJDK 64-Bit Server VM (build 11.0.12+7-post-Debian-2, mixed mode, sharing)

Install other required packages.

sudo apt install -y curl unzip

Install Gradle

Download the latest version of the Gradle (v7.2) –  Binary-only zip file from the official site.


Use the below command in the terminal to download the Gradle (v7.2) package.

cd /tmp
curl -O

Then, extract the package using the unzip command.

unzip gradle-*.zip

Move the contents to /opt/gradle directory.

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

Verify the Gradle’s directory.

ls /opt/gradle/


bin  init.d  lib  LICENSE  NOTICE  README

Configure System Environment

We will now configure the PATH environment variable to include Gradle’s bin directory. To do that, execute the below command. If needed, replace the Gradle’s bin path with your Gradle’s directory.

echo "export PATH=/opt/gradle/bin:${PATH}" | sudo tee /etc/profile.d/

Make the script executable with chmod command.

sudo chmod +x /etc/profile.d/

Load the environment variables onto your current session by running the following command.

source /etc/profile.d/

Verify Gradle installation

To validate the Gradle installation, use the below command.

gradle -v


Welcome to Gradle 7.2!
Here are the highlights of this release:
 - Toolchain support for Scala
 - More cache hits when Java source files have platform-specific line endings
 - More resilient remote HTTP build cache behavior
For more details see

Gradle 7.2
Build time:   2021-08-17 09:59:03 UTC
Revision:     a773786b58bb28710e3dc96c4d1a7063628952ad
Kotlin:       1.5.21
Groovy:       3.0.8
Ant:          Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM:          11.0.12 (Debian 11.0.12+7-post-Debian-2)
OS:           Linux 5.10.0-8-amd64 amd64


That’s All. You have successfully installed Gradle on Debian 11 / Debian 10. You can go to the official Gradle Documentation page to learn how to get started with Gradle.

You might also like