I would like to install a package on Ubuntu 10.04.4 but would like to not use the one available in the one repository that I get when I do:

apt-cache policy ${package}

I would actually like to use an older version. So in my search, I would like to exclude the repo that is returned when I run the above command, i.e. search all the other repos.

Also, the above command returns only one option. I was wondering if it always returns just the first (latest) it finds or would it have returned more options from different repos.

>apt-cache policy maven3
  Installed: (none)
  Candidate: 3.2.1-0~ppa1
  Version table:
     3.2.1-0~ppa1 0
        500 http://ppa.launchpad.net/natecarlson/maven3/ubuntu/ lucid/main Packages

I want to install version 3.0.4

  • 1
    You can do apt-get install pkgname=version, but it might be helpful if you were to provide more context on what you are trying to do. – Faheem Mitha May 15 '14 at 19:23
  • what more context can i provide you ?? i want version N-1 and the default version is N... – amphibient May 15 '14 at 19:25
  • I did apt-cache search maven3=3.0.4, that did not return anything – amphibient May 15 '14 at 19:27
  • 1
    What @Braiam said. I'm unclear about your situation. You get one version of maven when you run apt-cache policy and want to run another? Then you need to add a suitable source. – Faheem Mitha May 15 '14 at 19:31
  • 1
    apt-cache policy pkgname returns all the versions of that pkgname it finds in the sources in /etc/apt/sources.list and /etc/apt/sources.list.d. If you want to install 3.0.4 you need a source that has 3.0.4. – Faheem Mitha May 15 '14 at 19:34

Add the source line

deb-src http://ppa.launchpad.net/natecarlson/maven3/ubuntu maverick main

and then run

apt-get source maven3

This will give you the unpacked source directory. Then cd into the source directory try running

debuild -uc -us

You may need to install some build dependencies before proceeding. The listed build dependencies for 3.0.3 are

Build-Depends: cdbs, debhelper (>= 7.0.50~), quilt
  • when i ran apt-get source maven3, i got E: Malformed line 58 in source list /etc/apt/sources.list (dist parse) – amphibient May 15 '14 at 20:06
  • example of other entries: 51 deb http://security.ubuntu.com/ubuntu lucid-security main restricted 52 deb-src http://security.ubuntu.com/ubuntu lucid-security main restricted – amphibient May 15 '14 at 20:09
  • @amphibient the source line might be wrong. i guessed it. What does your current line for maven3 look like? And can we do this in chat? Try using the same source line, replace lucid with maverick and replace deb with deb-src. – Faheem Mitha May 15 '14 at 20:11
  • i uncommented the line in /etc/apt/sources.list.d/natecarlson-maven3-lucid.list, which says deb http://ppa.launchpad.net/natecarlson/maven3/ubuntu lucid main – amphibient May 15 '14 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.