Product SiteDocumentation Site

6.4. 前置:aptitudesynaptic

APT 是 C++ 写成程序,甚源代码在 libapt-pkg 共享程序库内。以此共享程序库创建读者接口 (前置),因为很容易再利用在程序库内的源代码。过去 apt-get 只当做 libapt-pkg 的测试前置,但此事实也渐趋模糊。

6.4.1. aptitude

aptitude 是交互程序,可用于终端机的半图形模式可浏览已安装与可得软件包,搜索所有可用信息,并选择安装或移除的软件包。此程序专为管理者而设计,缺省的对象比 apt-get 的对象更聪慧,且其接口更容易理解。
The aptitude 软件包管理者

图 6.1. The aptitude 软件包管理者

When it starts, aptitude shows a list of packages sorted by state (installed, non-installed, or installed but not available on the mirrors — other sections display tasks, virtual packages, and new packages that appeared recently on mirrors). To facilitate thematic browsing, other views are available. In all cases, aptitude displays a list combining categories and packages on the screen. Categories are organized through a tree structure, whose branches can respectively be unfolded or closed with the Enter, [ and ] keys. + should be used to mark a package for installation, - to mark it for removal and _ to purge it (note that these keys can also be used for categories, in which case the corresponding actions will be applied to all the packages of the category). u updates the lists of available packages and Shift+u prepares a global system upgrade. g switches to a summary view of the requested changes (and typing g again will apply the changes), and q quits the current view. If you are in the initial view, this will effectively close aptitude.
键入 / 及搜索的键词,就能搜索软件包。键词对应至软件包的名称,也可应用于描述内容 (若前置 ~d、区块 (前置 ~s) 或文档内的其他字词。同样的键词可以筛选显示软件包的清单:键入 l 键 (如同在 limit 之内) 与其他键词。
管理 Debian 软件包的 “自动旗标” (见 第 6.2.7 节 “自动追踪已安装的软件包”),对 aptitude 而言是小事一椿。可以用 Shift+m 浏览已安装并标示为自动的软件包或以 m 键移除标示。在软件包清单内,“自动软件包” 标示为 “A”。此功能也可简单看到机器内正在使用的软件包,不必看那些程序库与相依性繁琐的细节。相关的键词可以与 l (启动筛选模式) 一起使用的是 ~i!~M。它的作用是只看已安装的软件包 (~i) 不是被标示为自动(!~M) 的软件包。

6.4.1.1. 管理推荐、建议与工作

Another interesting feature of aptitude is the fact that it respects recommendations between packages while still giving users the choice not to install them on a case by case basis. For example, the gnome package recommends brasero (among others). When you select the former for installation, the latter will also be selected (and marked as automatic if not already installed on the system). Typing g will make it obvious: brasero appears on the summary screen of pending actions in the list of packages installed automatically to satisfy dependencies. However, you can decide not to install it by deselecting it before confirming the operations.
此推荐追踪功能不适用于更新。例如,若 gnome 新版建议一个不包括稍前版本的软件包,就不会安装它。然而,还是列在屏幕,管理者仍可点击并安装它。
Suggestions between packages are also taken into account, but in a manner adapted to their specific status. For example, since gnome suggests empathy, the latter will be displayed on the summary screen of pending actions (in the section of packages suggested by other packages). This way, it is visible and the administrator can decide whether to take the suggestion into account or not. Since it is only a suggestion and not a dependency or a recommendation, the package will not be selected automatically — its selection requires a manual intervention from the user (thus, the package will not be marked as automatic).
在同样的精神下,记得 aptitude 以智能的手法使用工作的概念。在屏幕的软件包清单中显示工作,可以安装或移除选定的完整工作,或浏览包括选定较小工作的软件包清单。

6.4.1.2. 较佳的解决算法

总结本段的内容,在解决困难情境时,aptitude 的演算较 apt-get 更为复杂。需要运行一组工作且可能带领至另个支离的系统,aptitude 评估若干可能的状况以递减关联的方式呈现。然而,这些算法不是失败的证明。幸运的是,总有手动选择运行的可能。现在的选择带领至矛盾的地方时,屏幕的上方就指出若干 “破碎” 的软件包 (and you can directly navigate to those packages by pressing b)。就可能以人工方式创建解决此问题的方案。尤其是,可以按 Enter 键选取近用多个可用的版本。选定的版本可以解决问题,就勇敢不迟疑地使用其功能。破碎软件包渐趋于零后,您可安全地进入待决区的摘要画面,于使用前再次确认。

6.4.2. synaptic

synaptic 是 Debian 的软件包图形管理器,在 GTK+/GNOME 的基础上提供清楚有效的图形接口。它以很多的立即可用筛选器提供快速近用添加的软件包、安装软件包、可升级软件包、过时软件包等。经由这些清单浏览,选定对软件包的工作 (安装、升级、移除、清除);不会立即运行此等工作,但把它们放入工作清单。单键按下可运行的工作,接着就可运行。
synaptic 软件包管理器

图 6.2. synaptic 软件包管理器