缘起
在看Debian新维护人员手册时,看到aptitude。aptitude也是一个包管理器,很奇怪,和apt-get到底是什么关系,就搜索了一下。
正文
Askubuntu上回到说:
Aptitude是用户级程序,而apt-get被高级用户程序所使用。Aptitude更加用户友好,在apt-get和apt-cache之间添加了抽象层。基于相同的原因,apt-get比dpkg更加友好。实际使用取决用户知识和什么工作的更好。Aptitude和apt-get使用相同的软件仓库。
一般而言:User <- aptitude <- apt-get / apt-cache <- dpkg .
apt-get和aptitude都是dpkg的前端,两者都很方便,aptitude更新并且更容易使用。Aptitude统一了apt-*的功能,aptitude即可以安装也可以查找,还有一个基于文字的图形界面。
Stackexchange的回答:
Apt-get和aptitude命令行接口相似,后者提供终端菜单接口(上图所示),一些小的区别:
- l aptitude will automatically remove eligible packages, whereas apt-get requires a separate command to do so
- l Aptitude将自动移除符合条件的软件包,而apt-get需要一个单独的名利来处理(autoremove)
- l The commands for upgrade vs. dist-upgrade have been renamed in aptitude to the probably more accurate names safe-upgrade and full-upgrade, respectively.
- l upgrade和dist-upgrade在aptitude中被重新命名为更为确切的 safe-upgrade和full-upgrade
- l aptitude actually performs the functions of not just apt-get, but also some of its companion tools, such as apt-cache and apt-mark.
- l Aptitude实际执行了不止apt-get的功能,也提供相应的对应的工具,例如apt-cache和apt-mark
- l aptitude has a slightly different query syntax for searching (compared to apt-cache)
- l 和apt-cache相比,aptitude的查询语法稍微有点不同
- l aptitude has the why and why-not commands to tell you which manually installed packages are preventing an action that you might want to take.
- l Aptitude拥有why和why-not命令来提示手动安装的包可能妨碍将要采取的行动
- l If the actions (installing, removing, updating packages) that you want to take cause conflicts, aptitude can suggest several potential resolutions. apt-get will just say "I'm sorry Dave, I can't allow you to do that."
- l 如果将要采取的行动(安装,移除和升级)将会导致冲突。Aptitude将提供一些潜在的解决方案。apt-get只是告述你“抱歉,你不能这么做!”
In short, aptitude more properly belongs in the category with Synaptic and other higher-level package manager frontends. It just happens to also have a command-line interface that resembles apt-get.
简而言之,apttiude更加接近Synaptic这样的高级软件包管理前端,只是碰巧他的命令行接口和apt-get类似。
什么是wajig, What is wajig?
Remember how I mentioned those "companion" tools like apt-cache and apt-mark? Well, there's a bunch of them, and if you use them a lot, you might not remember which ones provide which commands. wajig is one solution to that problem. It is essentially a dispatcher, a wrapper around all of those tools. It also applies sudo when necessary. When you say wajig install foo, wajig says "Ok, install is provided by apt-get and requires admin privileges," and it runs sudo apt-get install foo. When you say wajig search foo, wajig says "Ok, search is provided by apt-cache and does not require admin privileges," and it runs apt-cache search foo. If you use wajig instead of apt-get, apt-mark, apt-cache and others, then you'll never have this problem:
记得上面提到的伙伴工具(apt-cache和apt-mark)?很好,如果经常使用它们,你可能不记他们哪些提供命令。wajig是这一问题的解决方案。它本质上是一个调度器,包装所有这些工具。它也需要在必要时应用sudo。当你说wajig安装foo,wajig说“好的,安装由apt-get,需要提供管理员权限,“并且它运行sudo apt-get install foo。当你说wajig搜索foo,wajig说:“好吧,搜索是由apt-cache和不需要管理员权限,“接着它运行apt-cache search foo。如果使用wajig代替apt-get apt-cache以及apt-mark,那么你永远不会有这样的问题:
$ apt-get search foo
E: Invalid operation search
If you want to know what wajig is doing behind the scenes, which tools it is using to implement a particular command, it has --simulate and modes.
如果你想知道wajig在幕后做什么,使用哪些工具来实现特定的命令,wajig提供两种模式:--simulate和--teaching。
Two wajig commands that I often use are wajig listfiles foo and wajig whichpkg /usr/bin/foo.
两个经常使用wajig命令:wajig listfiles foo和wajig which pkg /usr/bin/foo。
小结
aptitude的字符界面是通过ncurses库实现的,不过字符界面可能没有GUI的Synaptic好用,但是ncurses的程序小巧,启动快,占内存小。ncurses可以从http://invisible-island.net/ncurses/,在《Linux程序设计 第四版》中有介绍这个库的简单使用,不过除了在某些服务器程序的图形配置中看到种风格的程序,其他的很少见。此外,aptitude的字符界面意外的好用。