Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
    
check here askubuntu.com/questions/135339/… –  hbdgaf Dec 17 '13 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 W. Dec 17 '13 at 3:37

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
    
/path/to/file goes... where? The pinning file? –  Seth Dec 17 '13 at 3:32
    
@Seth yeah..... –  Braiam Dec 17 '13 at 3:33
    
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 W. Dec 17 '13 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 '13 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 W. Dec 17 '13 at 3:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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