Skip to content

Instantly share code, notes, and snippets.

@parzonka
Last active July 4, 2024 05:28
Show Gist options
  • Save parzonka/9371885 to your computer and use it in GitHub Desktop.
Save parzonka/9371885 to your computer and use it in GitHub Desktop.
Install gradle on redhat/centos linux
# installs to /opt/gradle
# existing versions are not overwritten/deleted
# seamless upgrades/downgrades
# $GRADLE_HOME points to latest *installed* (not released)
gradle_version=2.9
wget -N https://services.gradle.org/distributions/gradle-${gradle_version}-all.zip
sudo unzip -foq gradle-${gradle_version}-all.zip -d /opt/gradle
sudo ln -sfn gradle-${gradle_version} /opt/gradle/latest
sudo printf "export GRADLE_HOME=/opt/gradle/latest\nexport PATH=\$PATH:\$GRADLE_HOME/bin" > /etc/profile.d/gradle.sh
. /etc/profile.d/gradle.sh
# check installation
gradle -v
@ejoful
Copy link

ejoful commented Jul 6, 2018

CentOS Linux release 7.5.1804 (Core)

# !/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=4.8.1
if [ ! -d "/opt/gradle" ];then
mkdir /opt/gradle
fi
if [ ! -f "./gradle-${gradle_version}-all.zip" ];then
wget -N http://services.gradle.org/distributions/gradle-${gradle_version}-all.zip
fi
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment