0

Sometimes a package I want from a PPA has the same name as a different package in another repository. Is there a way I can tell apt to download a package of packageName from a certain repo?

I'd prefer to just use apt, but I suppose aptitude or some other tool would work okay. The simpler the better.

2
  • check here askubuntu.com/questions/135339/… Dec 17, 2013 at 3:09
  • 1
    One thing to ALWAYS check is if the PPA has a higher version number than the version in Ubuntu. If it does, you won't need to worry about specifying it. (Case in point, launchpad.net/~nginx/+archive/stable has newer version numbers for nginx than Ubuntu everywhere except in Trusty, so the PPA will by default always override the version in Ubuntu's repos for a given release (except Trusty at this time))
    – Thomas Ward
    Dec 17, 2013 at 3:37

1 Answer 1

0

There are two ways:

  1. Pinning -> this is more a permanent solution, you can remix it into something adhoc and it's detailed at the end.
  2. Using aweso... err aptitude!

Using aptitude

Lets say the package is from some origin, lets call this ppa.launchpad.net. So, how to tell aptitude to install the package form that origin:

sudo aptitude install '?narrow(nameofthepackage, ?origin(ppa.launchpad.net))'

You can change narrow for and. Also, you can use other selectors like version string, etc.

A complete reference of all the features of aptitude here:


Using pinning.

This requires that you write the preference file before hand and you should add pretty options arguments:

You must write your pinning file:

Package: somepackage
Pin: origin ppa.launchpad.net
Pin-Priority: 1000

Now with apt-get:

sudo apt-get install -o Dir::Etc::Preferences=/path/to/pinningFile somepackage

Done.

4
  • /path/to/file goes... where? The pinning file?
    – Seth
    Dec 17, 2013 at 3:32
  • Do make a note that if the version number in the PPA is higher than the package version number in Ubuntu's repos, dpkg will prefer the higher package version number, whether you're pinning or not. (Per my comment above on the question, where there's an example of this explained)
    – Thomas Ward
    Dec 17, 2013 at 3:46
  • @ThomasW. I'm pinning a specific repository (ie, Install always from here and ignore everything else), and apt will do the impossible to meets my demands. ;)
    – Braiam
    Dec 17, 2013 at 3:49
  • True, however, I just wanted to make that known, that for older releases like Precise, that isn't always going to be a problem :)
    – Thomas Ward
    Dec 17, 2013 at 3:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .