How to Install Gradle on CentOS 7

Using a Different System?

  • How to Install Gradle on Ubuntu 16.10

Are we missing a guide for your target system? Request one, or submit your own!


Gradle is a free and open source build automation toolset based on the concepts of Apache Ant and Apache Maven. Gradle provides a platform to support the entire development lifecycle of a software project.

In this tutorial, we will install the latest version of Gradle on CentOS 7.

Prerequisites

  • A Vultr CentOS 7 server instance.
  • A sudo user.

Step 1: System update

Before installing any packages on your CentOS server instance, it is recommended to update the system. Login using the sudo user and run the following commands to update the system.

sudo yum -y install epel-releasesudo yum -y updatesudo shutdown -r now

Once the system has rebooted, log in again as the sudo user and proceed to the next steps.

Step 2: Install JDK

Gradle requires Java Development Kit (JDK) 7 or higher in order to work. In this tutorial we will be installing JDK 8. Run the following command to install JDK 8 on your server.

sudo yum -y install java-1.8.0-openjdk wget unzip

The above command will also install wget and unzip. Verify the installation.

java -version

You will see the following output.

openjdk version "1.8.0_121"OpenJDK Runtime Environment (build 1.8.0_121-b13)OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)

Step 3: Download Gradle

Gradle distribution archive comes in two types: “binary-only” and “complete”. The “binary-only” archive contains the Gradle software only wheres “complete” archive comes with binary, documentation and source. Run the following command to download Gradle to your system.

wget https://services.gradle.org/distributions/gradle-3.4.1-bin.zip

You can always check the Gradle release page to look for the link to the latest version of Gradle.

Step 4: Install Gradle

Create a directory for the Gradle installation.

sudo mkdir /opt/gradle

Extract the downloaded archive to the newly created directory.

sudo unzip -d /opt/gradle gradle-3.4.1-bin.zip

Configure the PATH environment variable so that the gradle executable can be directly executed anywhere on the system.

export PATH=$PATH:/opt/gradle/gradle-3.4.1/bin

You can run the following command to check if the Gradle install was successful.

gradle -v

You should see the following output.

------------------------------------------------------------Gradle 3.4.1------------------------------------------------------------Build time:   2017-03-03 19:45:41 UTCRevision:     9eb76efdd3d034dc506c719dac2955efb5ff9a93Groovy:       2.4.7Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015JVM:          1.8.0_121 (Oracle Corporation 25.121-b13)OS:           Linux 3.10.0-514.10.2.el7.x86_64 amd64

The installation is complete. Your system is now ready to build programs using Gradle.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article

No comments

Powered by Blogger.