To blacklist a package from installing on a Debian or Ubuntu system using the apt-get
command, you can use the following steps:
/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.
sudo apt-get update
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 theremove
orpurge
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.