This article is going to cover how to install Apache Ant on Ubuntu 16.04. There are several ways to do that:
- Using apt-get
- Using SDKMan
- Manual installing
In this article, we will cover both of those ways.

Apache Ant
1. Prerequisite
The current version of Apache Ant is 1.9.x which requires Java 1.5 at minimum. Therefore, you should make sure you have suitable Java installed on your environment.
2. Install Apache Ant on Ubuntu 16.04 using apt-get
To install Apache Ant using apt-get, simply execute the following commands:
1 2 |
sudo apt-get update sudo apt-get install ant |
You can verify by issuing the command:
1 |
ant -version |
3. Install Apache Ant on Ubuntu 16.04 using SDKMan
SDKMAN is a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems. We can leverage SDKMAN to install Apache Ant on Ubuntu 16.04.
Make sure you install SDKMan first by following installation guide. After that, you can install Apache Ant on Ubuntu 16.04 by executing the following command:
1 |
sdk install ant |
When finishes, you can verify whether Ant is installed successfully or not by checking its version:
1 |
ant -version |
4. Install Apache Ant on Ubuntu 16.04 manually
4.1. Download Ant
You can download Ant distribution from the Apache Ant website. Currently, the latest release of Ant is version 1.9.7.
In the following command, I will download the binary only version of Ant:
1 |
wget http://mirror.downloadvn.com/apache//ant/binaries/apache-ant-1.9.7-bin.tar.gz |
4.2. Unpack Ant
1 |
sudo tar -xf apache-ant-1.9.7-bin.tar.gz -C /usr/local |
The above command will unpack the Ant distribution to /usr/local/apache-ant-1.9.7
Next, we will create a symbolic link to the Ant distribution:
1 |
sudo ln -s /usr/local/apache-ant-1.9.7/ /usr/local/ant |
4.3. Create ANT_HOME Environment Variables
Create a ant.sh file at /etc/profile.d folder (you can use vi with below command)
1 |
sudo vi /etc/profile.d/ant.sh |
Enter the follow content to the file:
1 2 |
export ANT_HOME=/usr/local/ant export PATH=${ANT_HOME}/bin:${PATH} |
Save the file.
We will need to activate the above environment variables. We can do that by log out and log in again or simply run below command:
1 |
source /etc/profile |
4.4. Verification
We can verify whether Maven is installed successfully or not by type command:
1 |
ant -version |
The output is similar to:
1 |
Apache Ant(TM) version 1.9.7 compiled on April 9 2016 |
5. Summary
We have learned about how to install Apache Ant on Ubuntu 16.04 by different ways. Installing Ant using apt-get is the simplest way but we may not install our desired version. Installing with SDKMan requires further step to install SDKMan first; however, it’s flexible to switch between different versions of Apache Ant. The last way, manual install will take more effort; but we can take over everything.
Below are other articles related to setup or install build tools on Ubuntu 16.04. You can refer to them if needed.
Install Gradle on Ubuntu 16.04 LTS (Xenial Xerus)
Install Maven on Ubuntu 16.04 LTS (Xenial Xerus)
Thanks! This is what I am looking for installing Apache Nutch from source. This post is latest too 🙂
Thanks