• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Install Gradle on Ubuntu 22.04

Written by Admin, Updated On January 11, 2023
gradle, java, ubuntu
How to Install Gradle on Ubuntu 22.04

Gradle is free and open-source build tool used to make different applications. It includes 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’ll explain how to install Gradle on Ubuntu 22.04 system.

How to Install Gradle on Ubuntu 22.04#

Perform the following steps to install Gradle on Ubuntu 22.04 system:

Step 1 – Prerequisites#

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

Step 2 – Update System#

At first, we will update the system using below given command:

sudo apt update && upgrade -y

Step 3 – Install Java#

Gradle is dependent on Java so first we need to install Java to the server to run. To install OpenJDK run the following command:

sudo apt install default-jdk -y

Step 4 – Verify Java Installation#

Check the java version to verify the installation by issuing below given command:

java -version

The output should look something like this:

openjdk version "11.0.7" 2022-11-18
OpenJDK Runtime Environment (build 11.0.7+18-post-Ubuntu-3ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.7+18-post-Ubuntu-3ubuntu1, mixed mode, sharing)

Step 4 – Download 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 7.6.

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

wget https://services.gradle.org/distributions/gradle-7.6-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-7.6-bin.zip

Gradle is regularly release updates 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-7.6 /opt/gradle/latest

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

Step 5 – 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-7.6/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 22.04 Linux system.

Step 6 – 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 7.6!

...

Conclusion#

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

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

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Install GO on Debian 11
Next Article   How to Install Git on Ubuntu 22.04

Related Posts

  • How to Install and Use PHP Composer on Ubuntu 22.04

    How to Install Composer on Ubuntu 22.04

    January 31, 2023
  • How to Install Nginx on Ubuntu 22.04

    How to Install Nginx on Ubuntu 22.04

    January 28, 2023
  • How to Install Puppet Agent on Ubuntu 22.04

    How to Install Puppet Agent on Ubuntu 22.04

    January 22, 2023

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install SSH Keys on Ubuntu 22.04
    How to Set up SSH Keys on Ubuntu 22.04 January 7, 2023
  • How to Install Mongodb on Debian 11
    How to Install MongoDB on Debian 11 Linux January 11, 2023
  • How to Install Puppet Agent on Ubuntu 22.04
    How to Install Puppet Agent on Ubuntu 22.04 January 22, 2023
  • How to Install Jenkins on Debian 11
    How to Install Jenkins on Debian 11 January 5, 2023
  • How to Change-Hostname Ubuntu 22.04
    How to Change Hostname on Ubuntu 22.04 January 19, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook