CentOS how to update Ant Version to 1.8.x and higher?
27,633
Solution 1
Awk's answer may probably work, but for some reason, it's not working for me. Then i found this (a bit different) answer by Googling.
- Download “bin” Release from http://ant.apache.org/bindownload.cgi
- Extract & copy/move the whole folder (apache-ant-1.9xxxxx) into
/opt/
. So there will be/opt/apache-ant-1.9xxxxxx/
- Make a Symlink:
ln -s /opt/apache-ant-1.9.xxxxx /opt/ant
- Make another Symlink:
ln -s /opt/ant/bin/ant /usr/bin/ant
- Set
ANT_HOME
into the Environmentvi /etc/environment
and add this line:ANT_HOME=/opt/ant
(without trailing slash) - Re-login to initiate the Environment.
That one perfectly works for me.
Solution 2
The answer from 夏期劇場 works, but it has few extra steps that aren't strictly necessary. The following configuration worked for me compiling Solr.
Download and extract ant into /opt/ant
$ sudo -i
# cd /opt
# wget http://apache.parentingamerica.com//ant/binaries/apache-ant-1.9.6-bin.tar.bz2
# tar xjf apache-ant-1.9.6-bin.tar.bz2
# mv apache-ant-1.9.6 ant
Remove any existing ant packages
# yum remove -y `rpm -qa | grep '^ant-'`
Create symlink to ant executable
# ln -s /opt/ant/bin/ant /usr/local/bin/ant
If you want ant to be available for root user, then create symlink to ant executable from /usr/local/sbin
# ln -s /opt/ant/bin/ant /usr/local/sbin/ant
Logout out of the system and log back in, command ant
should be available for you to use.
Related videos on Youtube
Author by
夏期劇場
Updated on September 18, 2022Comments
-
夏期劇場 over 1 year
I'm using CentOS 6.5 and installed
Ant
by using:yum install ant
It came with Ant version 1.7.1, but I need the latest -- version 1.8.0.
- How to properly get the latest
Ant version 1.8.x
(or higher) fromYUM
or any way please?
- How to properly get the latest
-
夏期劇場 about 10 yearsMove to
/opt/bin
or/opt/ant
, please? (I do not findopt/bin
) -
Akshay Hegde about 10 yearsSorry it was
/opt/ant
, actually you can keep binary in any location, butexport ANT_HOME=your/binary/path
in/etc/profile
or.bashrc
is important. -
Lambart over 4 yearsWorks fine for me, but I didn't need to edit
/etc/environment
. -
Lambart over 4 yearsThis works fine, but don't copy the exact commands unless you really want v.1.9.6! Go to ant.apache.org/bindownload.cgi to download the version you're looking for.