如何将 Apache Ant 安装到 Linux (Redhat CentOS) 服务器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14325308/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to install Apache Ant to Linux (Redhat CentOS) server?
提问by user1893185
Just as a preface, sorry if I am missing something obvious. I am mainly a PHP/Python programmer but am doing server config for a friend's startup.
作为序言,对不起,如果我遗漏了一些明显的东西。我主要是一名 PHP/Python 程序员,但正在为朋友的启动做服务器配置。
I only have left to install Apache Ant on my friend's Linux VPS server (he wants to compile Android apps on server- just a note I have already somehow manged to get the JDK and LAMP that would also be necessary).
我只剩下在我朋友的 Linux VPS 服务器上安装 Apache Ant(他想在服务器上编译 Android 应用程序 - 只是一个说明,我已经以某种方式设法获得了也需要的 JDK 和 LAMP)。
When I did some digging on how to get Ant, this was all I got that really met my needs: http://ant.apache.org/manual/install.html#jpackage
当我对如何获得 Ant 进行了一些挖掘时,这就是我真正满足我的需求的全部内容:http: //ant.apache.org/manual/install.html#jpackage
Can someone give me some kind of push on what to do at all? Maybe a wget with the appropriate link? Anything at all is appreciated.
有人可以给我一些推动做什么吗?也许是带有适当链接的 wget?任何东西都值得赞赏。
Thanks in advance to all.
在此先感谢大家。
采纳答案by David W.
Did you search for the package apache-ant in your RPM database?
您是否在 RPM 数据库中搜索了 apache-ant 包?
If you're not using your RPM for installing packages (and why wouldn't you), you can download Ant directly from Apache. (Note that there are directions for JPackage RPMs too. Just in case you change your mind about not using RPMs.
如果您不使用 RPM 安装软件包(为什么不使用),您可以直接从Apache下载 Ant 。(请注意,也有 JPackage RPM 的说明。以防万一您改变主意不使用 RPM。
Ant is a Java program, so you must have a Java JDK installed (Ant will run under the JRE, but you couldn't build Java apps with that), and make sure that the java
command is in your Path. However, that also means that there is no special version of the Ant binary for each platform, so it's much easier to install.
Ant 是一个 Java 程序,因此您必须安装 Java JDK(Ant 将在 JRE 下运行,但您无法使用它构建 Java 应用程序),并确保该java
命令在您的路径中。但是,这也意味着每个平台都没有特殊版本的 Ant 二进制文件,因此安装起来要容易得多。
Download and extract the Ant archive to a suitable directory (/opt
or /usr/local
or /usr/lib
or whatever standard you're using). Inside the archive, when unpacked, will be a bin
directory. Those files under bin
are mainly shell scripts (the ones that end with *.bat
are Windows Batch files, you can ignore those). Just execute those.
下载 Ant 存档并将其解压缩到合适的目录(/opt
或/usr/local
或/usr/lib
您正在使用的任何标准)。解压后,存档内部将是一个bin
目录。下面的文件bin
主要是shell脚本(以*.bat
Windows Batch结尾的文件,可以忽略)。只执行那些。
I like to symbolically link those files under Apache-Ant's bin
directory to a similar name under /usr/local/bin
directory. That way, you don't need to put /usr/local/apache-ant-1.8.3/bin
in your $PATH
.
我喜欢将 Apache-Antbin
目录下的这些文件象征性地链接到目录下的类似名称/usr/local/bin
。这样,你不需要把/usr/local/apache-ant-1.8.3/bin
你的$PATH
。
And that's really about it.
就是这样。
回答by gareth_bowles
Just follow the "Short Story" section at the top of the page you referenced:
只需按照您引用的页面顶部的“短篇小说”部分即可:
To get up and running with the binary edition of Ant quickly, follow these steps:
要快速启动并运行 Ant 的二进制版本,请执行以下步骤:
Make sure you have a Java environment installed, See System Requirementsfor details.
确保您已安装 Java 环境,有关详细信息,请参阅系统要求。
Download Ant. See Binary Editionfor details.
下载蚂蚁。有关详细信息,请参阅二进制版本。
Uncompress the downloaded file into a directory.
将下载的文件解压到一个目录中。
Set environmental variables JAVA_HOME to your Java environment, ANT_HOME to the directory you uncompressed Ant to, and add ${ANT_HOME}/bin (Unix) or %ANT_HOME%/bin (Windows) to your PATH. See Setupfor details.
将环境变量 JAVA_HOME 设置为您的 Java 环境,将 ANT_HOME 设置为您将 Ant 解压缩到的目录,并将 ${ANT_HOME}/bin (Unix) 或 %ANT_HOME%/bin (Windows) 添加到您的 PATH。有关详细信息,请参阅设置。
Optionally, from the ANT_HOME directory run ant -f fetch.xml -Ddest=system to get the library dependencies of most of the Ant tasks that require them. If you don't do this, many of the dependent Ant tasks will not be available. See Optional Tasksfor details and other options for the -Ddest parameter.
或者,从 ANT_HOME 目录运行 ant -f fetch.xml -Ddest=system 以获取大多数需要它们的 Ant 任务的库依赖项。如果不这样做,许多依赖的 Ant 任务将不可用。有关-Ddest 参数的详细信息和其他选项,请参阅可选任务。
Optionally, add any desired Antlibs. See Ant Librariesfor a list. Note that the links in the list above will give more details about each of the steps, should you need them. Or you can just continue reading the rest of this document.
(可选)添加任何所需的 Antlib。有关列表,请参阅Ant 库。请注意,如果您需要,上面列表中的链接将提供有关每个步骤的更多详细信息。或者您可以继续阅读本文档的其余部分。