×


Install Gradle on CentOS 8 - Step by Step Process ?

Gradle is a flexible and powerful application used for building Java projects.

It combines the best features of Maven and Ant. Gradle uses a dynamic object-oriented programming language and Groovy for the Java platform to build scripts and define the projects.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform Linux related Installation tasks and queries.
In this context, we shall look into how to install the latest Gradle release on CentOS 8.
Here, we will download the latest version of Gradle from their official Gradle releases website, and then we will use this downloaded binary file for installation.
In this context, we shall look into how to install the latest version of Gradle on CentOS 8.

How to install Gradle on CentOS ?

Before, we begin with the installation procedure, ensure that the following conditions are met:
i. Install the required packages such as JDK 8 on your system.
ii. Run all commands with sudo privileges.

Then, Open the terminal window and then perform the following different steps to install Gradle on your CentOS system.

1. Install the OpenJDK on CentOS 8

The OpenJDK is the required package for Gradle installation. Java is already installed on our system. However, you can install the OpenJDK latest package on your system by running the following command:

$ sudo yum install java-1.8.0-openjdk-devel

Once the installation of Java is completed, verify the installation by displaying the installed version by using the below-mentioned command:

$ java -version


2. Download the Gradle

The latest available version of Gradle v6.8.3 is available for installation at the time of writing this article. But, verify the latest available version before installing Gradle on your system by using this website URL.
Download the binary file of Gradle by using the following 'wget' command:

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

The binary file will be downloaded in the /temp directory of your system.
Once the Gradle latest version is downloaded on your system, extract the zip file by running the below-mentioned command:

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

Once the extraction process is completed, verify it by using the following command:

$ ls /opt/gradle/gradle-*


3. Configure the Environment Variables for Gradle

i. Now, add the following configuration in the 'gradle.sh' file by using the below-given command:

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

ii. Paste the following lines in this file:

export GRADLE_HOME=/opt/gradle/gradle-6.8.3
export PATH=${GRADLE_HOME}/bin:${PATH}

iii. Now, save this script using ‘Ctrl+O’ and exit from this file using the 'Ctrl+X'.
iv. Convert this script into an executable format by running the following command:

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

v. Now, load the entire configuration by using the following 'source' command:

$ source /etc/profile.d/gradle.sh


4. Verify Gradle installation

Either, to verify the installation process completed properly or not, use the following command to display the Gradle installed version:

$ gradle -v

The gradle version should display on the terminal.
Now, Gradle installation is completed on the CentOS 8 system.

You can start and use it on your system.

[Need help in installing any Software on Ubuntu Linux System? We can help you. ]


Conclusion

This article covers how to install the latest Gradle version on CentOS 8 system. 

Also you will learn how to set up the environment variable in the Gradle configuration file.

Gradle is an open-source build automation system.

It supports multiple programming languages such as Java, C++, and Python development. It is based on the concepts of Apache Ant and Apache Maven.


To verify if Gradle is installed properly use the gradle -v command which will display the Gradle version:

# gradle -v