920 lines
32 KiB
HTML
920 lines
32 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) - Managing packages</title>
|
|
|
|
<link href="index.en.html" rel="start">
|
|
<link href="ch-basico.en.html" rel="prev">
|
|
<link href="ch-helpers.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 "on demand"">
|
|
<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-apt-get"></a></p>
|
|
<hr>
|
|
|
|
<p>
|
|
[ <a href="ch-basico.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> ]
|
|
[ 3 ]
|
|
[ <a href="ch-helpers.en.html">4</a> ]
|
|
[ <a href="ch-search.en.html">5</a> ]
|
|
[ <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-helpers.en.html">next</a> ]
|
|
</p>
|
|
|
|
<hr>
|
|
|
|
<h1>
|
|
APT HOWTO (Obsolete Documentation)
|
|
<br>Chapter 3 - Managing packages
|
|
</h1>
|
|
|
|
<hr>
|
|
|
|
<h2><a name="s-update"></a>3.1 Updating the list of available packages</h2>
|
|
|
|
<p>
|
|
The packaging system uses a private database to keep track of which packages
|
|
are installed, which are not installed and which are available for
|
|
installation. The <code>apt-get</code> program uses this database to find out
|
|
how to install packages requested by the user and to find out which additional
|
|
packages are needed in order for a selected package to work properly.
|
|
</p>
|
|
|
|
<p>
|
|
To update this list, you would use the command <code>apt-get update</code>.
|
|
This command looks for the package lists in the archives found in
|
|
<samp>/etc/apt/sources.list</samp>; see <a
|
|
href="ch-basico.en.html#s-sources.list">The /etc/apt/sources.list file, Section
|
|
2.1</a> for more information about this file.
|
|
</p>
|
|
|
|
<p>
|
|
It's a good idea to run this command regularly to keep yourself and your system
|
|
informed about possible package updates, particularly security updates.
|
|
</p>
|
|
|
|
<hr>
|
|
|
|
<h2><a name="s-install"></a>3.2 Installing packages</h2>
|
|
|
|
<p>
|
|
Finally, the process you've all been waiting for! With your sources.list ready
|
|
and your list of available packages up to date, all you have to do is run
|
|
<samp>apt-get</samp> to get your desired package installed. For example, you
|
|
can run:
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-get install xchat
|
|
</pre>
|
|
|
|
<p>
|
|
APT will search it's database for the most recent version of this package and
|
|
will retrieve it from the corresponding archive as specified in
|
|
<samp>sources.list</samp>. In the event that this package depends on another
|
|
-- as is the case here -- APT will check the dependencies and install the
|
|
needed packages. See this example:
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-get install nautilus
|
|
Reading Package Lists... Done
|
|
Building Dependency Tree... Done
|
|
The following extra packages will be installed:
|
|
bonobo libmedusa0 libnautilus0
|
|
The following NEW packages will be installed:
|
|
bonobo libmedusa0 libnautilus0 nautilus
|
|
0 packages upgraded, 4 newly installed, 0 to remove and 1 not upgraded.
|
|
Need to get 8329kB of archives. After unpacking 17.2MB will be used.
|
|
Do you want to continue? [Y/n]
|
|
</pre>
|
|
|
|
<p>
|
|
The package <code>nautilus</code> depends on the shared libraries cited,
|
|
therefore APT will get them from the archive. If you had specified the names
|
|
of these libraries on the <samp>apt-get</samp> command line, APT would not have
|
|
asked if you wanted to continue; it would automatically accept that you wanted
|
|
to install all of those packages.
|
|
</p>
|
|
|
|
<p>
|
|
This means that APT only asks for confirmation when it needs to install
|
|
packages which weren't specified on the command line.
|
|
</p>
|
|
|
|
<p>
|
|
The following options to apt-get may be useful:
|
|
</p>
|
|
|
|
<pre>
|
|
-h This help text.
|
|
-d Download only - do NOT install or unpack archives
|
|
-f Attempt to continue if the integrity check fails
|
|
-s No-act. Perform ordering simulation
|
|
-y Assume Yes to all queries and do not prompt
|
|
-u Show a list of upgraded packages as well
|
|
</pre>
|
|
|
|
<p>
|
|
Multiple packages may be selected for installation in one line. Files
|
|
downloaded from the network are placed in the directory
|
|
<samp>/var/cache/apt/archives</samp> for later installation.
|
|
</p>
|
|
|
|
<p>
|
|
You can specify packages to be removed on the same command line, as well. Just
|
|
put a '-' immediately after the name of the package to be removed, like this:
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-get install nautilus gnome-panel-
|
|
Reading Package Lists... Done
|
|
Building Dependency Tree... Done
|
|
The following extra packages will be installed:
|
|
bonobo libmedusa0 libnautilus0
|
|
The following packages will be REMOVED:
|
|
gnome-applets gnome-panel gnome-panel-data gnome-session
|
|
The following NEW packages will be installed:
|
|
bonobo libmedusa0 libnautilus0 nautilus
|
|
0 packages upgraded, 4 newly installed, 4 to remove and 1 not upgraded.
|
|
Need to get 8329kB of archives. After unpacking 2594kB will be used.
|
|
Do you want to continue? [Y/n]
|
|
</pre>
|
|
|
|
<p>
|
|
See section <a href="#s-remove">Removing packages, Section 3.3</a> for more
|
|
details on package removal.
|
|
</p>
|
|
|
|
<p>
|
|
If you somehow damage an installed package, or simply want the files of a
|
|
package to be reinstalled with the newest version that is available, you can
|
|
use the <samp>--reinstall</samp> option like so:
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-get --reinstall install gdm
|
|
Reading Package Lists... Done
|
|
Building Dependency Tree... Done
|
|
0 packages upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 1 not upgraded.
|
|
Need to get 0B/182kB of archives. After unpacking 0B will be used.
|
|
Do you want to continue? [Y/n]
|
|
</pre>
|
|
|
|
<hr>
|
|
|
|
<h2><a name="s-remove"></a>3.3 Removing packages</h2>
|
|
|
|
<p>
|
|
If you no longer want to use a package, you can remove it from your system
|
|
using APT. To do this just type: <samp>apt-get remove package</samp>. For
|
|
example:
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-get remove gnome-panel
|
|
Reading Package Lists... Done
|
|
Building Dependency Tree... Done
|
|
The following packages will be REMOVED:
|
|
gnome-applets gnome-panel gnome-panel-data gnome-session
|
|
0 packages upgraded, 0 newly installed, 4 to remove and 1 not upgraded.
|
|
Need to get 0B of archives. After unpacking 14.6MB will be freed.
|
|
Do you want to continue? [Y/n]
|
|
</pre>
|
|
|
|
<p>
|
|
As you can see in the above example, APT also takes care of removing packages
|
|
which depend on the package you have asked to remove. There is no way to
|
|
remove a package using APT without also removing those packages that depend on
|
|
it.
|
|
</p>
|
|
|
|
<p>
|
|
Running <code>apt-get</code> as above will cause the packages to be removed but
|
|
their configuration files, if any, will remain intact on the system. For a
|
|
complete removal of the package, run:
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-get --purge remove gnome-panel
|
|
Reading Package Lists... Done
|
|
Building Dependency Tree... Done
|
|
The following packages will be REMOVED:
|
|
gnome-applets* gnome-panel* gnome-panel-data* gnome-session*
|
|
0 packages upgraded, 0 newly installed, 4 to remove and 1 not upgraded.
|
|
Need to get 0B of archives. After unpacking 14.6MB will be freed.
|
|
Do you want to continue? [Y/n]
|
|
</pre>
|
|
|
|
<p>
|
|
Note the '*' after the names. This indicates that the configuration files for
|
|
each of these packages will also be removed.
|
|
</p>
|
|
|
|
<p>
|
|
Just as in the case of the <samp>install</samp> method, you can use a symbol
|
|
with <samp>remove</samp> to invert the meaning for a particular package. In
|
|
the case of removing, if you add a <samp>'+'</samp> right after the package
|
|
name, the package will be installed instead of being removed.
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-get --purge remove gnome-panel nautilus+
|
|
Reading Package Lists... Done
|
|
Building Dependency Tree... Done
|
|
The following extra packages will be installed:
|
|
bonobo libmedusa0 libnautilus0 nautilus
|
|
The following packages will be REMOVED:
|
|
gnome-applets* gnome-panel* gnome-panel-data* gnome-session*
|
|
The following NEW packages will be installed:
|
|
bonobo libmedusa0 libnautilus0 nautilus
|
|
0 packages upgraded, 4 newly installed, 4 to remove and 1 not upgraded.
|
|
Need to get 8329kB of archives. After unpacking 2594kB will be used.
|
|
Do you want to continue? [Y/n]
|
|
</pre>
|
|
|
|
<p>
|
|
Note that <code>apt-get</code> lists the extra packages which will be installed
|
|
(that is, the packages whose installation is needed for the proper functioning
|
|
of the package whose installation has been requested), those which will be
|
|
removed, and those which will be installed (including the extra packages
|
|
again).
|
|
</p>
|
|
|
|
<hr>
|
|
|
|
<h2><a name="s-upgrade"></a>3.4 Upgrading packages</h2>
|
|
|
|
<p>
|
|
Package upgrades are a great success of the APT system. They can be achieved
|
|
with a single command: <samp>apt-get upgrade</samp>. You can use this command
|
|
to upgrade packages within the same distribution, as well as to upgrade to a
|
|
new distribution, although for the latter the command <samp>apt-get
|
|
dist-upgrade</samp> is preferred; see section <a
|
|
href="#s-dist-upgrade">Upgrading to a new release, Section 3.5</a> for more
|
|
details.
|
|
</p>
|
|
|
|
<p>
|
|
It's useful to run this command with the <samp>-u</samp> option. This option
|
|
causes APT to show the complete list of packages which will be upgraded.
|
|
Without it, you'll be upgrading blindly. APT will download the latest versions
|
|
of each package and will install them in the proper order. It's important to
|
|
always run <samp>apt-get update</samp> before you try this. See section <a
|
|
href="#s-update">Updating the list of available packages, Section 3.1</a>.
|
|
Look at this example:
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-get -u upgrade
|
|
Reading Package Lists... Done
|
|
Building Dependency Tree... Done
|
|
The following packages have been kept back
|
|
cpp gcc lilo
|
|
The following packages will be upgraded
|
|
adduser ae apt autoconf debhelper dpkg-dev esound esound-common ftp indent
|
|
ipchains isapnptools libaudiofile-dev libaudiofile0 libesd0 libesd0-dev
|
|
libgtk1.2 libgtk1.2-dev liblockfile1 libnewt0 liborbit-dev liborbit0
|
|
libstdc++2.10-glibc2.2 libtiff3g libtiff3g-dev modconf orbit procps psmisc
|
|
29 packages upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
|
|
Need to get 5055B/5055kB of archives. After unpacking 1161kB will be used.
|
|
Do you want to continue? [Y/n]
|
|
</pre>
|
|
|
|
<p>
|
|
The process is very simple. Note that in the first few lines,
|
|
<samp>apt-get</samp> says that some packages were <samp>kept back</samp>. This
|
|
means that there are new versions of these packages which will not be installed
|
|
for some reason. Possible reasons are broken dependencies (a package on which
|
|
it depends doesn't have a version available for download) or new dependencies
|
|
(the package has come to depend on new packages since the last version).
|
|
</p>
|
|
|
|
<p>
|
|
There's no clean solution for this first case. For the second case, it's
|
|
sufficient to run <samp>apt-get install</samp> for the specific package in
|
|
question, as this will download the dependencies. An even cleaner solution is
|
|
to use <samp>dist-upgrade</samp>. See section <a
|
|
href="#s-dist-upgrade">Upgrading to a new release, Section 3.5</a>.
|
|
</p>
|
|
|
|
<hr>
|
|
|
|
<h2><a name="s-dist-upgrade"></a>3.5 Upgrading to a new release</h2>
|
|
|
|
<p>
|
|
This feature of APT allows you to upgrade an entire Debian system at once,
|
|
either through the Internet or from a new CD (purchased or downloaded as an ISO
|
|
image).
|
|
</p>
|
|
|
|
<p>
|
|
It is also used when changes are made to the relationships between installed
|
|
packages. With <samp>apt-get upgrade</samp>, these packages would be kept
|
|
untouched (<samp>kept back</samp>).
|
|
</p>
|
|
|
|
<p>
|
|
For example, suppose that you're using revision 0 of the stable version of
|
|
Debian and you buy a CD with revision 3. You can use APT to upgrade your
|
|
system from this new CD. To do this, use <code>apt-cdrom</code> (see section
|
|
<a href="ch-basico.en.html#s-cdrom">Adding a CD-ROM to the sources.list file,
|
|
Section 2.4</a>) to add the CD to your <samp>/etc/apt/sources.list</samp> and
|
|
run <samp>apt-get dist-upgrade</samp>.
|
|
</p>
|
|
|
|
<p>
|
|
It's important to note that APT always looks for the most recent versions of
|
|
packages. Therefore, if your <samp>/etc/apt/sources.list</samp> were to list
|
|
an archive that had a more recent version of a package than the version on the
|
|
CD, APT would download the package from there.
|
|
</p>
|
|
|
|
<p>
|
|
In the example shown in section <a href="#s-upgrade">Upgrading packages,
|
|
Section 3.4</a>, we saw that some packages were <samp>kept back</samp>. We'll
|
|
solve this problem now with the <samp>dist-upgrade</samp> method:
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-get -u dist-upgrade
|
|
Reading Package Lists... Done
|
|
Building Dependency Tree... Done
|
|
Calculating Upgrade... Done
|
|
The following NEW packages will be installed:
|
|
cpp-2.95 cron exim gcc-2.95 libident libopenldap-runtime libopenldap1
|
|
libpcre2 logrotate mailx
|
|
The following packages have been kept back
|
|
lilo
|
|
The following packages will be upgraded
|
|
adduser ae apt autoconf cpp debhelper dpkg-dev esound esound-common ftp gcc
|
|
indent ipchains isapnptools libaudiofile-dev libaudiofile0 libesd0
|
|
libesd0-dev libgtk1.2 libgtk1.2-dev liblockfile1 libnewt0 liborbit-dev
|
|
liborbit0 libstdc++2.10-glibc2.2 libtiff3g libtiff3g-dev modconf orbit
|
|
procps psmisc
|
|
31 packages upgraded, 10 newly installed, 0 to remove and 1 not upgraded.
|
|
Need to get 0B/7098kB of archives. After unpacking 3118kB will be used.
|
|
Do you want to continue? [Y/n]
|
|
</pre>
|
|
|
|
<p>
|
|
Note now that the packages will be upgraded, and new packages will also be
|
|
installed (the new dependencies of the packages). Note too that lilo is still
|
|
being <samp>kept back</samp>. It probably has a more serious problem than a
|
|
new dependency. We can find out by running:
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-get -u install lilo
|
|
Reading Package Lists... Done
|
|
Building Dependency Tree... Done
|
|
The following extra packages will be installed:
|
|
cron debconf exim libident libopenldap-runtime libopenldap1 libpcre2
|
|
logrotate mailx
|
|
The following packages will be REMOVED:
|
|
debconf-tiny
|
|
The following NEW packages will be installed:
|
|
cron debconf exim libident libopenldap-runtime libopenldap1 libpcre2
|
|
logrotate mailx
|
|
The following packages will be upgraded
|
|
lilo
|
|
1 packages upgraded, 9 newly installed, 1 to remove and 31 not upgraded.
|
|
Need to get 225kB/1179kB of archives. After unpacking 2659kB will be used.
|
|
Do you want to continue? [Y/n]
|
|
</pre>
|
|
|
|
<p>
|
|
As noted in the above, lilo has a new conflict with the package
|
|
<code>debconf-tiny</code>, which means it couldn't be installed (or upgraded)
|
|
without removing debconf-tiny.
|
|
</p>
|
|
|
|
<p>
|
|
To know what's keeping or removing a package you may use:
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-get -o Debug::pkgProblemResolver=yes dist-upgrade
|
|
Reading Package Lists... Done
|
|
Building Dependency Tree... Done
|
|
Calculating Upgrade... Starting
|
|
Starting 2
|
|
Investigating python1.5
|
|
Package python1.5 has broken dep on python1.5-base
|
|
Considering python1.5-base 0 as a solution to python1.5 0
|
|
Holding Back python1.5 rather than change python1.5-base
|
|
Investigating python1.5-dev
|
|
Package python1.5-dev has broken dep on python1.5
|
|
Considering python1.5 0 as a solution to python1.5-dev 0
|
|
Holding Back python1.5-dev rather than change python1.5
|
|
Try to Re-Instate python1.5-dev
|
|
Done
|
|
Done
|
|
The following packages have been kept back
|
|
gs python1.5-dev
|
|
0 packages upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
|
|
</pre>
|
|
|
|
<p>
|
|
This way, it's easy to notice that the python1.5-dev package cannot be
|
|
installed because of an unsatisfied dependency: python1.5.
|
|
</p>
|
|
|
|
<hr>
|
|
|
|
<h2><a name="s-clean"></a>3.6 Removing unused package files: apt-get clean and autoclean</h2>
|
|
|
|
<p>
|
|
When you install a package APT retrieves the needed files from the hosts listed
|
|
in /etc/apt/sources.list, stores them in a local repository
|
|
(<code>/var/cache/apt/archives/</code>), and then proceeds with installation,
|
|
see <a href="#s-install">Installing packages, Section 3.2</a>.
|
|
</p>
|
|
|
|
<p>
|
|
In time the local repository can grow and occupy a lot of disk space.
|
|
Fortunately, APT provides tools for managing its local repository:
|
|
<code>apt-get</code>'s <samp>clean</samp> and <samp>autoclean</samp> methods.
|
|
</p>
|
|
|
|
<p>
|
|
<code>apt-get clean</code> removes everything except lock files from
|
|
<code>/var/cache/apt/archives/</code> and
|
|
<code>/var/cache/apt/archives/partial/</code>. Thus, if you need to reinstall
|
|
a package APT should retrieve it again.
|
|
</p>
|
|
|
|
<p>
|
|
<code>apt-get autoclean</code> removes only package files that can no longer be
|
|
downloaded.
|
|
</p>
|
|
|
|
<p>
|
|
The following example show how apt-get autoclean works:
|
|
</p>
|
|
|
|
<pre>
|
|
# ls /var/cache/apt/archives/logrotate* /var/cache/apt/archives/gpm*
|
|
logrotate_3.5.9-7_i386.deb
|
|
logrotate_3.5.9-8_i386.deb
|
|
gpm_1.19.6-11_i386.deb
|
|
</pre>
|
|
|
|
<p>
|
|
In /var/cache/apt/archives there are two files for the package
|
|
<code>logrotate</code> and one for the package <code>gpm</code>.
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-show-versions -p logrotate
|
|
logrotate/stable uptodate 3.5.9-8
|
|
# apt-show-versions -p gpm
|
|
gpm/stable upgradeable from 1.19.6-11 to 1.19.6-12
|
|
</pre>
|
|
|
|
<p>
|
|
<code>apt-show-versions</code> shows that
|
|
<code>logrotate_3.5.9-8_i386.deb</code> provides the up to date version of
|
|
<code>logrotate</code>, so <code>logrotate_3.5.9-7_i386.deb</code> is useless.
|
|
Also <code>gpm_1.19.6-11_i386.deb</code> is useless because a more recent
|
|
version of the package can be retrieved.
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-get autoclean
|
|
Reading Package Lists... Done
|
|
Building Dependency Tree... Done
|
|
Del gpm 1.19.6-11 [145kB]
|
|
Del logrotate 3.5.9-7 [26.5kB]
|
|
</pre>
|
|
|
|
<p>
|
|
Finally, <samp>apt-get autoclean</samp> removes only the old files. See <a
|
|
href="#s-apt-show-versions">How to upgrade packages from specific versions of
|
|
Debian, Section 3.9</a> for more information on apt-show-versions.
|
|
</p>
|
|
|
|
<hr>
|
|
|
|
<h2><a name="s-dselect-upgrade"></a>3.7 Using APT with dselect</h2>
|
|
|
|
<p>
|
|
<code>dselect</code> is a program that helps users select Debian packages for
|
|
installation. It's considered somewhat complicated and rather boring, but with
|
|
practice you can get the hang of its console-based ncurses interface.
|
|
</p>
|
|
|
|
<p>
|
|
One feature of dselect is that it knows how to make use of the capacity Debian
|
|
packages have for "recommending" and "suggesting" other
|
|
packages for installation. To use the program, run <samp>`dselect'</samp> as
|
|
root. Choose 'apt' as your access method. This isn't truly necessary, but if
|
|
you're not using a CD ROM and you want to download packages from the Internet,
|
|
it's the best way to use dselect.
|
|
</p>
|
|
|
|
<p>
|
|
To gain a better understanding of dselect's usage, read the dselect
|
|
documentation found on the Debian page <code><a
|
|
href="http://www.debian.org/doc/ddp">http://www.debian.org/doc/ddp</a></code>.
|
|
</p>
|
|
|
|
<p>
|
|
After making your selections with dselect, use:
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-get -u dselect-upgrade
|
|
</pre>
|
|
|
|
<p>
|
|
as in the example below:
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-get -u dselect-upgrade
|
|
Reading Package Lists... Done
|
|
Building Dependency Tree... Done
|
|
The following packages will be REMOVED:
|
|
lbxproxy
|
|
The following NEW packages will be installed:
|
|
bonobo console-tools-libs cpp-3.0 enscript expat fingerd gcc-3.0
|
|
gcc-3.0-base icepref klogd libdigest-md5-perl libfnlib0 libft-perl
|
|
libgc5-dev libgcc300 libhtml-clean-perl libltdl0-dev libsasl-modules
|
|
libstdc++3.0 metamail nethack proftpd-doc psfontmgr python-newt talk tidy
|
|
util-linux-locales vacation xbill xplanet-images
|
|
The following packages will be upgraded
|
|
debian-policy
|
|
1 packages upgraded, 30 newly installed, 1 to remove and 0 not upgraded.
|
|
Need to get 7140kB of archives. After unpacking 16.3MB will be used.
|
|
Do you want to continue? [Y/n]
|
|
</pre>
|
|
|
|
<p>
|
|
Compare with what we see when running apt-get dist-upgrade on the same system:
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-get -u dist-upgrade
|
|
Reading Package Lists... Done
|
|
Building Dependency Tree... Done
|
|
Calculating Upgrade... Done
|
|
The following packages will be upgraded
|
|
debian-policy
|
|
1 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
|
|
Need to get 421kB of archives. After unpacking 25.6kB will be freed.
|
|
Do you want to continue? [Y/n]
|
|
</pre>
|
|
|
|
<p>
|
|
Note that many of the packages from above are being installed because other
|
|
packages "suggested" or "recommended" them. Others are
|
|
being installed or removed (in the case of lbxproxy, for example) per the
|
|
choices we made while navigating through dselect's package listing. Dselect
|
|
can be a powerful tool when used in conjunction with APT.
|
|
</p>
|
|
|
|
<hr>
|
|
|
|
<h2><a name="s-default-version"></a>3.8 How to keep a mixed system</h2>
|
|
|
|
<p>
|
|
People are sometimes interested in using one of the Debian versions as its main
|
|
system distribution and one or more packages from another branch.
|
|
</p>
|
|
|
|
<p>
|
|
To set up what is your main version of Debian you should edit the
|
|
<code>/etc/apt/apt.conf</code> (it does not usually exist, create it if you
|
|
don't have one) to contain the following line:
|
|
</p>
|
|
|
|
<pre>
|
|
APT::Default-Release "<var>version</var>";
|
|
</pre>
|
|
|
|
<p>
|
|
Where <var>version</var> is the version of Debian you want to use as the main
|
|
distribution. The versions you can use are <samp>stable</samp>,
|
|
<samp>testing</samp> and <samp>unstable</samp>. To install packages from
|
|
another version, then, you must use APT in the following way:
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-get -t <var>distribution</var> install <var>package</var>
|
|
</pre>
|
|
|
|
<p>
|
|
For that to work, though, you need at least one APT source line in your
|
|
<code>/etc/apt/sources.list</code> for the distribution you want the package
|
|
from, and the package must exist on that source.
|
|
</p>
|
|
|
|
<p>
|
|
You can also request a specific version of a package using the following
|
|
sintax:
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-get install <var>package</var>=<var>version</var>
|
|
</pre>
|
|
|
|
<p>
|
|
For example, the line below will install version <samp>2.2.4-1</samp> of the
|
|
<code>nautilus</code> package.:
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-get install nautilus=2.2.4-1
|
|
</pre>
|
|
|
|
<p>
|
|
<em>IMPORTANT</em>: the `unstable' version of Debian is the version to which
|
|
the newest versions of Debian packages are uploaded first. This distribution
|
|
sees all of the changes that packages go through, both small ones and more
|
|
drastic ones which affect many packages or the whole system. For this reason,
|
|
this version of the distribution should <em>not</em> be used by inexperienced
|
|
users or by those who need proven stability.
|
|
</p>
|
|
|
|
<p>
|
|
The `testing' distribution is not necessarily better than `unstable', because
|
|
it does not receive security updates quickly. For servers and other production
|
|
systems stable should always be used.
|
|
</p>
|
|
|
|
<hr>
|
|
|
|
<h2><a name="s-apt-show-versions"></a>3.9 How to upgrade packages from specific versions of Debian</h2>
|
|
|
|
<p>
|
|
<code>apt-show-versions</code> provides a safe way for users of mixed
|
|
distributions to upgrade their systems without getting more of the less-stable
|
|
distribution than they had in mind. For instance, it is possible to upgrade
|
|
just your unstable packages by running after having installed the
|
|
<code>apt-show-versions</code> package:
|
|
</p>
|
|
|
|
<pre>
|
|
# apt-get install `apt-show-versions -u -b | grep unstable | cut -d ' ' -f 1`
|
|
</pre>
|
|
|
|
<hr>
|
|
|
|
<h2><a name="s-pin"></a>3.10 How to keep specific versions of packages installed (complex)</h2>
|
|
|
|
<p>
|
|
You may have occasion to modify something in a package and don't have time or
|
|
don't want to port those changes to a new version of the program. Or, for
|
|
instance, you may have just upgraded your Debian distribution to 3.0, but want
|
|
to continue with the version of a certain package from Debian 2.2. You can
|
|
"pin" the version you have installed so that it will not be upgraded.
|
|
</p>
|
|
|
|
<p>
|
|
Using this resource is simple. You just need to edit the file
|
|
<samp>/etc/apt/preferences</samp>.
|
|
</p>
|
|
|
|
<p>
|
|
The format is simple:
|
|
</p>
|
|
|
|
<pre>
|
|
Package: <package>
|
|
Pin: <pin definition>
|
|
Pin-Priority: <pin's priority>
|
|
</pre>
|
|
|
|
<p>
|
|
Each entry must be separated from any other entries by a blank line. For
|
|
example, to keep package <code>sylpheed</code> that I have modified to use
|
|
"reply-to-list" at version 0.4.99, I add:
|
|
</p>
|
|
|
|
<pre>
|
|
Package: sylpheed
|
|
Pin: version 0.4.99*
|
|
</pre>
|
|
|
|
<p>
|
|
Note that I used an <samp>*</samp> (asterisk). This is a "wildcard";
|
|
it say that I want that this "pin" to be valid for all versions
|
|
beginning with 0.4.99. This is because Debian versions its packages with a
|
|
"Debian revision" and I don't want to avoid the installation of these
|
|
revisions. So, for instance, versions 0.4.99-1 and 0.4.99-10 will be installed
|
|
as soon as they are made available. Note that if you modified the package you
|
|
won't want to do things this way.
|
|
</p>
|
|
|
|
<p>
|
|
The pin priority helps determine whether a package matching the
|
|
"Packages:" and "Pin:" lines will be installed, with higher
|
|
priorities making it more likely that a matching package will be installed.
|
|
You can read <code>apt_preferences(7)</code> for a thorough discussion of
|
|
priorities, but a few examples should give the basic idea. The following
|
|
describes the effect of setting the priority field to different values in the
|
|
sylpheed example above.
|
|
</p>
|
|
<dl>
|
|
<dt>1001</dt>
|
|
<dd>
|
|
<p>
|
|
Sylpheed version 0.4.99 will never be replaced by apt. If available, apt will
|
|
install version 0.4.99 even if it would replace an installed package with a
|
|
higher version. Only packages of priority greater than 1000 will ever
|
|
downgrade an existing package.
|
|
</p>
|
|
</dd>
|
|
</dl>
|
|
<dl>
|
|
<dt>1000</dt>
|
|
<dd>
|
|
<p>
|
|
The effect is the same as priority 1001, except that apt will refuse to
|
|
downgrade an installed version to 0.4.99
|
|
</p>
|
|
</dd>
|
|
</dl>
|
|
<dl>
|
|
<dt>990</dt>
|
|
<dd>
|
|
<p>
|
|
Version 0.4.99 will be replaced only by a higher version available from a
|
|
release designated as preferred using the "APT::Default-Release"
|
|
variable (see <a href="#s-default-version">How to keep a mixed system, Section
|
|
3.8</a>, above).
|
|
</p>
|
|
</dd>
|
|
</dl>
|
|
<dl>
|
|
<dt>500</dt>
|
|
<dd>
|
|
<p>
|
|
Any version higher than 0.4.99 of sylpheed which is available from any release
|
|
will take preference over version 0.4.99, but 0.4.99 will still be preferred to
|
|
a lower version.
|
|
</p>
|
|
</dd>
|
|
</dl>
|
|
<dl>
|
|
<dt>100</dt>
|
|
<dd>
|
|
<p>
|
|
Higher versions of sylpheed available from any release will take preference
|
|
over version 0.4.99, as will any installed higher version of slypheed; so
|
|
0.4.99 will be installed only if no version is installed already. This is the
|
|
priority of installed packages.
|
|
</p>
|
|
</dd>
|
|
</dl>
|
|
<dl>
|
|
<dt>-1</dt>
|
|
<dd>
|
|
<p>
|
|
Negative priorities are allowed as well, and prevent 0.4.99 from ever being
|
|
installed.
|
|
</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<p>
|
|
A pin can be specified on a package's <samp>version</samp>,
|
|
<samp>release</samp> or <samp>origin</samp>.
|
|
</p>
|
|
|
|
<p>
|
|
Pinning on a <samp>version</samp>, as we have seen, supports literal version
|
|
numbers as well as wildcards to specify several versions at one time.
|
|
</p>
|
|
|
|
<p>
|
|
Option <samp>release</samp> depends on the Release file from an APT repository
|
|
or from a CD. This option may be of no use at all if you're using package
|
|
repositories that don't provide this file. You may see the contents of the
|
|
Release files that you have on <samp>/var/lib/apt/lists/</samp>. The
|
|
parameters for a release are: <samp>a</samp> (archive), <samp>c</samp>
|
|
(components), <samp>v</samp> (version), <samp>o</samp> (origin) and
|
|
<samp>l</samp> (label).
|
|
</p>
|
|
|
|
<p>
|
|
An example:
|
|
</p>
|
|
|
|
<pre>
|
|
Package: *
|
|
Pin: release v=2.2*,a=stable,c=main,o=Debian,l=Debian
|
|
Pin-Priority: 1001
|
|
</pre>
|
|
|
|
<p>
|
|
In this example, we chose version 2.2* of Debian (which can be 2.2r2, 2.2r3 --
|
|
this accommodates "point releases" that typically include security
|
|
fixes and other very important updates), the <samp>stable</samp> repository,
|
|
section <samp>main</samp> (as opposed to <samp>contrib</samp> or
|
|
<samp>non-free</samp>) and origin and label Debian. Origin (o=) defines who
|
|
produced that Release file, the label (l=) defines the name of the
|
|
distribution: Debian for Debian itself and Progeny for Progeny, for example. A
|
|
sample Release file:
|
|
</p>
|
|
|
|
<pre>
|
|
$ cat /var/lib/apt/lists/ftp.debian.org.br_debian_dists_potato_main_binary-i386_Release
|
|
Archive: stable
|
|
Version: 2.2r3
|
|
Component: main
|
|
Origin: Debian
|
|
Label: Debian
|
|
Architecture: i386
|
|
</pre>
|
|
|
|
<hr>
|
|
|
|
<p>
|
|
[ <a href="ch-basico.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> ]
|
|
[ 3 ]
|
|
[ <a href="ch-helpers.en.html">4</a> ]
|
|
[ <a href="ch-search.en.html">5</a> ]
|
|
[ <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-helpers.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>
|
|
|