How to restrict a specific package from installing (apt pinning)

I tend to be very picky so there are a couple of packages which I do not want installed on my machines:

  • msttcorefonts: the Microsoft-like fonts. If you have those installed, Firefox will use them and you will get ugly windows-like font on most websites which I personally hate.
  • wine: Application to run windows programs on linux. For security reasons.
  • postfix: a mail server. Just because I do not want to run a mail server on my netbook.
  • …and some other

The best way to restrict those packages from being installed is through Apt Pinning.

Apt pinning

It is very easy to pin packages and restrict them from being installed.
You will need to edit /etc/apt/preferences and add something like this:

Package: msttcorefonts
Pin: version  0.0
Pin-Priority: -1
 
Package: ttf-liberation
Pin: version  0.0
Pin-Priority: -1
 
Package: ttf-mscorefonts-installer
Pin: version  0.0
Pin-Priority: -1
 
Package: wine
Pin: version  0.0
Pin-Priority: -1
 
Package: postfix
Pin: version  0.0
Pin-Priority: -1

Pin-Priority: -1 restricts the given version from being installed, and the version 0.0 does not exist and should be a lower version than any versions of the given packages. As a conclusion, they will never be installed.

Be careful what you pin, though, as you might be too restrictive and could prevent installing or upgrading other useful packages.

Leave a comment

Name: (Required)

eMail: (Required)

Website:

Comment: