mkdir -p ~/opt/packages/gradle && cd $_
wget https://services.gradle.org/distributions/gradle-3.1-all.zip
unzip gradle-3.1-all.zip
The symlink will allow us to upgrade Gradle later without changing any other configuration.
ln -s ~/opt/packages/gradle/gradle-3.1/ ~/opt/gradle
Open your .profile
file
atom ~/.profile
Paste the following at the bottom of your .profile file.
# Gradle
if [ -d "$HOME/opt/gradle" ]; then
export GRADLE_HOME="$HOME/opt/gradle"
PATH="$PATH:$GRADLE_HOME/bin"
fi
Finally, source your .profile and test gradle.
source ~/.profile
which gradle
gradle -version
gradle init --type java-library