How to Install Gradle on CentOS 8

In this article we are going to perform Install JDK on CentOS 8, How to Install Gradle on CentOS 8, Configure environment variable for Gradle, verify gradle version.

What is Gradle ?

Gradle is an open source and modern automation tool used in software development for project build automation of applications.

Gradle provides flexibility and good performance which helps developers in build software project.

Using Gradle we can automate and deliver software faster.

Prerequisites

  • Gradle requires Java Development Kit (JDK)
  • Log in as root or user with sudo privileges

#1: Install JDK on CentOS 8

Install JDK 11 on CentOS 8 using below command

sudo yum install java-11-openjdk

Verify Java version on CentOS 8

java -version

#2: How to Install Gradle on CentOS 8

Here we are downloading and installing Gradle 7.0 Version, if you want to download latest version go through Gradle Download page.

Download the gradle setup in /tmp directory using below command,

cd /tmp
wget https://downloads.gradle-dn.com/distributions/gradle-7.0-bin.zip

unzip the gradle binary setup in /opt/gradle directory

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

Note: If you get an error:- “sudo: unzip: command not found”, you will have to install the unzip package with: 

sudo yum install unzip

#3. Configure Environment Variable

To configure the environment variable create a gradle.sh script in /etc/profile.d/ directory

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

Paste the below paths into the file:/etc/profile.d/gradle.sh

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

We will make the shell script executable by chmod command using below command.

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

Load the environment variable using below command

source /etc/profile.d/gradle.sh

We have configured environment for gradle.

#4. Verify Gradle Version

Now verify the Gradle version using below command.

gradle -v

Output:

------------------------------------------------------------
Gradle 7.0
------------------------------------------------------------

Conclusion

In this article, We have covered How to Install Gradle on CentOS 8, Configure environment variable for Gradle, verify gradle version.

Related Articles:

How to Install Apache Maven on Amazon Linux 2

Reference

About DevOps Hint

DevOps Hint Founded in 2020 Community Site where you can find about How to Guides, Articles and Troubleshooting Tips for DevOps, SRE, Sysadmins and Developers.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share via
Copy link