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.

I want to restrict the packages installable from a repo, eg restrict some packages to the main Ubuntu repos, even if they are available from launchpad or some other third party repos, something like pinning some packages to certain repository.

Normally the repository last added repo takes over all the packages which were available in other earlier repos.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

To set up AptPreferences for a set of packages add a new file in /etc/apt/preferences.d/.

sudo gedit /etc/apt/preferences.d/my-packages-pin

Add add the following lines in that file:

Package: package1 package2
Pin: release o=Ubuntu
Pin-Priority: 900

I will prevent ppa versions to replace packages provided by the main Ubuntu archives

To check if the package pin version run:

sudo apt-cache policy package1

Visit https://help.ubuntu.com/community/PinningHowto

share|improve this answer
1  
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. –  Mitch Mar 11 at 11:19
    
You're right, sorry about that. I'll elaborate a better answer. –  Sylvain Pineau Mar 11 at 11:43

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.