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/

cat > /tmp/
# installs to /opt/gradle
# existing versions are not overwritten/deleted
# seamless upgrades/downgrades
# $GRADLE_HOME points to latest *installed* (not released)
mkdir /opt/gradle
wget -N${gradle_version}
unzip -oq ./gradle-${gradle_version} -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/
. /etc/profile.d/
hash -r ; sync
# check installation
gradle -v

Execute the shell

chmod 744 /tmp/

Edit the file /etc/profile.d/ 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

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