Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Install Gradle on Ubuntu 20.04 - DesignLinux

Jul 21 2020
designlinux 0 Comments
How to Install Gradle on Ubuntu 20.04

Gradle is free and open-source build tool used for the Java projects, combining the best features of Ant and Maven. It is flexible and helps developers team to automate and build easier and faster software. In this tutorial we will explain how to install Gradle on Ubuntu 20.04.

Prerequisites#

Ensure that you are logged in as root or user with sudo privileges.

Step 1 – Install Java#

Gradle requires Java JDK 8 or JRE 8 or higher version on the server to run. To install OpenJDK run the following command:

sudo apt update
sudo apt install openjdk-11-jdk

Verify installed Java version on your system.

java -version

The output should look something like this:

openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-3ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-3ubuntu1, mixed mode, sharing)

Step 2 – Downloading Gradle#

After the installing Java on your system, download the latest Gradle distribution release binary file from its official download page. At the time of writing this tutorial, the latest version of Gradle is 6.5.1.

Run the following wget command to download the Gradle binary file:

wget https://services.gradle.org/distributions/gradle-6.5.1-bin.zip -P /tmp

Once the download is complete, extract the zip file in the /opt/gradle directory:

sudo unzip -d /opt/gradle /tmp/gradle-6.5.1-bin.zip

Gradle is regularly updated with security patches and new features. To have more control over versions and updates, we’ll create a symbolic link named latest, which points to the Gradle installation directory:

sudo ln -s /opt/gradle/gradle-6.5.1 /opt/gradle/latest

The Gradle build tool has been configured on your Ubuntu 20.04 system. Later, when upgrading Gradle, unpack the newer version and change the symlink to point to it.

Setup the Environment Variables#

Now, we will setup Gradle with PATH environment variable to include the Gradle bin directory. Open your text editor and create a new file with name gradle.sh under the /etc/profile.d directory.

sudo nano /etc/profile.d/gradle.sh

Add the following configuration:

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

Save and close the file.

Make the script executable by running the following chmod command:

sudo chmod +x /etc/profile.d/gradle.sh

Now source the script to apply environment for current shell.

source /etc/profile.d/gradle.sh

At this stage, Grandle is installed on Ubuntu 20.04 Linux system.

Verify Gradle Installation#

Run the below command to verify that Gradle is installed properly by checking it’s version:

gradle -v

It should show something like the following:

Welcome to Gradle 6.5.1!

Here are the highlights of this release:
 - Experimental file-system watching
 - Improved version ordering
 - New samples

For more details see https://docs.gradle.org/6.5.1/release-notes.html


------------------------------------------------------------
Gradle 6.5.1
------------------------------------------------------------

Build time:   2020-06-30 06:32:47 UTC
Revision:     66bc713f7169626a7f0134bf452abde51550ea0a

Kotlin:       1.3.72
Groovy:       2.5.11
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          11.0.7 (Ubuntu 11.0.7+10-post-Ubuntu-3ubuntu1)
OS:           Linux 5.4.0-26-generic amd64

Conclusion#

You learned how to install Gradle on Ubuntu 20.04 system. To know more about Gradle visit official Gradle Documentation page.

If you have any question or feedback, please leave a comment below.

Related

Tags: gradle, ubuntu

Secure Nginx with Let’s Encrypt on Ubuntu 20.04

Prev Post

How to Rename Directories in Linux

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 1
  • 530
  • 612,709

DesignLinux.com © All rights reserved

Go to mobile version