本文转自 http://hanqunfeng.iteye.com/blog/668133
相关系列:
linux下jdk的安装 http://hanqunfeng.iteye.com/blog/680708
linux下ant的安装 http://hanqunfeng.iteye.com/blog/668133
linux下redis的安装 http://hanqunfeng.iteye.com/blog/684108
linux下svn的安装 http://hanqunfeng.iteye.com/blog/688295
linux下nginx的安装 http://hanqunfeng.iteye.com/blog/697696
linux下graphviz的安装 http://hanqunfeng.iteye.com/blog/869293
linux下doxygen的安装 http://hanqunfeng.iteye.com/blog/874154
linux下maven的安装 http://www.blogjava.net/caojianhua/archive/2011/04/02/347559.html
1。下载
下载地址:http://ant.apache.org/bindownload.cgi 下载apache-ant-1.8.1-bin.tar.gz(当前最新版本),将该下载包拷贝到/usr/local下(随意了,找个地方就好)
2。解压
cd /usr/local
tar -zxvf apache-ant-1.8.1-bin.tar.gz
解压后会在/usr/local 下生成一个文件夹apache-ant-1.8.1
3。配置环境变量
(ant是基于java的,所以要先确保系统中已经安装了jdk)
vi /etc/profile,如下所示
# System wide environment and startup programs, for login setup # Functions and aliases go in /etc/bashrc JAVA_HOME=/usr/java/jdk JAVA_BIN=/usr/java/jdk/bin PATH=$JAVA_HOME/bin:$PATH CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export JAVA_HOME JAVA_BIN PATH CLASSPATH
添加如下内容:
ANT_HOME=/usr/local/apache-ant-1.8.1 PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$PATH
export JAVA_HOME JAVA_BIN ANT_HOME PATH CLASSPATH
修改后如下所示:
# System wide environment and startup programs, for login setup # Functions and aliases go in /etc/bashrc JAVA_HOME=/usr/java/jdk JAVA_BIN=/usr/java/jdk/bin ANT_HOME=/usr/local/apache-ant-1.8.1 PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$PATH CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export JAVA_HOME JAVA_BIN ANT_HOME PATH CLASSPATH
修改后使之生效的方法source /etc/profile
cd /usr/bin
ln -s -f /usr/local/ant/bin/ant
运行ant -version,输出如下内容:
[root@localhost ~]# ant -version Apache Ant version 1.8.1 compiled on April 30 2010
ok,ant配置完成。
欢迎光临娇娇家的美衣阁 http://shop105984718.taobao.com/
本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:linux下ant的安装 - Python技术站