Install Gradle on Debain 11
Gradle is a build automation tool for multi-language software development. It controls the development process in the tasks of compilation and packaging to testing, deployment, and publishing. Supported languages include Java, C/C++, and JavaScript.
In this article we will show you how to install gradle on debian 11 system.
Also Read -> How to Install JAVA on Debian 11
Step 1: Install Java
Before installing java, make sure your system is up to date by using apt
sudo apt update
Gradle requires Java JDK version 8 or higher. you can install openjdk or oracle jdk
sudo apt install default-jdk
check java version by following command
java --version
output:
openjdk 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)
Also Read -> How to Install LAMP stack on Debian 11
Step 2: download and install Gradle
you can download latest version of gradle from official page using wget or curl.
wget https://downloads.gradle-dn.com/distributions/gradle-7.2-bin.zip
once it is downloaded, extract it and move to opt directory.
unzip gradle-7.2-bin.zip
mv gradle-7.2 /opt/gradle
now verify gradle directory using ls command.
ls /opt/gradle/
output:
bin init.d lib LICENSE NOTICE README
Also Read -> How to Install php 8 on Debian 11 Bullseye
Step 3: setup environment variables
we need to configure the PATH environment variable to include the Gradle bin directory.you can create new file named as gradle.sh inside of /etc/profile.d directory.
sudo nano /etc/profile.d/gradle.sh
paste below configuration in above file.
export GRADLE_HOME=/opt/gradle/
export PATH=${GRADLE_HOME}/bin:${PATH}
save and close the file. now Make the script executable as below.
sudo chmod +x /etc/profile.d/gradle.sh
then load the new environment variables
source /etc/profile.d/gradle.sh
Finally, verify gradle is installed properly with the following command which will display the version of gradle.
gradle -v
output:
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 https://docs.gradle.org/7.2/release-notes.html
------------------------------------------------------------
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
Now you have successfully installed gradle on debian 11 system.
Also Read -> How to Install Apache Tomcat 10 on Debian 10