Sunday, November 22, 2026
TR
LinuxOpen Source

How to Install Gradle on CentOS 8

How to Install Gradle on CentOS 8
Contents
  1. Prerequisites
  2. Install Gradle on CentOS 8
  3. Set Up the Environment Variable
  4. Check the Gradle Version

Gradle is an open-source build tool for automating applications. Gradle helps teams of developers build, automate and deliver software more easily and quickly. This tutorial will help you install Gradle on a CentOS 8 and RHEL 8 Linux system.

Prerequisites

Gradle requires Java 8 or a higher version to be installed on the system. Usually a default Java version is installed on a CentOS system. You need Java 8 or above to run Gradle. Make sure Java is installed on your CentOS and RHEL system, or use the following command to install it.

sudo dnf install java-11-openjdk

Verify the Java version installed on your system.

java -version openjdk version "11.0.6" 2020-01-14 LTS OpenJDK Runtime Environment 18.9 (build 11.0.6+10-LTS) OpenJDK 64-Bit Server VM 18.9 (build 11.0.6+10-LTS, mixed mode, sharing)

Install Gradle on CentOS 8

After installing Java on your system, download the latest Gradle distribution release binary from the official download page.

wget https://downloads.gradle-dn.com/distributions/gradle-6.3-bin.zip

Then extract the downloaded archive and place it in the right location. In general, I use the /usr/local directory to store applications. You can use an alternative directory such as /opt.

unzip gradle-6.3-bin.zip mv gradle-6.3 /usr/local/gradle

Gradle is now set up on your system.

Set Up the Environment Variable

Now you need to add Gradle to the PATH environment variable, and also make sure the variable is still set after the system is restarted.

To set the PATH variable across reboots, place a shell script under the profile.d directory. Create a file as follows:

vim /etc/profile.d/gradle.sh

and add the following line to the file

export PATH=/usr/local/gradle/bin:$PATH

Save and close the file. Now source the script to apply the environment to the current shell.

source /etc/profile.d/gradle.sh

And you have completed the Gradle installation on your CentOS / RHEL 8 system.

Check the Gradle Version

After completing the Gradle installation, let's check the version installed on your system.

gradle -v

Output

------------------------------------------------------------ Gradle 6.3
------------------------------------------------------------ Build time: 2020-03-24 19:52:07 UTC Revision: bacd40b727b0130eeac8855ae3f9fd9a0b207c60 Kotlin: 1.3.70 Groovy: 2.5.10 Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019 JVM: 11.0.6 (Oracle Corporation 11.0.6+10-LTS) OS: Linux 4.18.0-147.3.1.el8_1.x86_64 amd64

If you see results like the above, Gradle has been successfully installed and configured on your CentOS 8 system.

Kerim Koç

Systems and infrastructure engineer. I write about Linux, open source, high availability and security.