Hamsa K
Editor
4 min read | 3 months ago

How to Install Gradle on Centos 8

How to Install Gradle on Centos 8/Rhel 8

Gradle is an open-source build automation system that builds upon the concepts of Apache Ant and Apache Maven and introduces a Groovy-based domain-specific language instead of the XML form used by Maven for declaring the project configuration.

prerequisites:

you need to be loggedin with root user or any other user with sudo privileges.

Step 1: Install JDK

First we need to install Java JDK or JRE version 8 or above to be installed on the system.Here i am installing Java 11 with below command.

[root@localhost ~]# yum install java-11-openjdk
[root@localhost ~]# java --version
openjdk 11.0.7 2020-04-14 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.7+10-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.7+10-LTS, mixed mode, sharing)

Step 2: Download gradle

download latest gradle from its official site.we will use binay zip file

[root@localhost ~]# cd /opt
[root@localhost opt]# wget https://downloads.gradle-dn.com/distributions/gradle-6.5-bin.zip

Extract the downloaded zip file using unzip and list the files in gradle

[root@localhost opt]# unzip gradle-6.5-bin.zip
[root@localhost opt]# mv gradle-6.5 gradle
[root@localhost opt]# cd gradle/
[root@localhost gradle]# ls
bin  init.d  lib  LICENSE  NOTICE  README

Step 3: Setup Environment Variables

Now we will configure profile path for environment variable to include Gradle’s bin directory with the following command.open below file with vi or nano editor.

vi /etc/profile.d/gradle.sh

Add below line to above file.

export PATH=/opt/gradle/bin:$PATH

save the file. Make the profile executable with below command

[root@localhost ~]# chmod +x /etc/profile.d/gradle.sh

Load environment variables to the current session by using following command

[root@localhost ~]# source /etc/profile.d/gradle.sh

Finally verify gradle installation 

[root@localhost ~]# gradle -v

sample output:

[root@localhost ~]# gradle -v
Welcome to Gradle 6.5!
Here are the highlights of this release:
 - Experimental file-system watching
 - Improved version ordering
 - New samples
For more details see https://docs.gradle.org/6.5/release-notes.html
------------------------------------------------------------
Gradle 6.5
------------------------------------------------------------
Build time:   2020-06-02 20:46:21 UTC
Revision:     a27f41e4ae5e8a41ab9b19f8dd6d86d7b384dad4
Kotlin:       1.3.72
Groovy:       2.5.11
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          11.0.7 (Oracle Corporation 11.0.7+10-LTS)
OS:           Linux 4.18.0-80.el8.x86_64 amd64

That’s All. You have successfully installed Gradle on CentOS8 and RHEL 8.

 



Warning! This site uses cookies
By continuing to browse the site, you are agreeing to our use of cookies. Read our terms and privacy policy