Gradle is a powerful build tool that supports multiple popular programming languages and technologies. It is also an official build tool for Android. Gradle is a highly customized and extensible tool in most fundamental ways. It is an open-source build tool for the automation of applications.
This tutorial will help you to install Gradle on Fedora 36/35/34/33/32 operating system.
Prerequisites
The Gradle requires Java 8 or higher version installed on the system. Generally, the Fedora system has a default installed Java version on it. to run Java 8 or higher version. You can use the following command to install java if you don’t already have it.
sudo dnf install java-11-openjdk
Verify the installed Java version on your system.
java -version
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment 18.9 (build 11.0.11+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.11+9, mixed mode, sharing)
After that install some more packages used in this tutorial.
sudo dnf install unzip wget -y
Install Gradle on Fedora
Once you installed Java on your system. Download the latest Gradle distribution release binary file from its official download page. You can also use the wget command to download the file.
wget https://downloads.gradle-dn.com/distributions/gradle-7.0-bin.zip
Then extract the downloaded archive and place it in the proper location. Generally, I use /usr/local
directory for storing applications. You can use an alternative directory like /opt.
unzip gradle-7.0-bin.zip
sudo mv gradle-7.0 /usr/local/gradle
Gradle has been configured on your system.
Setup Environment Variable
Now, you need to set up Gradle with a PATH environment variable, Also make sure the variable is set after the system reboot.
Place a shell script under the profile.d directory to set the PATH variable on reboot. Create a file like the below:
sudo nano /etc/profile.d/gradle.sh
Add the below configuration to the file
export PATH=/usr/local/gradle/bin:$PATH
Save the file and close it. Now source the script to apply the environment for the current shell.
source /etc/profile.d/gradle.sh
All done, you have done the Grandle installation on your Fedora system.
Check Gradle Version
Once you finished the Gradle installation, let’s check the installed version on your system.
gradle --version
Output
Welcome to Gradle 7.0! Here are the highlights of this release: - File system watching enabled by default - Support for running with and building Java 16 projects - Native support for Apple Silicon processors - Dependency catalog feature preview For more details see https://docs.gradle.org/7.0/release-notes.html ------------------------------------------------------------ Gradle 7.0 ------------------------------------------------------------ Build time: 2021-04-09 22:27:31 UTC Revision: d5661e3f0e07a8caff705f1badf79fb5df8022c4 Kotlin: 1.4.31 Groovy: 3.0.7 Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020 JVM: 11.0.11 (Red Hat, Inc. 11.0.11+9) OS: Linux 5.8.15-301.fc33.x86_64 amd64
You will see the results like above. It means Gradle is properly installed on your Fedora system. Next, you may also need Apache Maven on your system.