Skip to content

Instantly share code, notes, and snippets.

@theabhayprajapati
Created August 11, 2024 06:05
Show Gist options
  • Save theabhayprajapati/8207e54363085cf1a9e0a7f00fdc6e9f to your computer and use it in GitHub Desktop.
Save theabhayprajapati/8207e54363085cf1a9e0a7f00fdc6e9f to your computer and use it in GitHub Desktop.

To install Gradle 7 on Ubuntu with Java 1.8 already installed

  1. Open a terminal window.

  2. Update the package list:

    sudo apt update
    
  3. Install wget if it's not already installed:

    sudo apt install wget
    
  4. Download Gradle 7.6.2 (the latest version in the 7.x series):

    wget https://services.gradle.org/distributions/gradle-7.6.2-bin.zip
    
  5. Create a directory for Gradle:

    sudo mkdir /opt/gradle
    
  6. Extract the downloaded zip file to the new directory:

    sudo unzip -d /opt/gradle gradle-7.6.2-bin.zip
    
  7. Set up environment variables by editing the profile file:

    sudo nano /etc/profile.d/gradle.sh
    
  8. Add the following lines to the file:

    export GRADLE_HOME=/opt/gradle/gradle-7.6.2
    export PATH=${GRADLE_HOME}/bin:${PATH}
    
  9. Save and exit the file (Ctrl+X, then Y, then Enter).

  10. Make the script executable:

    sudo chmod +x /etc/profile.d/gradle.sh
    
  11. Load the environment variables:

    source /etc/profile.d/gradle.sh
    
  12. Verify the installation:

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