In this tutorial, we’ll discuss about how to install Gradle on AlmaLinux 8.
Gradle is an open-source build automation tool focused on flexibility and performance. Gradle build scripts are written using a Groovy or Kotlin DSL. Read about Gradle features to learn what is possible with Gradle.
- Highly customizable — Gradle is modeled in a way that is customizable and extensible in the most fundamental ways.
- Fast — Gradle completes tasks quickly by reusing outputs from previous executions, processing only inputs that changed, and executing tasks in parallel.
- Powerful — Gradle is the official build tool for Android, and comes with support for many popular languages and technologies
- A AlmaLinux 8 installed dedicated server or KVM VPS.
- A root user access or normal user with administrative privileges.
Let’s get started with the installation.
Install Gradle on AlmaLinux 8
1. Keep the server up to date
# dnf update -y
2. Install OpenJDK 8
# dnf install java-1.8.0-openjdk-devel -y
Verify the Java installation by printing the Java version :
Output will be similar like:
openjdk version “1.8.0_282”
OpenJDK Runtime Environment (build 1.8.0_282-b08)
OpenJDK 64-Bit Server VM (build 25.282-b08, mixed mode)
3. Download Gradle
At the time of writing this article, the latest version of Gradle is 6.8.1. Before continuing with the next step, you should check the Gradle releases page to see if a newer version is available.
Download the Gradle binary file in the /tmp directory using the following wget command:
# wget https://services.gradle.org/distributions/gradle-6.8.1-bin.zip -P /tmp
Once the download is completed, unzip the file in the /opt/gradle directory:
# unzip -d /opt/gradle /tmp/gradle-*.zip
4. Configure the environment variables
Next, we’ll create one file named gradle.sh to configure the environmental variable PATH. Create a file in the /etc/profile.d directory. Use your favorite editor. For this demonstration purpose, we are using vi editor.
# vi /etc/profile.d/gradle.sh
Paste the following configuration:
Save and exit.
Next, make the script executable by using chmod command like shown below:
# chmod +x /etc/profile.d/gradle.sh
Load the environment variables using the source command :
# source /etc/profile.d/gradle.sh
To validate that Gradle is installed properly run the following command which will display the Gradle version:
# gradle -v
Output will be similar like:
Welcome to Gradle 6.8.1!
Here are the highlights of this release:
– Faster Kotlin DSL script compilation
– Vendor selection for Java toolchains
– Convenient execution of tasks in composite builds
– Consistent dependency resolution
For more details see https://docs.gradle.org/6.8.1/release-notes.html
Build time: 2021-01-22 13:20:08 UTC
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 1.8.0_282 (Red Hat, Inc. 25.282-b08)
OS: Linux 4.18.0-240.el8.x86_64 amd64
That’s it. The installation has been completed successfully.
In this tutorial, we have seen how to install Gradle on AlmaLinux 8.