[ 上一页 ] [ 目录 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 下一页 ]
APT 系统有一些前端程序,可以显著简化获取可用于安装或已安装软件包列表的过程,以及查找软件包所属的section、优先级、描述等信息。
但是……我们的目标是学习如何使用纯粹的 APT。那么,如何找到你想安装的软件包的名称呢?
我们有许多资源可以完成这项任务。我们将从 apt-cache 开始。这个程序被 APT 系统用来维护其数据库。我们将简要了解一下它的一些更实际的应用。
例如,假设你想回忆一下雅达利 2600 的美好时光。你想使用 APT 安装一个雅达利模拟器,然后下载一些游戏。你可以这样做
# apt-cache search atari atari-fdisk-cross - Partition editor for Atari (running on non-Atari) circuslinux - The clowns are trying to pop balloons to score points! madbomber - A Kaboom! clone tcs - Character set translator. atari800 - Atari emulator for svgalib/X/curses stella - Atari 2600 Emulator for X windows xmess-x - X binaries for Multi-Emulator Super System
我们找到了一些与我们正在寻找的内容相关的软件包,以及简要描述。要获得关于特定软件包的更多信息,我可以接着使用
# apt-cache show stella Package: stella Priority: extra Section: non-free/otherosfs Installed-Size: 830 Maintainer: Tom Lear <tom@trap.mtview.ca.us> Architecture: i386 Version: 1.1-2 Depends: libc6 (>= 2.1), libstdc++2.10, xlib6g (>= 3.3.5-1) Filename: dists/potato/non-free/binary-i386/otherosfs/stella_1.1-2.deb Size: 483430 MD5sum: 11b3e86a41a60fa1c4b334dd96c1d4b5 Description: Atari 2600 Emulator for X windows Stella is a portable emulator of the old Atari 2600 video-game console written in C++. You can play most Atari 2600 games with it. The latest news, code and binaries for Stella can be found at: http://www4.ncsu.edu/~bwmott/2600
在这个输出中,你可以看到关于你想要(或不想要)安装的软件包的许多细节,以及软件包的完整描述。如果软件包已经安装在你的系统上,并且有更新的版本,你将看到关于两个版本的信息。例如
# apt-cache show lilo Package: lilo Priority: important Section: base Installed-Size: 271 Maintainer: Russell Coker <russell@coker.com.au> Architecture: i386 Version: 1:21.7-3 Depends: libc6 (>= 2.2.1-2), debconf (>=0.2.26), logrotate Suggests: lilo-doc Conflicts: manpages (<<1.29-3) Filename: pool/main/l/lilo/lilo_21.7-3_i386.deb Size: 143052 MD5sum: 63fe29b5317fe34ed8ec3ae955f8270e Description: LInux LOader - The Classic OS loader can load Linux and others This Package contains lilo (the installer) and boot-record-images to install Linux, OS/2, DOS and generic Boot Sectors of other OSes. . You can use Lilo to manage your Master Boot Record (with a simple text screen) or call Lilo from other Boot-Loaders to jump-start the Linux kernel. Package: lilo Status: install ok installed Priority: important Section: base Installed-Size: 190 Maintainer: Vincent Renardias <vincent@debian.org> Version: 1:21.4.3-2 Depends: libc6 (>= 2.1.2) Recommends: mbr Suggests: lilo-doc Description: LInux LOader - The Classic OS loader can load Linux and others This Package contains lilo (the installer) and boot-record-images to install Linux, OS/2, DOS and generic Boot Sectors of other OSes. . You can use Lilo to manage your Master Boot Record (with a simple text screen) or call Lilo from other Boot-Loaders to jump-start the Linux kernel.
请注意,列表中的第一个是可用的软件包,第二个是已安装的软件包。要获得关于软件包的更一般信息,你可以使用
# apt-cache showpkg penguin-command Package: penguin-command Versions: 1.4.5-1(/var/lib/apt/lists/download.sourceforge.net_debian_dists_unstable_main_binary-i386_Packages)(/var/lib/dpkg/status) Reverse Depends: Dependencies: 1.4.5-1 - libc6 (2 2.2.1-2) libpng2 (0 (null)) libsdl-mixer1.1 (2 1.1.0) libsdl1.1 (0 (null)) zlib1g (2 1:1.1.3) Provides: 1.4.5-1 - Reverse Provides:
而要仅仅找出它依赖于哪些软件包
# apt-cache depends penguin-command penguin-command Depends: libc6 Depends: libpng2 Depends: libsdl-mixer1.1 Depends: libsdl1.1 Depends: zlib1g
总而言之,我们有一系列武器可以用来找出我们想要的软件包的名称。
找到软件包名称的方法之一是知道软件包中包含的一个重要文件的名称。例如,要找到提供你编译所需的特定 ".h" 文件的软件包,你可以运行
# dpkg -S stdio.h libc6-dev: /usr/include/stdio.h libc6-dev: /usr/include/bits/stdio.h perl: /usr/lib/perl/5.6.0/CORE/nostdio.h
或
# dpkg -S /usr/include/stdio.h libc6-dev: /usr/include/stdio.h
要找出安装在你的系统上的软件包的名称,例如,如果你计划清理你的硬盘驱动器,这很有用,你可以运行
# dpkg -l | grep mozilla ii mozilla-browse 0.9.6-7 Mozilla Web Browser
这个命令的问题是它可能会“破坏”软件包名称。在上面的例子中,软件包的完整名称是 mozilla-browser。要修复这个问题,你可以这样使用 COLUMNS 环境变量
[kov]@[couve] $ COLUMNS=132 dpkg -l | grep mozilla ii mozilla-browser 0.9.6-7 Mozilla Web Browser - core and browser
或者用这种方式使用描述或其一部分
# apt-cache search "Mozilla Web Browser" mozilla-browser - Mozilla Web Browser
你正在编译一个程序,突然,砰!出现了一个错误,因为它需要一个你没有的 .h 文件。程序 auto-apt
可以让你避免这种情况。如果需要,它会请求你安装软件包,停止相关的进程,并在软件包安装完成后继续。
基本上,你要做的是运行
# auto-apt run command
其中 `command' 是要执行的命令,它可能需要一些不可用的文件。例如
# auto-apt run ./configure
然后它会要求安装所需的软件包并自动调用 apt-get。如果你正在运行 X,图形界面将取代默认的文本界面。
Auto-apt 保留数据库,为了使其有效,这些数据库需要保持最新。这可以通过调用命令 auto-apt update、auto-apt updatedb 和 auto-apt update-local 来实现。
如果你想安装一个软件包,并且你无法通过使用 apt-cache
搜索找到它的名称,但知道程序本身的文件名,或者属于该软件包的其他一些文件名,那么你可以使用 apt-file
来查找软件包名称。它是这样完成的
$ apt-file search filename
它的工作方式与 dpkg -S 类似,但也会显示包含该文件的未安装软件包。它也可以用来查找哪些软件包包含编译程序时丢失的必要的头文件,尽管 auto-apt
是解决此类问题的更好方法,请参阅 如何“按需”安装软件包,第 5.3 节。
你也可以通过运行以下命令列出软件包的内容
$ apt-file list packagename
apt-file
保留一个数据库,其中包含所有软件包包含的文件,就像 auto-apt 一样,它需要保持最新。这可以通过运行以下命令来完成
# apt-file update
默认情况下,apt-file
使用与 auto-apt
相同的数据库,请参阅 如何“按需”安装软件包,第 5.3 节。
每个软件包都会在其文档目录 (/usr/share/doc/packagename) 中安装一个名为 changelog.Debian.gz 的文件,其中包含自上一个版本以来对软件包所做的更改列表。你可以使用 zless 的帮助来读取这些文件,例如,但在完成系统升级后,开始搜索每个升级软件包的更改日志并不容易。
有一种方法可以通过一个名为 apt-listchanges
的工具来自动化这个任务。首先需要安装 apt-listchanges
软件包。在软件包安装期间,Debconf 将对其进行配置。根据你设置 Debconf 使用的优先级,某些问题可能不会显示给你。根据你的意愿回答问题。
第一个问题询问你希望 apt-listchanges 如何显示更改。你可以将它们邮寄给你,这对于自动升级很有用,或者你可以在像 less
这样的分页器中询问它们,这样你就可以在让升级继续之前检查更改。如果你不希望 apt-listchanges
在升级期间自动运行,你可以回答 none。
在安装 apt-listchanges 后,一旦软件包被 apt 下载(或从 CD 或挂载的磁盘获取),它将在安装这些软件包之前显示对这些软件包所做的更改列表。
[ 上一页 ] [ 目录 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 下一页 ]
APT HOWTO(过时文档)
1.8.11 - 2005 年 8 月kov@debian.org