How to install Apache Ant on CentOS

Last updated on July 24, 2020 by Dan Nanni

Apache Ant is an open-source tool for automating Java program build process. Similar to how the make utility builds an executable from source code and libraries using a Makefile, Apache Ant builds a Java project from its source code and libraries by using a similar XML file.

If you would like to install Apache Ant on CentOS, follow this guideline.

First of all, you need to install Java Development Kit, since Apache Ant will use JDK during its build process.

Then go ahead and install Apache Ant, using its binary distribution from the official Apache web site.

$ wget
$ sudo tar xvfvz apache-ant-1.10.9-bin.tar.gz -C /opt
$ sudo ln -s /opt/apache-ant-1.10.9 /opt/ant

You then have to set up ANT_HOME environment variable, and include Ant binary in your path, as follows.

$ sudo sh -c 'echo ANT_HOME=/opt/ant >> /etc/environment'
$ sudo ln -s /opt/ant/bin/ant /usr/bin/ant

Log out and log back in, to reload the environment variables defined in /etc/environment.

Finally, verify that Apache Ant is successfully installed.

$ ant -version
Apache Ant(TM) version 1.10.9 compiled on July 27 2020

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean