Installing Apache Ant on Debian Linux
Ant is a build tool created by Apache Software Foundation. This document explains how to install ant on Debian Linux.

Ant requires Java Runtime .
For information on how to install Java Development Kit see Installing Java Development Kit on Debian Linux .

Download Ant
At present the latest version of Ant is 1.8.4.
You can download it here
Scroll down to where it says Mirror and choose the mirror server closest to you.
Or just scroll down lower and click on the download link ( ).
Save that file to a directory on your computer. I'm going to use Downloads as a directory where was saved.

Install Ant
I prefer to install additional software in /opt directory. You can choose any other directory.
You need to login as root .
If you're using Gnome desktop open Root Terminal window ( Applications/Accessories/Root Terminal ).

Otherwise just open a terminal and press ENTER after each command:

cd /opt
mkdir ant
cd ant
cp ~/Downloads/ .

That should create a directory called apache-ant-1.8.4 .
I like to provide a symlink (a.k.a. symbolic or soft link) called default linked to current software version.

ln -s apache-ant-1.8.4 default

This makes things easier when upgrading to newer version of Ant. For example:

rm default
ln -s apache-ant-1.8.5 default

If directory structure is the same everything should work out of the box.

Test installation

cd /opt/ant/default/bin

You should see the following messages:

Buildfile: build.xml does not exist!
Build failed

This is to be expected since there is no build.xml in /opt/ant/default/bin directory.

Make Ant available to all users
( /etc/alternatives directory contains links to all replaceable binaries):

cd /etc/alternatives
ln -s /opt/ant/default/bin/ant

I prefer to link all binary files located in /opt to /usr/local/bin directory.

cd /usr/local/bin
ln -s /etc/alternatives/ant

This is pretty much it.

Export ANT_HOME property
If you want to set ANT_HOME system property do this:

cd /etc
vi profile

At the end of file add this line:

export ANT_HOME=/opt/ant/default

Save and close. Changes will not be visible until you logout and login again.
Note that when using Gnome terminal window closing it and opening it again does not really log you out.
So check ANT_HOME settings after you reboot Linux:


This should print all system properties. Look for ANT_HOME at the top.