如何在Ubuntu 14.04中安装ANT


13

我是Ubuntu新手,正在尝试在Ubuntu中安装Apache ANT

我下载了软件包(apache-ant-1.9.4-bin.tar.gz),并在终端中输入了以下命令

sudo apt-get install apache-ant-1.9.4-bin.tar.gz

我遇到了这两个错误

E: Unable to locate package apache-ant-1.9.4-bin.tar.gz
E: Couldn't find any package by regex 'apache-ant-1.9.4-bin.tar.gz'

如果我用

/etc/apt/sources.list

1   deb-src http://ppa.launchpad.net/klaus-vormweg/bluefish/ubuntu trusty main$
 2  sudo apt-get install python-software-properties$
 3  # deb cdrom:[Ubuntu 14.04 LTS _Trusty Tahr_ - Release amd64 (20140417)]/ trusty main restricted$
 4  $
 5  # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to$
 6  # newer versions of the distribution.$
 7  $
 8  ## Major bug fix updates produced after the final release of the$
 9  ## distribution.$
10  $
11  ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu$
12  ## team. Also, please note that software in universe WILL NOT receive any$
13  ## review or updates from the Ubuntu security team.$
14  $
15  ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu $
16  ## team, and may not be under a free licence. Please satisfy yourself as to $
17  ## your rights to use the software. Also, please note that software in $
18  ## multiverse WILL NOT receive any review or updates from the Ubuntu$
19  ## security team.$
20  $
21  ## N.B. software from this repository may not have been tested as$
22  ## extensively as that contained in the main release, although it includes$
23  ## newer versions of some applications which may provide useful features.$
24  ## Also, please note that software in backports WILL NOT receive any review$
25  ## or updates from the Ubuntu security team.$
26  $
27  $
28  ## Uncomment the following two lines to add software from Canonical's$
29  ## 'partner' repository.$
30  ## This software is not part of Ubuntu, but is offered by Canonical and the$
31  ## respective vendors as a service to Ubuntu users.$
32  deb http://archive.canonical.com/ubuntu trusty partner$
33  deb-src http://archive.canonical.com/ubuntu trusty partner$
34  $
35   This software is not part of Ubuntu, but is offered by third-party$
36  developers who want to ship their latest software.$
37  deb http://extras.ubuntu.com/ubuntu trusty main$
38  deb-src http://extras.ubuntu.com/ubuntu trusty main$
39  deb http://archive.ubuntu.com/ubuntu trusty universe main multiverse restricted$
40  deb-src http://archive.ubuntu.com/ubuntu trusty universe main restricted multiverse #Added by software-properties$
41  deb http://security.ubuntu.com/ubuntu/ trusty-security universe main multiverse restricted$
42  deb http://archive.ubuntu.com/ubuntu trusty-updates universe main multiverse restricted$
43  deb http://archive.ubuntu.com/ubuntu trusty-proposed universe main multiverse restricted$
44  deb http://archive.ubuntu.com/ubuntu trusty-backports universe main multiverse restricted$

我应该如何进行?


您无法使用apt-get安装.tar.gz归档文件。Apt-get从软件包存储库安装软件包。
2015年

好的,那么我如何在ubuntu中安装Apache ANT的任何其他步骤
Vinodh Kumar

发布的内容/etc/apt/sources.list。有在第2行的错误
AB

在此处签出完整清晰的步骤stackoverflow.com/a/51780186/3089950
IRSHAD

Answers:


15

该文件apache-ant-1.9.4-bin.tar.gz不是可安装的软件包。可安装的软件包以结尾.deb

您可以通过软件包管理器安装ant

但是首先,您必须修复系统中的错误:

打开终端并运行此命令

sudo nano /etc/apt/sources.list

删除线(第2行)

sudo apt-get install python-software-properties$

在第35和36行#的开头添加a :

# This software is not part of Ubuntu, but is offered by third-party
# developers who want to ship their latest software.

并删除所有$从你的sources.list

然后运行命令:

sudo apt-get update

然后安装ant

sudo apt-get install ant

1
误以为.tar.gz通常包含源代码,因为在这种情况下,几乎所有用于Linux的通用二进制发行版也都是.tar.gz -archives。
2015年

谢谢AB它工作正常....问题已解决。非常感谢
Vinodh Kumar 2015年

@ user205301 OK,已删除
AB

@VinodhKumar您对我的回答满意吗?然后给我点赞(∧)。如果我能解决您的问题,那么请您标记我的答案(✓),这将是很好的。;)
AB

我不能投票赞成你的答案。因为它需要35个信誉,所以我接受您的回答是正确的。
Vinodh Kumar 2015年

9

只是: sudo apt-get install ant

如果您需要更新的版本,则必须解压缩下载到.tar.gz的文件并在此处运行ant。

tar xzvf apache-ant-1.9.4-bin.tar.gz提取档案。它基本上只是一个ZIP存档。您也可以从文件浏览器中以图形方式提取它。


我尝试使用此命令'sudo apt-get install ant',但出现此错误无法找到软件包ant
Vinodh Kumar 2015年

尝试先运行sudo apt-get update。我有Ubuntu 14.04,我刚刚用apt-get安装了ant,所以该软件包应该在那里。
2015年

我尝试了sudo apt-get update我收到了此错误E:在源列表/etc/apt/sources.list的第2行上未知类型'sudo'E:无法读取源列表。
Vinodh Kumar

sudo apt-get update如果出现错误,他如何运行命令?阅读问题。
AB

@AB我在问题中添加了sources.list错误行
..检查
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.