Linux:CentOS install gradle

Ensure that this packages are installed:

yum install bzip2
yum install unzip
yum install wget

Use this shell to install gradle. Copy this content in a file /tmp/gradle.sh

cat > /tmp/gradle.sh
#!/bin/bash
# installs to /opt/gradle
# existing versions are not overwritten/deleted
# seamless upgrades/downgrades
# $GRADLE_HOME points to latest *installed* (not released)
gradle_version=2.3
mkdir /opt/gradle
wget -N http://downloads.gradle.org/distributions/gradle-${gradle_version}-all.zip
unzip -oq ./gradle-${gradle_version}-all.zip -d /opt/gradle
ln -sfnv gradle-${gradle_version} /opt/gradle/latest
printf "export GRADLE_HOME=/opt/gradle/latest\nexport PATH=\$PATH:\$GRADLE_HOME/bin" > /etc/profile.d/gradle.sh
. /etc/profile.d/gradle.sh
hash -r ; sync
# check installation
gradle -v

Execute the shell

chmod 744 /tmp/gradle.sh
/tmp/gradle.sh

Edit the file /etc/profile.d/gradle.sh to set the correct path for JDK. Add JAVA_HOME and add the path for the JAVA_HOME.

export GRADLE_HOME=/opt/gradle/latest
export JAVA_HOME=/home/jdk1.8.0_60
export PATH=$PATH:$GRADLE_HOME/bin:$JAVA_HOME/bin

Now do a new login to set the new environment variables and execute

gradle -v

to view the result like this

------------------------------------------------------------
Gradle 2.3
------------------------------------------------------------
 
Build time:   2015-02-16 05:09:33 UTC
Build number: none
Revision:     586be72bf6e3df1ee7676d1f2a3afd9157341274
 
Groovy:       2.3.9
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM:          1.8.0_60 (Oracle Corporation 25.60-b23)
OS:           Linux 3.10.0-229.7.2.el7.x86_64 amd64

LEAVE A COMMENT