old-www/LDP/www.debian.org/doc/manuals/apt-howto/ch-search.en.html

458 lines
16 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>APT HOWTO (Obsolete Documentation) - Getting information about packages.</title>
<link href="index.en.html" rel="start">
<link href="ch-helpers.en.html" rel="prev">
<link href="ch-sourcehandling.en.html" rel="next">
<link href="index.en.html#contents" rel="contents">
<link href="index.en.html#copyright" rel="copyright">
<link href="ch1.en.html" rel="chapter" title="1 Introduction">
<link href="ch-basico.en.html" rel="chapter" title="2 Basic Configuration">
<link href="ch-apt-get.en.html" rel="chapter" title="3 Managing packages">
<link href="ch-helpers.en.html" rel="chapter" title="4 Very useful helpers">
<link href="ch-search.en.html" rel="chapter" title="5 Getting information about packages.">
<link href="ch-sourcehandling.en.html" rel="chapter" title="6 Working with source packages">
<link href="ch-erros.en.html" rel="chapter" title="7 How to deal with errors">
<link href="ch-distros.en.html" rel="chapter" title="8 What distributions support APT?">
<link href="ch-agradecimentos.en.html" rel="chapter" title="9 Credits">
<link href="ch-novas.en.html" rel="chapter" title="10 New versions of this tutorial">
<link href="ch-basico.en.html#s-sources.list" rel="section" title="2.1 The /etc/apt/sources.list file">
<link href="ch-basico.en.html#s-dpkg-scanpackages" rel="section" title="2.2 How to use APT locally">
<link href="ch-basico.en.html#s-netselect" rel="section" title="2.3 Deciding which mirror is the best to include in the sources.list file: netselect, netselect-apt">
<link href="ch-basico.en.html#s-cdrom" rel="section" title="2.4 Adding a CD-ROM to the sources.list file">
<link href="ch-apt-get.en.html#s-update" rel="section" title="3.1 Updating the list of available packages">
<link href="ch-apt-get.en.html#s-install" rel="section" title="3.2 Installing packages">
<link href="ch-apt-get.en.html#s-remove" rel="section" title="3.3 Removing packages">
<link href="ch-apt-get.en.html#s-upgrade" rel="section" title="3.4 Upgrading packages">
<link href="ch-apt-get.en.html#s-dist-upgrade" rel="section" title="3.5 Upgrading to a new release">
<link href="ch-apt-get.en.html#s-clean" rel="section" title="3.6 Removing unused package files: apt-get clean and autoclean">
<link href="ch-apt-get.en.html#s-dselect-upgrade" rel="section" title="3.7 Using APT with dselect">
<link href="ch-apt-get.en.html#s-default-version" rel="section" title="3.8 How to keep a mixed system">
<link href="ch-apt-get.en.html#s-apt-show-versions" rel="section" title="3.9 How to upgrade packages from specific versions of Debian">
<link href="ch-apt-get.en.html#s-pin" rel="section" title="3.10 How to keep specific versions of packages installed (complex)">
<link href="ch-helpers.en.html#s-equivs" rel="section" title="4.1 How to install locally compiled packages: equivs">
<link href="ch-helpers.en.html#s-localepurge" rel="section" title="4.2 Removing unused locale files: localepurge">
<link href="ch-helpers.en.html#s-helper-show-versions" rel="section" title="4.3 How to know what packages may be upgraded">
<link href="ch-search.en.html#s-cache" rel="section" title="5.1 Discovering package names">
<link href="ch-search.en.html#s-dpkg-search" rel="section" title="5.2 Using dpkg to find package names">
<link href="ch-search.en.html#s-auto-apt" rel="section" title="5.3 How to install packages &quot;on demand&quot;">
<link href="ch-search.en.html#s-apt-file" rel="section" title="5.4 How to discover to which package a file belongs">
<link href="ch-search.en.html#s-apt-listchanges" rel="section" title="5.5 How to keep informed about the changes in the packages.">
<link href="ch-sourcehandling.en.html#s-source" rel="section" title="6.1 Downloading source packages">
<link href="ch-sourcehandling.en.html#s-build-dep" rel="section" title="6.2 Packages needed for compiling a source package">
<link href="ch-erros.en.html#s-erros-comuns" rel="section" title="7.1 Common errors">
<link href="ch-erros.en.html#s-help" rel="section" title="7.2 Where can I find help?">
</head>
<body>
<p><a name="ch-search"></a></p>
<hr>
<p>
[ <a href="ch-helpers.en.html">previous</a> ]
[ <a href="index.en.html#contents">Contents</a> ]
[ <a href="ch1.en.html">1</a> ]
[ <a href="ch-basico.en.html">2</a> ]
[ <a href="ch-apt-get.en.html">3</a> ]
[ <a href="ch-helpers.en.html">4</a> ]
[ 5 ]
[ <a href="ch-sourcehandling.en.html">6</a> ]
[ <a href="ch-erros.en.html">7</a> ]
[ <a href="ch-distros.en.html">8</a> ]
[ <a href="ch-agradecimentos.en.html">9</a> ]
[ <a href="ch-novas.en.html">10</a> ]
[ <a href="ch-sourcehandling.en.html">next</a> ]
</p>
<hr>
<h1>
APT HOWTO (Obsolete Documentation)
<br>Chapter 5 - Getting information about packages.
</h1>
<hr>
<p>
There are some front-end programs for the APT system that make it significantly
easier to get listings of packages that are available for installation or are
already installed, as well as to find out what section a package is in, what
its priority is, what its description is, etc.
</p>
<p>
But... our goal here is to learn how to use pure APT. So how can you find out
the name of a package that you want to install?
</p>
<p>
We have a number of resources for such a task. We'll begin with
<samp>apt-cache</samp>. This program is used by the APT system for maintaining
its database. We'll take just a brief look at some of its more practical
applications.
</p>
<hr>
<h2><a name="s-cache"></a>5.1 Discovering package names</h2>
<p>
For example, suppose that you want to reminisce about the good old days of the
Atari 2600. You want to use APT to install an Atari emulator, and then
download some games. You can do:
</p>
<pre>
# 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
</pre>
<p>
We find several packages related to what we're looking for, together with brief
descriptions. To get more information about a specific package, I can then
use:
</p>
<pre>
# apt-cache show stella
Package: stella
Priority: extra
Section: non-free/otherosfs
Installed-Size: 830
Maintainer: Tom Lear &lt;tom@trap.mtview.ca.us&gt;
Architecture: i386
Version: 1.1-2
Depends: libc6 (&gt;= 2.1), libstdc++2.10, xlib6g (&gt;= 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
</pre>
<p>
In this output you have many details about the package that you want (or don't
want) to install, together with the full description of the package. If the
package is already installed on your system and there is a newer version,
you'll see information about both versions. For example:
</p>
<pre>
# apt-cache show lilo
Package: lilo
Priority: important
Section: base
Installed-Size: 271
Maintainer: Russell Coker &lt;russell@coker.com.au&gt;
Architecture: i386
Version: 1:21.7-3
Depends: libc6 (&gt;= 2.2.1-2), debconf (&gt;=0.2.26), logrotate
Suggests: lilo-doc
Conflicts: manpages (&lt;&lt;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 &lt;vincent@debian.org&gt;
Version: 1:21.4.3-2
Depends: libc6 (&gt;= 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.
</pre>
<p>
Note that the first in the list is the available package and the second is the
one already installed. For more general information about a package, you can
use:
</p>
<pre>
# 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:
</pre>
<p>
And to just find out what packages it depends on:
</p>
<pre>
# apt-cache depends penguin-command
penguin-command
Depends: libc6
Depends: libpng2
Depends: libsdl-mixer1.1
Depends: libsdl1.1
Depends: zlib1g
</pre>
<p>
In summary, we have a range of weapons we can use to find out the name of a
package we want.
</p>
<hr>
<h2><a name="s-dpkg-search"></a>5.2 Using dpkg to find package names</h2>
<p>
One of the ways to locate the name of a package is to know the name of an
important file found within the package. For example, to find the package that
provides a particular <samp>&quot;.h&quot;</samp> file you need for compilation
you can run:
</p>
<pre>
# 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
</pre>
<p>
or:
</p>
<pre>
# dpkg -S /usr/include/stdio.h
libc6-dev: /usr/include/stdio.h
</pre>
<p>
To find out the names of packages installed on your system, which is useful,
for example, if you plan to clean up your hard drive, you can run:
</p>
<pre>
# dpkg -l | grep mozilla
ii mozilla-browse 0.9.6-7 Mozilla Web Browser
</pre>
<p>
The problem with this command is that it can &quot;break&quot; the package
name. In the example above, the full name of the package is
<samp>mozilla-browser</samp>. To fix this, you can use the
<samp>COLUMNS</samp> environment variable this way:
</p>
<pre>
[kov]@[couve] $ COLUMNS=132 dpkg -l | grep mozilla
ii mozilla-browser 0.9.6-7 Mozilla Web Browser - core and browser
</pre>
<p>
or the description or part of it this way:
</p>
<pre>
# apt-cache search &quot;Mozilla Web Browser&quot;
mozilla-browser - Mozilla Web Browser
</pre>
<hr>
<h2><a name="s-auto-apt"></a>5.3 How to install packages &quot;on demand&quot;</h2>
<p>
You're compiling a program and, all of a sudden, boom! There's an error
because it needs a <samp>.h</samp> file you don't have. The program
<code>auto-apt</code> can save you from such scenarios. It asks you to install
packages if they're needed, stopping the relevant process and continuing once
the package is installed.
</p>
<p>
What you do, basically, is run:
</p>
<pre>
# auto-apt run command
</pre>
<p>
Where `command' is the command to be executed that may need some unavailable
file. For example:
</p>
<pre>
# auto-apt run ./configure
</pre>
<p>
It will then ask to install the needed packages and call apt-get automatically.
If you're running X, a graphical interface will replace the default text
interface.
</p>
<p>
Auto-apt keeps databases which need to be kept up-to-date in order for it to be
effective. This is achieved by calling the commands <samp>auto-apt
update</samp>, <samp>auto-apt updatedb</samp> and <samp>auto-apt
update-local</samp>.
</p>
<hr>
<h2><a name="s-apt-file"></a>5.4 How to discover to which package a file belongs</h2>
<p>
If you want to install a package, and you can't find out what it is called by
searching with <code>apt-cache</code>, but know the filename of the program
itself, or some other filename that belongs to the package, then you can use
<code>apt-file</code> to find the package name. This is done like this:
</p>
<pre>
$ apt-file search <var>filename</var>
</pre>
<p>
It works just like <samp>dpkg -S</samp>, but will also show you uninstalled
packages that contain the file. It could also be used to find what packages
contain necessary include files that are missing when compiling programs,
although <code>auto-apt</code> is a much better method of solving such issues,
see <a href="#s-auto-apt">How to install packages &quot;on demand&quot;,
Section 5.3</a>.
</p>
<p>
You can also list the contents of a package, by running:
</p>
<pre>
$ apt-file list <var>packagename</var>
</pre>
<p>
<code>apt-file</code> keeps a database of which files all packages contain,
just like auto-apt does and it needs to be up-to-date. This is done by
running:
</p>
<pre>
# apt-file update
</pre>
<p>
By default, <code>apt-file</code> uses the same database <code>auto-apt</code>
is using, see <a href="#s-auto-apt">How to install packages &quot;on
demand&quot;, Section 5.3</a>.
</p>
<hr>
<h2><a name="s-apt-listchanges"></a>5.5 How to keep informed about the changes in the packages.</h2>
<p>
Every package installs in its documentation directory
(<samp>/usr/share/doc/packagename</samp>) a file called
<samp>changelog.Debian.gz</samp> which contains the list of changes made to the
package since the last version. You can read these files with
<samp>zless</samp>' help, for example, but it is something not so easy, after
an complete system upgrade, to start searching changelogs for every upgraded
package.
</p>
<p>
There's a way to automatize this task by means of a tool called
<code>apt-listchanges</code>. To begin with one needs to install the
<code>apt-listchanges</code> package. During the package installation, Debconf
will configure it. Some questions may not be shown to you depending on the
priority you set up Debconf to use. Answer to the questions as you want.
</p>
<p>
The first question asks how you want the changes to be showed by
apt-listchanges. You can have them mailed to you, which is good for automatic
upgrades, or you can ask them in a pager like <code>less</code>, so you can
inspect the changes before leting the upgrade continue. If you don't want
<code>apt-listchanges</code> running automaticaly during upgrades you can
answer <samp>none</samp>.
</p>
<p>
After apt-listchanges is installed, as soon as packages are downloaded (or
gotten from a CD or mounted disk) by apt it will show the lists of changes made
to those packages before installing them.
</p>
<hr>
<p>
[ <a href="ch-helpers.en.html">previous</a> ]
[ <a href="index.en.html#contents">Contents</a> ]
[ <a href="ch1.en.html">1</a> ]
[ <a href="ch-basico.en.html">2</a> ]
[ <a href="ch-apt-get.en.html">3</a> ]
[ <a href="ch-helpers.en.html">4</a> ]
[ 5 ]
[ <a href="ch-sourcehandling.en.html">6</a> ]
[ <a href="ch-erros.en.html">7</a> ]
[ <a href="ch-distros.en.html">8</a> ]
[ <a href="ch-agradecimentos.en.html">9</a> ]
[ <a href="ch-novas.en.html">10</a> ]
[ <a href="ch-sourcehandling.en.html">next</a> ]
</p>
<hr>
<p>
APT HOWTO (Obsolete Documentation)
</p>
<address>
1.8.11 - August 2005<br>
<br>
Gustavo Noronha Silva <code><a href="mailto:kov@debian.org">kov@debian.org</a></code><br>
<br>
</address>
<hr>
</body>
</html>