13

I am new to Ubuntu and I am trying to install Apache ANT in Ubuntu

I downloaded the package (apache-ant-1.9.4-bin.tar.gz) and in a terminal I gave a command like this

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

I got these two errors

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'

and if I use

/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$

How should I proceed?

Vinodh Kumar
  • 233
  • 1
  • 2
  • 6

2 Answers2

17

The file apache-ant-1.9.4-bin.tar.gz is not installable package. A installable package ends with .deb.

You can install ant via the package manager.

But first you have to fix a bug in your system:

Open a terminal and run this command

sudo nano /etc/apt/sources.list

Remove the line (line 2)

sudo apt-get install python-software-properties$

and in line 35 and 36 add a # at the beginning of the line:

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

and remove all the $ from your sources.list

Then run the command:

sudo apt-get update

Then install ant:

sudo apt-get install ant
A.B.
  • 92,275
  • 1
    It's a bit misleading to say that .tar.gz normally contains the source code as almost all generic binary releases for Linux are also .tar.gz -archives just like in this case. – juzzlin Apr 20 '15 at 06:53
  • Thanks A.B It works fine....problem solved. thanks a lot – Vinodh Kumar Apr 20 '15 at 07:02
  • @user205301 OK, removed – A.B. Apr 20 '15 at 07:08
  • @VinodhKumar Were you satisfied with my answer? Then give me a upvote (∧). If I could solve your problem, then it would be nice if you'd mark my answer (✓). ;) – A.B. Apr 20 '15 at 07:27
  • I couldn't vote up your answer. because it needs 35 reputations,I accepted your answer is right. – Vinodh Kumar Apr 20 '15 at 09:03
  • The $ signs represent the EOL character. Not sure why it was pasted here, perhaps vim ":set list" – IceArdor Jul 13 '16 at 18:19
10

Simply: sudo apt-get install ant

If you need a newer version then you have to extract the .tar.gz you downloaded to somewhere and run ant from there.

tar xzvf apache-ant-1.9.4-bin.tar.gz extracts the archive. It's basically just a ZIP-archive. You can extract it also graphically from the file browser.

juzzlin
  • 1,293
  • i tried this command 'sudo apt-get install ant' but i got this error Unable to locate package ant – Vinodh Kumar Apr 20 '15 at 06:09
  • Try to run sudo apt-get update first. I have Ubuntu 14.04 and I just installed ant with apt-get so the package should be there. – juzzlin Apr 20 '15 at 06:10
  • i tried sudo apt-get update i got this error E: Type 'sudo' is not known on line 2 in source list /etc/apt/sources.list E: The list of sources could not be read. – Vinodh Kumar Apr 20 '15 at 06:16
  • How can he run the command sudo apt-get update if there is an error?Read the question. – A.B. Apr 20 '15 at 06:16
  • @A.B I added the sources.list error line in the questions..check it – Vinodh Kumar Apr 20 '15 at 06:22
  • The line "sudo apt-get install python-software-properties$" doesn't belong to your sources.list. – juzzlin Apr 20 '15 at 06:31
  • @A.B. That wasn't the original question! – juzzlin Apr 20 '15 at 06:35
  • Read the change log. – A.B. Apr 20 '15 at 06:36
  • @A.B. The original post was about installing a .tar.gz with apt-get. The broken sources.list was added afterwards and is a separate problem so please pay attention – juzzlin Apr 20 '15 at 06:39
  • The first post: sudo apt-get update E: Type 'sudo' is not known on line 2 in source list /etc/apt/sources.list E: The list of sources could not be read. – A.B. Apr 20 '15 at 06:42
  • What the hell...I swear I didn't see anything like that. – juzzlin Apr 20 '15 at 06:44
  • Maybe I just read only the first part of the problem. My bad. Sorry. – juzzlin Apr 20 '15 at 06:46
  • @user205301 Upgrade something your answer. Describe how the installation works with the archive. Then I'll give you an upvote. – A.B. Apr 20 '15 at 07:26