Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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… – RobotHumans Dec 17 '13 at 3:09
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, 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 '13 at 3:37
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 So, how to tell aptitude to install the package form that origin:

sudo aptitude install '?narrow(nameofthepackage, ?origin('

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
Pin-Priority: 1000

Now with apt-get:

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


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 Ward 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 Ward Dec 17 '13 at 3:50

Your Answer


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.