Installing Apache Ant on linux / CentOS / Red Hat

Prerequisites:
- Make sure you have installed JAVA . If not then click here to install java.

Steps:
1. First download Ant binary packages from Apache. You may use below link to download Apache Ant.
http://apache.mirrors.tds.net//ant/binaries/apache-ant-1.9.2-bin.tar.gz

2. Keep downloaded binary file at some location. For example: /opt/apache-ant-1.9.2-bin.tar.gz.
3. Now go to /opt directory and extract zip file using below command.
cd /opt/
tar -zxvf apache-ant-1.9.2-bin.tar.gz
4. When you extract zip file it will create /opt/apache-ant-1.9.2 folder. Now we need to set ANT_HOME variable.
so open /etc/profile file and at the end of file write below lines and save it.

export ANT_HOME=/opt/apache-ant-1.9.2
export PATH=$PATH:$ANT_HOME/bin

Once you are done with /etc/profile file editing, you need to run below command to set variable's value.

source /etc/profile

5. Once you are done with above command, you can check ANT_HOME variable value with echo command.
for example:

-bash-3.2$ echo $ANT_HOME
/opt/apache-ant-1.9.2

Done.

No comments:

Post a Comment