# How to install Gradle on Debian 10?

{% embed url="<https://youtu.be/Q6I9zaXwJaM>" %}

### **Overview** <a href="#howtoinstallgradleondebian10-introduction" id="howtoinstallgradleondebian10-introduction"></a>

Gradle is a build automation tool that is used to create a variety of applications, including microservices and mobile apps. Applications may be built, tested, and maintained using the Gradle framework. Furthermore, if you are working on a multi-build project, Gradle continuously checks your work to see whether you have made any changes.

This tutorial explains you how to setup Gradle on Debian 10.

### **Prerequisites** <a href="#howtoinstallgradleondebian10-prerequisites" id="howtoinstallgradleondebian10-prerequisites"></a>

There are certain prerequisites that need to be met before you begin.&#x20;

* A machine running Debian 10
* A root user having Sudo privileges
* Internet connection

### **Get Started** <a href="#howtoinstallgradleondebian10-step1.installingopenjdk" id="howtoinstallgradleondebian10-step1.installingopenjdk"></a>

#### **Step 1. Installing OpenJDK** <a href="#howtoinstallgradleondebian10-step1.installingopenjdk" id="howtoinstallgradleondebian10-step1.installingopenjdk"></a>

* Always be sure to update your system before downloading the latest packages. Run the following command to do it:

```
sudo apt update
```

* Since Java is a prerequisite for Gradle, we will first install the most recent version of Java that is accessible in the default repository. Type the following command to set up the OpenJDK package:

```
sudo apt install default-jdk
```

* Run the below command to check the Java version installed:

```
java -version
```

![](https://customer.acecloudhosting.com/index.php?rp=/images/kb/1569_1.-Gradle.png)

#### **Step 2. Downloading Gradle** <a href="#howtoinstallgradleondebian10-step2.downloadinggradle" id="howtoinstallgradleondebian10-step2.downloadinggradle"></a>

You should go through the [Gradle releases page ](https://gradle.org/releases/)to determine whether a newer version is accessible.<br>

* Use the wget command to get the Gradle binary file:

```
wget https://services.gradle.org/distributions/gradle-6.3-bin.zip -P /tmp
```

* Unzip the zip file in the /opt/gradle directory when the download is completed.

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

* Make sure the Gradle files have been extracted by checking with the following command:

```
ls /opt/gradle/gradle-*
```

![](https://customer.acecloudhosting.com/index.php?rp=/images/kb/1570_2.-Gradle.png)

#### **Step 3. Environment Variables Configuration** <a href="#howtoinstallgradleondebian10-step3.environmentvariablesconfiguration" id="howtoinstallgradleondebian10-step3.environmentvariablesconfiguration"></a>

* The Gradle bin directory must be included in the PATH environment variable, which needs to be configured next. To achieve this, launch your text editor and make a new file called gradle.sh inside the /etc/profile.d directory.

```
sudo nano /etc/profile.d/gradle.sh
```

* Paste the following lines as shown below in the /etc/profile.d/gradle.sh:

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

Save and exit the file. This script will be loaded when the shell launches.

* Run the chmod command to modify the file's access mode, allowing it to be read-only or write-only:

```
sudo chmod +x /etc/profile.d/gradle.sh
```

* The environment variables that we specified for Gradle in the present environment must be initialised. Run the following command to do so:

```
source /etc/profile.d/gradle.sh
```

#### **Step 4. Checking Gradle Installation** <a href="#howtoinstallgradleondebian10-step4.checkinggradleinstallation" id="howtoinstallgradleondebian10-step4.checkinggradleinstallation"></a>

* Run the command below, which will show the Gradle version, to make sure Gradle is installed correctly:

```
gradle -v
```

![](https://customer.acecloudhosting.com/index.php?rp=/images/kb/1571_3.-Gradle.png)

Gradle has been successfully installed on your Debian 10 system, and you can now use it.

### **Conclusion** <a href="#howtoinstallgradleondebian10-conclusion" id="howtoinstallgradleondebian10-conclusion"></a>

In this tutorial, we have successfully mastered the steps required to install Gradle on Debian 10 as well as all the necessary commands.
