Overview
In this post, we will learn to download and install Apache Ant tool on Ubuntu Linux machine. Steps to set Ant home variable.
Environment:
- Ubuntu Linux
- Ant Latest version
- Mozilla Firefox Browser
Steps
First things first, check if ant is installed on the machine.
Launch terminal and issue the following command.
$ ant
We can install ant from the above command. However, we will do a manual download from native packages and install of the tool to a standard location.
Download
Navigate to Ant official website.
Click on the Binary Distributions link under the Download section.
Choose the tar file and download the file on to the machine.
Install Ant
Locate the tar file on the computer and extract the contents.
$ sudo tar -xvf <ant tar file>
Move the ant installation folder to some standard location. In this tutorial, we will use /opt/ant directory path.
ANT_HOME variable
Set the ANT_HOME environment variable to point to the ant install folder. For example, in this case
Edit the /etc/profile file and set the variable. Add the bin directory to the PATH.
ANT_HOME=/opt/ant
export ANT_HOME
That’s it. We are done with the Ant install process.
Verify
Launch Terminal and issue the following Ant version command.
$ ant -v