Site icon DesignLinux

How to Install Gradle on Debian 11

how-to-install-gradle-on-debian-11

Gradle is free and open-source build tool used for the Java projects. It is flexible and helps developers team to automate and build easier and faster software. In this tutorial we will explain how to install Gradle on Debian 11 Bullseye.

How to Install Gradle on Debian 11

Follow the below given steps to install Gradle on Debian 11 system. Before that make sure that you are log in as root or user with sudo privileges.

Step 1 – Updating you system

First of all, you need to ensure that all the packages on your system are up to date. Run the below given command:

sudo apt update && sudo apt upgrade -y

Step 2 – Install Java

The base of the Gradle is Java, so Java JDK must be installed on your system. To install OpenJDK run the following command:

sudo apt install default-jdk -y

The installation process may take some time.

After that, verify the installation of by checking it’s version using below given command:

java -version

The output should look something like this:

openjdk version "11.0.16" 2022-11-17
OpenJDK Runtime Environment (build 11.0.16+8-post-Debian-1deb10u1)
OpenJDK 64-Bit Server VM (build 11.0.16+8-post-Debian-1deb10u1, mixed mode, sharing)

Step 3 – Downloading Gradle

After the installing Java on your system, download the latest Gradle distribution release binary file from its official download page. At the time of writing this tutorial, the latest version of Gradle is 7.6.

Issue the following wget command to download the Gradle binary file:

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

After that extract the zip file to the /opt/gradle directory:

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

To verify that the Gradle files are extracted run below given command:

ls /opt/gradle/gradle-*
bin  init.d  lib  LICENSE  NOTICE  README

The Gradle build tool has been configured on your Debian 11 system.

Step 4 – Setup the Environment Variables

At this state, we will setup Gradle with PATH environment variable to include the Gradle bin directory.

Open your text editor and create a new file with name gradle.sh under the /etc/profile.d directory.

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

Add the following configuration:

export PATH=/opt/gradle/gradle-7.6/bin:$PATH

Save and close the file.

Make the script executable by running the following chmod command:

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

Now source the script to apply environment for current shell.

source /etc/profile.d/gradle.sh

That’s it, Grandle is installed on Debian 11 system.

Step 5 – Verify Gradle Installation

Execute the below given command to verify that Gradle is installed properly by checking it’s version:

gradle -v

It should show something like the following:

Welcome to Gradle 7.6!

...

Conclusion

You successfully learned how to install Gradle on Debian 11, Bullseye. To know more about Gradle visit official Gradle Documentation page.

If you have any question or feedback, please leave a comment below.

Exit mobile version