Skip to content

Instantly share code, notes, and snippets.

@dasgoll
Last active May 18, 2021 09:27
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dasgoll/675b2dc2f0916f8f0051 to your computer and use it in GitHub Desktop.
Save dasgoll/675b2dc2f0916f8f0051 to your computer and use it in GitHub Desktop.
### I assume you run the commands as root
gradle_version=2.6
wget -c http://services.gradle.org/distributions/gradle-${gradle_version}-all.zip
unzip gradle-${gradle_version}-all.zip -d /opt
ln -s /opt/gradle-${gradle_version} /opt/gradle
printf "export GRADLE_HOME=/opt/gradle\nexport PATH=\$PATH:\$GRADLE_HOME/bin\n" > /etc/profile.d/gradle.sh
source /etc/profile.d/gradle.sh
# check installation
gradle -v
@arijitslg1
Copy link

I followed these steps but it doesnt show work for me:

  1. wget -c http://services.gradle.org/distributions/gradle-5.6.2-src.zip-all.zip

  2. unzip gradle-5.6.2-src.zip -d /opt

  3. I verified that I these files under /opt/gradle then,
    [root@ip-xxx-xx-xx-xxx gradle]# ls -alh
    total 56K
    drwxr-xr-x 6 root root 228 Feb 1 1980 .
    drwxr-xr-x 5 root root 61 Sep 26 13:46 ..
    -rw-r--r-- 1 root root 13K Feb 1 1980 build.gradle.kts
    drwxr-xr-x 3 root root 101 Feb 1 1980 buildSrc
    drwxr-xr-x 3 root root 113 Feb 1 1980 config
    drwxr-xr-x 6 root root 225 Feb 1 1980 gradle
    -rw-r--r-- 1 root root 331 Feb 1 1980 gradle.properties
    -rwxr-xr-x 1 root root 5.9K Feb 1 1980 gradlew
    -rw-r--r-- 1 root root 2.9K Feb 1 1980 gradlew.bat
    -rw-r--r-- 1 root root 7.8K Feb 1 1980 released-versions.json
    -rw-r--r-- 1 root root 4.8K Feb 1 1980 settings.gradle.kts
    drwxr-xr-x 104 root root 4.0K Feb 1 1980 subprojects
    -rw-r--r-- 1 root root 6 Feb 1 1980 version.txt

  4. ln -s /opt/gradle-5.6.2 /opt/gradle

  5. sudo vi /etc/profile.d/gradle.sh
    export GRADLE_HOME=/opt/gradle
    export PATH=$PATH:$GRADLE_HOME/bin

  6. Then I tried in both commands but none of them worked.
    sh /etc/profile.d/gradle.sh
    source /etc/profile.d/gradle.sh

[root@ip-xxx-xx-xx-xxx ~]# gradle -v
-bash: gradle: command not found
[root@ip-xxx-xx-xx-xxx ~]# gradle --version
-bash: gradle: command not found

Any help will be appreciated.
OS: AWS Linux 2

@arijitslg1
Copy link

Its interesting that when I follow the same steps with a different version i.e. 5.6.2, it does not work.
http://services.gradle.org/distributions/gradle-5.6.2-src.zip-all.zip

However, if I try the same version as yours i.e. 2.6, it works fine.

Not sure what is so different during the configuration of these two versions. Anyone????

@raghuece455
Copy link

sudo mkdir /opt/gradle
wget -c https://services.gradle.org/distributions/gradle-4.2.1-bin.zip
sudo unzip -d /opt/gradle gradle-4.2.1-bin.zip
export PATH=$PATH:/opt/gradle/gradle-4.2.1/bin

gradle -v

Gradle 4.2.1

Build time: 2017-10-02 15:36:21 UTC
Revision: a88ebd6be7840c2e59ae4782eb0f27fbe3405ddf

Groovy: 2.4.12
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.7.0_211 (Oracle Corporation 24.211-b02)
OS: Linux 4.14.62-65.117.amzn1.x86_64 amd64

Note: Java is prerequisite

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