Install Gradle on Ubuntu
This guide provides a clean, repeatable setup flow, verification steps, and common pitfalls to avoid in real environments.
1. Download and Extract
Download Gradle and extract it to your tools directory, for example:
/data/dev/tools/gradle-8.7
2. Set GRADLE_HOME and PATH
Edit profile:
sudo nano /etc/profile
Add:
GRADLE_HOME=/data/dev/tools/gradle-8.7
PATH=$PATH:$GRADLE_HOME/bin
export GRADLE_HOME
export PATH
Reload shell config:
source /etc/profile
3. Verify
echo $GRADLE_HOME
gradle -v
4. Optional: Set GRADLE_USER_HOME
Set custom Gradle cache/repository location:
export GRADLE_USER_HOME=/data/dev/repository/gradle
Add this line in profile to make it persistent.
Key Takeaways
- Keep configuration explicit and environment-specific.
- Verify setup with version and env checks immediately after changes.
- Automate these steps in shell profiles or project docs to avoid drift.