How to install Gradle on CentOS 7
How to install Gradle on CentOS 7
Gradle is a free and open source automation toolset based on Apache Ant and Apache Maven. Gradle is also used for building, testing, publishing, deployment for generating static websites, documentations, etc. This tutorial explains the installation procedure of Gradle in CentOS 7.
Installation procedure
To start the installation procedure, first we should install the package for epel repository before installing Gradle. Use the below command to install epel repo.
[root@linuxhelp ~]# yum install epel-release -y
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:01
updates | 3.4 kB 00:00:00
updates/7/x86_64/primary_db | 3.9 MB 00:01:33
Loading mirror speeds from cached hostfile
* base: mirror.fibergrid.in
* extras: mirror.fibergrid.in
* updates: mirror.fibergrid.in
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-9 will be installed
--> Finished Dependency Resolution
.
.
.
epel-release-7-9.noarch.rpm | 14 kB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : epel-release-7-9.noarch 1/1
Verifying : epel-release-7-9.noarch 1/1
Installed:
epel-release.noarch 0:7-9
Complete!
Gradle will require to install Java Development Kit (JDK) version 7 or above, so run the command to install java version 8
[root@linuxhelp ~]# yum -y install java-1.8.0-openjdk
Loaded plugins: fastestmirror, langpacks
epel/x86_64/metalink | 6.1 kB 00:00:00
epel | 4.3 kB 00:00:00
(1/3): epel/x86_64/group_gz | 170 kB 00:00:03
(2/3): epel/x86_64/updateinfo | 765 kB 00:00:09
(3/3): epel/x86_64/primary_db | 4.6 MB 00:01:05
Loading mirror speeds from cached hostfile
* base: mirror.fibergrid.in
* epel: mirror.vinahost.vn
* extras: mirror.fibergrid.in
* updates: mirror.fibergrid.in
.
.
.
Complete!
After installing java, check its version by running the following command.
[root@linuxhelp ~]# java -version
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)
Now install the package for Gradle.
[root@linuxhelp ~]# wget https://services.gradle.org/distributions/gradle-3.4.1-bin.zip
--2017-04-03 15:27:39-- https://services.gradle.org/distributions/gradle-3.4.1-bin.zip
Resolving services.gradle.org (services.gradle.org)... 104.16.173.166, 104.16.175.166, 104.16.174.166, ...
Connecting to services.gradle.org (services.gradle.org)|104.16.173.166|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://downloads.gradle.org/distributions/gradle-3.4.1-bin.zip [following]
--2017-04-03 15:27:39-- https://downloads.gradle.org/distributions/gradle-3.4.1-bin.zip
Resolving downloads.gradle.org (downloads.gradle.org)... 104.16.174.166, 104.16.173.166, 104.16.172.166, ...
Connecting to downloads.gradle.org (downloads.gradle.org)|104.16.174.166|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 70310446 (67M) [application/zip]
Saving to: ‘ gradle-3.4.1-bin.zip’
100%[===========================================================================================================================================> ] 70,310,446 893KB/s in 93s
2017-04-03 15:29:12 (740 KB/s) - ‘ gradle-3.4.1-bin.zip’ saved [70310446/70310446]
To install gradle on /opt/ directory, let’ s create a directory for gradle under /opt/ and unzip the gradle package into that newly created gradle directory.
[root@linuxhelp ~]# mkdir /opt/gradle
[root@linuxhelp ~]# unzip -d /opt/gradle gradle-3.4.1-bin.zip
Archive: gradle-3.4.1-bin.zip
creating: /opt/gradle/gradle-3.4.1/
inflating: /opt/gradle/gradle-3.4.1/LICENSE
creating: /opt/gradle/gradle-3.4.1/media/
inflating: /opt/gradle/gradle-3.4.1/media/gradle-icon-16x16.png
inflating: /opt/gradle/gradle-3.4.1/media/gradle-icon-24x24.png
inflating: /opt/gradle/gradle-3.4.1/media/gradle.icns
inflating: /opt/gradle/gradle-3.4.1/media/gradle-icon-512x512.png
inflating: /opt/gradle/gradle-3.4.1/media/gradle-icon-32x32.png
inflating: /opt/gradle/gradle-3.4.1/med
.
.
.
inflating: /opt/gradle/gradle-3.4.1/lib/plugins/snakeyaml-1.6.jar
inflating: /opt/gradle/gradle-3.4.1/lib/plugins/httpcore-4.4.4.jar
inflating: /opt/gradle/gradle-3.4.1/lib/plugins/jcifs-1.3.17.jar
inflating: /opt/gradle/gradle-3.4.1/lib/plugins/xercesImpl-2.9.1.jar
inflating: /opt/gradle/gradle-3.4.1/lib/plugins/xml-apis-1.3.04.jar
inflating: /opt/gradle/gradle-3.4.1/lib/plugins/plexus-component-annotations-1.5.5.jar
inflating: /opt/gradle/gradle-3.4.1/lib/plugins/hamcrest-core-1.3.jar
inflating: /opt/gradle/gradle-3.4.1/lib/gradle-version-info-3.4.1.jar
Check the gradle version by running the following command.
[root@linuxhelp ~]# gradle -v
------------------------------------------------------------
Gradle 3.4.1
------------------------------------------------------------
Build time: 2017-03-03 19:45:41 UTC
Revision: 9eb76efdd3d034dc506c719dac2955efb5ff9a93
Groovy: 2.4.7
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_121 (Oracle Corporation 25.121-b13)
OS: Linux 3.10.0-514.10.2.el7.x86_64 amd64
Wasn' t that an easy installation procedure? Gradle can provide a support to development lifecycle.