I've got several Debian servers, and I want to ensure that an X server never gets installed on them. Sometimes when I'm installing a package, it has dependencies that include X. Is there any good way to make sure that the X server never gets installed? I'd prefer that the X11 libraries not get installed either, since X forwarding should never be enabled.
Putting a package on hold does not work (very well) to achieve this. It does not cover all tools in a satisfactory manner. For example aptitude on command-line completely ignores the previous invocation of
The best way in my opinion is to create a fake package (named for example "unwanted-pkg") that conflicts with all the packages that you don't want and to install it (with
You can use a tool like "equivs" to create the fake package easily. See
You can conflict with the low-level dependencies common to all unwanted packages to avoid listing each individual package (or use virtual package like xserver-xorg-video-2).
Note that pinning does not work to solve this problem. If you do
Using a regexp in the Package field does not work (except for "*" alone, in which case you have some other requirements in the Pin field).
You can use apt pinning to prevent certain packages from being installed. Try putting this in
Package: xserver-xorg* Pin-Priority: -100
Should prevent installing all xserver-xorg* packages.
See section 7.12, "How do I put a package on hold?"
If you 'hold' a currently uninstalled package, it will never be installed.