How to Install Gradle on Ubuntu 20.04

Install Gradle on Ubuntu 20.04

In this article, we will have explained the necessary steps to install and configure the Gradle on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Gradle is a general-purpose tool used to build, automate, and deliver software. It is primarily used for Java, C++, and Swift projects. Gradle combines the best features of Ant and Maven. Unlike its predecessors, which use XML for scripting, Gradle uses Groovy, a dynamic, object-oriented programming language for the Java platform to define the project and build scripts.

Install Gradle on Ubuntu 20.04

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

Step 2. Install OpenJDK.

Gradle requires Java SE 8 or later to be installed on the machine. To install OpenJDK 8 run following command:

Verify the Java installation:

Step 3. Install Gradle on Ubuntu system.

First, download Gradle from official Gradle release page. The latest Gradle version available is 5.1:

Next, unzip a downloaded zip file using the following command:

After that, create a symbolic link named latest, which points to the Gradle installation directory:

Step 4. Setup environment variables.

We need to add the Gradle bin directory to the system PATH environment variable:

Then, make the script executable:

Load the environment variables in the current shell session using the source command:

Verifying the Gradle Installation:

That’s all you need to do to install Gradle on Ubuntu 20.04 Focal Fossa. I hope you find this quick tip helpful. If you have questions or suggestions, feel free to leave a comment below.