如何从apt-get autoremove中排除包?
我遇到的情况是apt-get autoremove
要删除的孤立包列表包含我想要保留的包。 显然我不小心删除了一个依赖它的包。 我现在如何将包标记为明确需要,以便apt-get autoremove
不会删除它?
使用apt-mark
$ man apt-mark ... manual manual is used to mark a package as being manually installed, which will prevent the package from being automatically removed if no other packages depend on it.
所以
sudo apt-mark manual
现在autoremove
不会删除它。
撤销
sudo apt-mark auto
现在autoremove
将删除包,如果它不是任何其他包的依赖项。
Google的一些尝试提出了一个解决方案 :
可以只显式安装:
sudo apt-get install
或标记为手动安装通过
sudo apt-mark manual
apt
不会重新安装,输出看起来像:
$ sudo apt-get install tmux Reading package lists... Done Building dependency tree Reading state information... Done tmux is already the newest version. tmux set to manually installed.