Debian / Ubuntu Linux apt-get: Blacklist a Package From Installing

www‮‬.lautturi.com
Debian / Ubuntu Linux apt-get: Blacklist a Package From Installing

To blacklist a package from installing on a Debian or Ubuntu system using the apt-get command, you can use the following steps:

  1. Create a file called /etc/apt/preferences.d/<package>.pref and add the following content to the file, replacing <package> with the name of the package you want to blacklist:
Package: <package>
Pin: version *
Pin-Priority: -1

This will prevent apt-get from installing or upgrading the <package> package.

  1. Update the package list on your system by running the following command:
sudo apt-get update
  1. To test that the package is blacklisted, try to install or upgrade the package using apt-get:
sudo apt-get install <package>

or

sudo apt-get upgrade <package>

This should produce an error message stating that the package is blacklisted.

Note: Blacklisting a package will not uninstall the package if it is already installed on your system. To remove the package, you can use the apt-get command with the remove or purge option.

sudo apt-get remove <package>

or

sudo apt-get purge <package>

These commands will remove the package and its configuration files from your system.

Created Time:2017-10-28 14:02:26  Author:lautturi