我知道这是一篇过时的文章,但是由于我最近遇到了类似的问题,所以我希望分享自己的解决方案,以希望将来有人发现它有用。
如果通过aptitude安装了软件包,它将自动为依赖项分配标志(自动),当您再次尝试删除软件包时,它将尝试删除所有仍设置了auto标志的依赖项。
如您所见,我要删除的是zabbix:
uman@mango:~$ sudo aptitude purge zabbix-server-mysql zabbix-frontend-php
The following packages will be REMOVED:
apache2{u} dbconfig-common{u} fping{u} javascript-common{u} libhtml-template-perl{u} libiksemel3{u} libjs-prototype{u}
libjs-scriptaculous{u} libopenipmi0{u} libt1-5{u} mysql-server{u} mysql-server-5.1{u} mysql-server-core-5.1{u} php5{u} php5-gd{u}
php5-mysql{u} snmpd{u} wwwconfig-common{u} zabbix-frontend-php{p} zabbix-server-mysql{p}
0 packages upgraded, 0 newly installed, 20 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 44.9 MB will be freed.
Do you want to continue? [Y/n/?]
如果我们查找apache包,它看起来像这样
uman@mango:~$ aptitude search ^apache2
i A apache2 - Apache HTTP Server metapackage
<snip>
第一个标志“ i”告诉我们已安装apache
,下一个标志“ A”代表自动安装
因此,为了解决此问题而不卸载apache,mysql和php,我们可以使用aptitude删除auto标志,如下所示:
uman@mango:~$ sudo aptitude unmarkauto apache2 mysql-server php5
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
现在,在删除zabbix软件包时,它看起来像这样:
uman@mango:~$ sudo aptitude purge zabbix-server-mysql zabbix-frontend-php
The following packages will be REMOVED:
dbconfig-common{u} fping{u} javascript-common{u} libiksemel3{u} libjs-prototype{u} libjs-scriptaculous{u} libopenipmi0{u} libt1-5{u}
php5-gd{u} wwwconfig-common{u} zabbix-frontend-php{p} zabbix-server-mysql{p}
0 packages upgraded, 0 newly installed, 12 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 16.6 MB will be freed.
Do you want to continue? [Y/n/?]
请查看手册页以了解更多详细信息