How to install Gradle on Debian 11

What is Gradle?

Gradle is a building tool that is used in the development of different applications. It provides not only the development aid but also, management of required libraries, deployment, testing, publishing, and notifications of the application at different platforms.

Gradle has the same concepts as the apache maven and ant, but in an advanced form, and unlike the apache maven, Gradle uses the Groovy, which is a DSL(Domain Specific Language), to write its script instead of XML which increases its speed. Compatible languages to the Gradle are Java, Javascript, and also C/C++.

Let’s take the example of Java. Gradle makes it easy to make custom plugins to compact your own ideas by simply adding a layer of prebuilt functionality through plugins. It is a popular tool because of its flexibility and ease of use, even on large-scale projects.

This write-up will explain the procedure for the installation of Gradle on Debian 11 which is the latest version of Debian, which is the distribution of Linux.

How to install Gradle on Debian 11?

Installation of Gradle on Debian 11 is very simple, you have to run a few simple commands in the terminal of Debian 11. The commands can be run either in the root or by using the sudo keyword to access the root user privileges.

Step 1: Update the repository

It is recommended to update the repository of Debian 11 once before using it so it can update the latest version of packages. To update execute the following command:

$ sudo apt update

It is confirmed that all the packages are up to date.

Step 2: Installation of Java

Gradle requires Java as the prerequisite, so to install Java we will run the following command.

$ sudo apt install default-jdk

Once the installation is complete and to verify the installation of java, check the version of Java by command:

$ java -version

The output is showing the version details of java which is an indication of the successful installation of java.

Step 3: Downloading of Gradle

The latest version is released on 20 august 2021, which is 6.9.1 and can find out the details of the latest version of Gradle by visiting its official home page. We can download Gradle binary files in the form of Zip, with the help of the wget command.

$ wget -P /tmp

The downloading will take some time, once it is finished, extract the zip file in the directory of path /opt/gradle/ by using the unzip command:

$ sudo unzip -d /opt/gradle /tmp/

To verify the file has been unzipped, list down the path /opt/gradle by using the ls command.

$ ls /opt/gradle

The blue color of the folder name shows that it has been unzipped, also the extension of .zip has vanished because the file is now unzipped.

Step 4: To set up environment variables

After the successful unzipping of the Gradle installation file, we will configure the PATH with the help of environment variables, to include the Gradle bin directory. For this purpose, we will create and open the file with the nano text editor, with the name of “” in the /etc/profile.d directory.

 $ sudo nano /etc/profile.d/

Now we will add the following text for the configuration of Gradle.

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

Press CTRL+S to save the file and then CTRL + X.

Step 5: Change the access permissions of the file

After the configuration of the Gradle file, we have to change the access permissions of the file with the help of the chmod command, so it can be executable.

$ sudo chmod +x /etc/profile.d/

The permissions to access have been changed.

Step 6: installation of Gradle file

Once the access permissions are changed, we will load the environment variables using the source command to install the Gradle file.

$ source /etc/profile.d/

The successful loading of the environment variables shows that Gradle 6.9.1 has been installed on Debian 11.

Step 7: Verification of the installation

After the completion of the installation, we will verify the installation by checking its version.

$ gradle -version

The output is displaying the version details of the Gradle along with some highlights of its new version.


Gradle is the tool used to build the applications, it was launched in 2007 and is faster, powerful, and customizable than Ant, and Maven. Gradle is a much-improved tool than the previous tools used for build purposes like Apache Ant, Apache Maven, Grunt, and Gulp. This write-up discussed a method to install Gradle on Debian 11, simply installing the java and downloading the zip file from the official website of Gradle. Once the zip file is downloaded, make its configuration file, load it to install the Gradle 6.9.1, and then in the end validates the installation by checking its version.