11
30
2011
4

软件管理 aptitude apt 对比

用过 debian 知道 aptitude 软件管理
用过 ubuntu 知道 apt-xxx  软件管理

一直纠结于两者的区别,google 很多,各种说法
看来要求甚解,要 研读 man + 官方文档

下面是 debian 给的官方手册的描述:
http://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_literal_apt_get_literal_literal_apt_cache_literal_vs_literal_aptitude_literal
包含 apt / aptitude 的对比,还有两者的常用命令对比表格

apt 比较轻巧,速度比较快,资源占用较少
证据:
    apt-cache search python
    aptitude search python

对比速度马上见分晓,快的代价:
    apt-cache 搜索出来的格式可读性较差,aptitude 对查询结果进行了对齐,查看更清晰

aptitude 虽然较 apt 有些大,有些稍慢,但是,它的命令统一用 aptitude 管理
不像 apt 那样分隔成多个工具实现不同功能( apt-get / apt-cache / apt-config ... )

还有个喜欢 aptitude 原因:虽然字符上面 aptitude 比 apt-get 多一个
但是,输入 apti TAB 比 apt- TAB 懒些,虽然都用 alias 把常用操作设置了别名

说的软件管理,不得不提 "依赖"

apt 依赖查询比较简洁明了:

# apt-cache depends aptitude
aptitude
  Depends: libapt-pkg4.11
  Depends: libboost-iostreams1.46.1
  Depends: libc6
  Depends: libcwidget3
  Depends: libept1
  Depends: libgcc1
  Depends: libncursesw5
  Depends: libsigc++-2.0-0c2a
  Depends: libsqlite3-0
  Depends: libstdc++6
  Depends: libxapian22
 |Suggests: aptitude-doc-en
  Suggests: <aptitude-doc>
    aptitude-doc-cs
    aptitude-doc-en
    aptitude-doc-es
    aptitude-doc-fi
    aptitude-doc-fr
    aptitude-doc-ja
  Suggests: tasksel
  Suggests: debtags
  Recommends: sensible-utils
  Recommends: apt-xapian-index
  Recommends: libparse-debianchangelog-perl
  Conflicts: <ia32-apt-get>
  Conflicts: <ia32-apt-get:i386>
  Conflicts: aptitude:i386

还有一个 反查 依赖的命令:rdepends
# apt-cache rdepends aptitude
aptitude
Reverse Depends:
  aptitude:i386
  dpkg:i386
  wajig
  ppa-purge
  pkgsync
  ibid
  febootstrap
  fai-server
  daptup
  aptitude-gtk
  aptitude-doc-ja
  aptitude-doc-fr
  aptitude-doc-fi
  aptitude-doc-es
  aptitude-doc-cs
  apt-watch-gnome
  apt-dater-host
  tasksel
  dpkg
  aptitude-doc-en
 |aptitude-dbg
 |apt

aptitude 有个类似的 aptitude why / why-not 但是没有 apt 的这个直观简洁

# aptitude why apt
i   unattended-upgrades Depends apt

# aptitude why aptitude
i   apt Suggests aptitude | synaptic | wajig

# aptitude why-not apt
p   dpkg Provides  dpkg
p   dpkg Suggests  apt
p   apt  Conflicts apt

# aptitude why-not aptitude
p   dpkg     Provides  dpkg
p   dpkg     Suggests  apt
p   apt      Suggests  aptitude | synaptic | wajig
p   aptitude Conflicts aptitude

关于 install / purge / clean 对依赖的处理,man 里面没有细说到依赖解决到什么地步:
上面的 # apt-cache depends aptitude 依赖查询,差不多涵盖了所有的依赖情形:
  Depends: libapt-pkg4.11
  ...
  Suggests: <aptitude-doc>
  ...
  Recommends: sensible-utils
  ...
  Conflicts: aptitude:i386
  ...

apt 和 aptitude 在安装时,只要 depends 的依赖,估计都会安装吧!
depends 好像没有怎么细分,建议 / 推荐 什么的 aptitude 没有自动安装过
apt 估计也是吧,要不不会区分这么多种 "依赖关系" 了!

关于卸载,这位兄台的这篇 blog 对卸载时的依赖处理做了详细通俗易懂的图文并茂的解释:+1

    apt-get remove 与 apt-get autoremove、aptitude remove的不同
    http://www.igigo.net/archives/88

apt 的 autoremove 卸载不在需要的依赖,不知道 autoremove 怎么处理 配置文件?
aptitude 的 purge 会清除不需要的依赖,apt 没用过 purge 测试过

再就是两个 版本升级 有些不同:
aptitude safe-upgrade       apt-get upgrade
aptitude full-upgrade       apt-get dist-upgrade

最后就是 clean 和 autoclean
clean 比 autoclean 打扫的干净些,只要是缓存 clean 通通删除
autoclean 会留最近一次升级的缓存,如果像内核,驱动什么基础包新的不是很完善,可以回退到上个版本
 

Category: Linux | Tags: aptitude apt debian ubuntu linux | Read Count: 5040
WindyWinter 说:
2011年12月01日 19:59

不知道 autoremove 怎么处理 配置文件?
apt-get --purge autoremove ***

Avatar_small
if_else 说:
2011年12月06日 02:17

autoremove 不是处理 配置文件的吧,purge 是删除软件包的同时,删除配置文件吧,autoremove 是处理,依赖的吧!

Avatar_small
nonoob 说:
2012年6月11日 23:42

aptitude不带参数有ui的吧;另外不支持通配符;bash自动补全也非常慢。不过图省事的话一般用aptitude,至少解决了各种依赖关系,界面也比apt-get友好多了。

JKBOhttp://lvii.is-p 说:
2022年8月16日 22:19

National Institute of Open Schooling is also known as short name NIOS. NIOS organization that is established in the year of 1989 by ministry of human resources development, NIOS 11th Model Paper 2023 and it is based of national education policy. This school prepare up of open school learning system has establish its helping hand to the students.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter

Host by is-Programmer.com | Power by Chito 1.3.3 beta | Theme: Aeros 2.0 by TheBuckmaker.com