apt-get 和 aptitude 有什么区别?

Tho*_*aaf 56 linux debian installation

我不明白为什么最小安装中有两个不同的程序来安装软件。他们不做同样的事情吗?有很大的不同吗?我已经到处阅读以使用 aptitude 而不是 apt-get,但我仍然不知道其中的区别

kat*_*iel 48

aptitude 是 dpkg 的包装器,就像 apt-get/apt-cache 一样,但它是用于搜索/安装/删除/查询的一站式工具。apt 可能不提供的一些示例:

$ aptitude why libc6
i   w64codecs Depends libc6 (>= 2.3.2)
$ aptitude why-not libc6
Unable to find a reason to remove libc6.

$ aptitude show libc6
Package: libc6
State: installed
Automatically installed: no
Version: 2.9-4ubuntu6
Priority: required
Section: libs
Maintainer: Ubuntu Core developers <ubuntu-devel-discuss@lists.ubuntu.com>
Uncompressed Size: 12.1M
Depends: libgcc1, findutils (>= 4.4.0-2ubuntu2)
Suggests: locales, glibc-doc
Conflicts: libterm-readline-gnu-perl (< 1.15-2), 
tzdata (< 2007k-1), tzdata-etch, nscd (< 2.9)
Replaces: belocs-locales-bin
Provides: glibc-2.9-1
Description: GNU C Library: Shared libraries
 Contains the standard libraries that are used by nearly all programs 
 on the system. This package includes shared versions of the standard 
 C library and the standard math library, as well as many others.
Run Code Online (Sandbox Code Playgroud)

  • 更不用说:$ aptitude changelog bash (10认同)

Mik*_*age 45

mikeage@linode ~$ aptitude -h | tail -n 1
              This aptitude does not have Super Cow Powers.
mikeage@linode ~$ apt-get -h | tail -n 1
                   This APT has Super Cow Powers.
mikeage@linode ~$ aptitude moo
    There are no Easter Eggs in this program.
mikeage@linode ~$ apt-get moo
         (__)
         (oo)
   /------\/
  / |    ||
 *  /\---/\
    ~~   ~~
...."Have you mooed today?"...
mikeage@linode ~$ aptitude -v moo
There really are no Easter Eggs in this program.
mikeage@linode ~$ aptitude -vv moo
Didn't I already tell you that there are no Easter Eggs in this program?
mikeage@linode ~$ aptitude -vvv moo
Stop it!
mikeage@linode ~$ aptitude -vvvv moo
Okay, okay, if I give you an Easter Egg, will you go away?
mikeage@linode ~$ aptitude -vvvvv moo
All right, you win.

                               /----\
                       -------/      \
                      /               \
                     /                |
   -----------------/                  --------\
   ----------------------------------------------
mikeage@linode ~$ aptitude -vvvvvv moo
What is it?  It's an elephant being eaten by a snake, of course. 
Run Code Online (Sandbox Code Playgroud)


Rap*_*zog 19

目前在 Debian 安装程序中使用并在发行说明中推荐的官方工具是aptitude.

Aptitude 提供了一个 curses 界面(在没有任何参数的情况下运行时)和一个命令行界面,几乎可以完成apt-cache/apt-get所做的所有事情。它还具有更好的依赖关系解析器,可让您在多个解决方案之间浏览。即使在使用命令行版本时,您也可以与建议的解决方案进行交互并提供补充命令或提示(例如安装或删除其他人推荐的软件包)。

但是 aptitude 是基于 libapt 库(它不是 dpkg 的直接包装器),因此它取决于apt软件包,因此您不能在没有 apt-get(也在 apt 软件包中)的情况下安装 aptitude。

$ dpkg --status aptitude| grep Depends
Depends: libapt-pkg-libc6.9-6-4.7, [...]
$ dpkg --status apt|grep Provides
Provides: libapt-pkg-libc6.9-6-4.7
$ dpkg --search /usr/lib/libapt-pkg-libc6.9-6.so.4.7 /usr/bin/apt-get
apt: /usr/lib/libapt-pkg-libc6.9-6.so.4.7
apt: /usr/bin/apt-get
Run Code Online (Sandbox Code Playgroud)

要了解有关 apt/dpkg/aptitude 如何交互的更多信息,您可以查看Daniel Burrows(aptitude 的主要作者)制作图表。另一个图表显示了各种包管理工具存储的信息:apt 和 dpkg 状态文件的映射

您还可以阅读我的文章apt-get、aptitude... 为您选择合适的包管理器


Sig*_*num 7

aptitude记住您特意安装的软件包和自动安装的软件包以满足依赖关系。删除软件包 aptitude 将删除那些自动安装的软件包以保持系统整洁。apt-get是不是很聪明。

aptitude一旦您使用不同版本的软件包的不同存储库,它将很快成为不可或缺的工具。想象一下,您正在使用backports.org或像debian-multimedia.org这样的非官方存储库。然后aptitude将显示(在某个包的详细信息页面的底部)可用的版本号并允许您选择一个。

如果您遇到由于使用非官方存储库而导致程序冲突的情况,您将在顶部看到“Broken: ...”显示。你可以输入l~b (limit/flag/broken) 并得到一个相互冲突的包列表。使手动解决冲突变得更加容易。

此外,您可以使用“ l”来限制包列表。想象一下,您正在寻找以“ openoffice ”开头的包,然后按“ l”并键入“ ^openoffice”(这是一个正则表达式),您将只看到这些包。从菜单中选择一个“扁平化套餐清单”,您将很快达到您的目标。

完整的手册非常大,为您提供了更多过滤器和可能性。即使您不知道它们aptitude也是一个方便的替代品apt-get,您可以将其与常用参数一起使用,例如:

aptitude install ... (install or upgrade a package)
aptitude remove ... (remove the binary portions of a package but preserve your /etc configuration)
aptitude purge ... (remove the package completely including your configuration)
Run Code Online (Sandbox Code Playgroud)

  • 实际上,从 Lenny 开始,apt-get 还跟踪仅作为您明确要求的某些内容的依赖项安装的软件包。我自己使用 aptitude,但`apt-get autoremove` 现在删除作为依赖项安装的软件包,该软件包已被删除。 (2认同)

dbr*_*dbr 5

除了在aptitude不带参数的情况下运行时提供漂亮的控制台 UI 之外,它还将各种apt-*命令(和dselect)组合到一个实用程序中。

要搜索软件包并安装它,请使用 apt-get:

apt-cache search somepkg
apt-get install somepkg
Run Code Online (Sandbox Code Playgroud)

..but with aptitude 它是相同的命令:

aptitude search somepkg
aptitude install somepkg
Run Code Online (Sandbox Code Playgroud)

aptitude确实有一些额外的功能,比如aptitude changelog somepkg持有包(以阻止它们被升级)——没有什么是你无法通过其他命令/方法实现的,它只是更加统一和好用。

  • 太糟糕了,它没有等效的“apt-cache 策略”。 (3认同)