How to install Apache Ant on CentOS

Apache Ant is an open-source tool for robotizing Java project build process. Like how the make utility forms an executable from source code and libraries utilizing a Makefile, Apache Ant build a Java project from its source code and libraries by utilizing a comparative XML file. Ant can also be used effectively to build non Java applications, for example C or C++ applications. All the more by and large, Ant can be utilized to pilot any sort of procedure which can be depicted as far as targets and task.

554px-Apache-Ant-logo.svg

JAVA is the first necessity for Apache Ant establishment. Verify you have JAVA SE 6 or Later form introduced in your framework. Utilization taking after summon to check in the event that you have java introduced as of now on your framework.

# java -version
java version "1.7.0_71"
OpenJDK Runtime Environment (rhel-2.5.3.1.el6-x86_64 u71-b14)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

Install Java 8 on CentOS/RHEL
Install Java 7 on CentOS/RHEL

At that point feel free to introduce Apache Ant, utilizing its binary distribution from the official Apache site.

# cd /opt
# wget http://www.us.apache.org/dist/ant/binaries/apache-ant-1.9.4-bin.tar.gz
# tar zxvf apache-ant-1.9.4-bin.tar.gz
# mv /opt/apache-ant-1.9.4-bin /opt/ant

You then need to set up ANT_HOME environment variable, and include Ant binary in your path, as takes after.

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

Finally, verify the version of Apache Ant using following command:

# ant -version
Apache Ant(TM) version 1.9.4 compiled on April 29 2014

I hope with this tutorial you will successfully installed Apache Ant on your server.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.