I used to do something similar with yum on CentOS. I think there was a --enable-repo and --disable-repo param.

Is there something that exists for apt-get install <some pkg> that will restrict to /etc/apt/sources.list.d/<somefile>?


You can do that by pinning the release using /etc/apt/preferences. The man page is apt_preferences. Format is as follows:

 Package: *
 Pin: release o=Debian,a=testing
 Pin-Priority: 900
| improve this answer | |

I don't believe you can do that quickly and easily without a wrapper around apt-get to juggle the sources manually.

One option however is to suffix the package you wish to install with the version number required, which will likely be different in each source.


apt-get install cowsay=3.03-9.2
| improve this answer | |
  • You can also check the versions and what would be installed using apt-cache policy cowsay - then use the resulting version, etc. to specify the package specifically. – Mei Jun 30 '11 at 13:39

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.