Installing Gradle on Generic Linux
Page content
How to Install Gradle on Generic Linux
Gradle is a powerful build automation tool that is used primarily for Java projects. In this tutorial, we will walk you through the steps to install Gradle on a Generic Linux system.
Step 1: Download and Extract Gradle
- Open your terminal.
- Visit the Gradle downloads page.
- Copy the link of the latest release of Gradle (for example,
https://services.gradle.org/distributions/gradle-7.3-bin.zip
). - Use
wget
command to download the Gradle distribution:wget https://services.gradle.org/distributions/gradle-7.3-bin.zip
- Extract the downloaded ZIP file:
sudo mkdir /opt/gradle sudo unzip -d /opt/gradle gradle-7.3-bin.zip
Step 2: Set up Environment Variables
- Open the
.bashrc
file in your home directory using a text editor such asnano
orvim
:nano ~/.bashrc
- Add the following lines at the end of the file:
export PATH=$PATH:/opt/gradle/gradle-7.3/bin
- Save and close the file. Then, load the changes to your current session:
source ~/.bashrc
Step 3: Verify Installation
To verify that Gradle has been successfully installed, run the following command:
gradle -v
If you see the version information of Gradle displayed, then the installation was successful.
Compatibility Note
If the wget
command is not available on your Generic Linux distribution, you can use curl
to download the Gradle distribution:
curl -LO https://services.gradle.org/distributions/gradle-7.3-bin.zip
Conclusion
In this tutorial, you have learned how to install Gradle on a Generic Linux system. Gradle is a versatile tool that can greatly enhance your Java project’s build automation process. Enjoy using Gradle for your development projects!