<!-- retain these comments for translator revision tracking -->
<!-- Original version: $Revision: 1.24 $ -->
<chapt id="uptodate">Keeping your Debian system up-to-date

<p>A Debian goal is to provide a consistent upgrade path and a secure
upgrade process. We always do our best to make upgrading to new releases
a smooth procedure. In case there's some important note to
add to the upgrade process, the packages will alert the user, and often
provide a solution to a possible problem.

<p>You should also read the Release Notes document that describes the
details of specific upgrades. It is 
available on the Debian website at <url
id="http://www.debian.org/releases/stable/releasenotes"> and is also
shipped on the Debian CDs, DVDs and Blu-Ray discs 


<sect id="howtocurrent">How can I keep my Debian system current?

<p>One could simply execute an anonymous ftp call to a Debian archive, then
peruse the directories until one finds the desired file, and then fetch it,
and finally install it using <tt>dpkg</tt>.  Note that <tt>dpkg</tt>
will install upgrade files in place, even on a running system.
Sometimes, a revised package will require the installation of a newly revised
version of another package, in which case the installation will fail
until/unless the other package is installed.

<p>Many people find this approach much too time-consuming, since Debian
evolves so quickly -- typically, a dozen or more new packages are uploaded
every week.  This number is larger just before a new major release.
To deal with this avalanche, many people prefer to use a more automated
method.  Several different packages are available for this purpose:

<sect1 id="aptitude-upgrade">aptitude

<p>APT is an advanced interface to the Debian packaging system.  It features
complete installation ordering, multiple source capability and several other
unique features, see the User's Guide in
<tt>/usr/share/doc/apt-doc/guide.html/index.html</tt> (you will have to install
the <tt>apt-doc</tt> package).

<p><prgn/aptitude/ is the recommended package manager for &debian; systems.  It
is a text-based interface to APT using the curses library, and can be used to
perform management tasks in a fast and easy way.

<p>Before you can use <prgn/aptitude/, you'll have to edit the
<tt>/etc/apt/sources.list</tt> file to set it up.  If you wish to upgrade to
the latest stable version of Debian, you'll probably want to use a source like
this one:

<example>http://ftp.us.debian.org/debian stable main contrib non-free</example>

<p>You can replace ftp.us.debian.org with the name of a faster Debian mirror
near you. See the mirror list at
<url id="http://www.debian.org/mirror/list"> for more information.

<p>More details on this can be found in the <manref name="sources.list"
section="8"> manual page.

<p>To update your system, run
      <example>aptitude update</example>
followed by
      <example>aptitude dist-upgrade</example>
Answer any questions that might come up, and your system will be upgraded.

See also <ref id="aptitude">.

<sect1 id="apt">apt-get, dselect and apt-cdrom

<p><prgn/apt-get/ is an APT-based command-line tool for handling packages, and
the APT dselect method is an interface to APT through <prgn/dselect/. Both of
these provide a simple, safe way to install and upgrade packages.

<p>To use <prgn/apt-get/, install the <package/apt/ package, and edit the
<tt>/etc/apt/sources.list</tt> file to set it up, just as for <ref
id="aptitude-upgrade">.

<p>Then run
      <example>apt-get update</example>
followed by
      <example>apt-get dist-upgrade</example>
Answer any questions that might come up, and your system will be upgraded.
See also the <manref name="apt-get" section="8"> manual page, as well
as <ref id="apt-get">.

<p>To use APT with <prgn/dselect/, choose the APT access method in dselect's
method selection screen (option 0) and then specify the sources that should
be used. The configuration file is <file>/etc/apt/sources.list</file>.
See also <ref id="dselect">.

<p>If you want to use CDs to install packages, you can use <prgn/apt-cdrom/.
For details, please see the Release Notes, section "Setting up for an
upgrade from a local mirror".

<p>Please note that when you get and install the packages, you'll still have
them kept in your /var directory hierarchy. To keep your partition from
overflowing, remember to delete extra files using <tt>apt-get clean</tt> and
<tt>apt-get autoclean</tt>, or to move them someplace else (hint: use
<package/apt-move/).

<sect1 id="update_aptitude">aptitude

<p><prgn/aptitude/ is a text-based interface to the Debian package system.
It allows the user to view the list of packages and to perform package
management tasks such as installing, upgrading, and removing  packages (see <ref id="aptitude">).
Actions may be performed from a visual interface or from the command-line.


<p>In command line, the actions are similar to that of APT, so to upgrade your
system run
      <example>aptitude update</example>
followed by
      <example>aptitude dist-upgrade</example>

<p>Note that <prgn/aptitude/ is not the recommended tool for
doing upgrades from one &debian; release to another. For upgrades between
releases you should read the <url
id="http://www.debian.org/releases/stable/releasenotes" name="Release
Notes">. This document describes in detail the recommended steps for upgrades
from previous releases as well as known issues you should consider
before upgrading.

<p>For details, see the manual page <manref name="aptitude" section="8">,
and the file <file>/usr/share/aptitude/README</file>

<sect1 id="mirror">mirror

<p>This Perl script, and its (optional) manager program called
<prgn/mirror-master/, can be used to fetch user-specified parts of
a directory tree from a specified host <em>via</em> anonymous FTP.

<p><prgn/mirror/ is particularly useful for downloading large volumes of
software.  After the first time files have been downloaded from a site, a
file called <tt>.mirrorinfo</tt> is stored on the local host.  Changes to
the remote file system are tracked automatically by <prgn/mirror/, which
compares this file to a similar file on the remote system and downloads only
changed files.

<p>The <prgn/mirror/ program is generally useful for updating local copies
of remote directory trees.  The files fetched need not be Debian files.
(Since <prgn/mirror/ is a Perl script, it can also run on non-Unix systems.)
Though the <prgn/mirror/ program provides mechanisms for excluding files
names of which match user-specified strings, this program is most useful
when the objective is to download whole directory trees, rather than
selected packages.

<!-- Should we recommend GNU wget here, too? -->

<sect1 id="dpkg-mountable">dpkg-mountable

<p>dpkg-mountable adds an access method called `mountable' to dselect's
list, which allows you to install from any file system specified in /etc/fstab.
For example, the archive could be a normal hard disk partition or an NFS 
server, which it will automatically mount and umount for you if necessary.

<p>It also has some extra features not found in the standard dselect
methods, such as provision for a local file tree (either parallel to the
main distribution or totally separate), and only getting packages which are
required, rather than the time-consuming recursive directory scan, as well
as logging of all dpkg actions in the install method.

<sect id="upgradesingle">Must I go into single user mode in order to
  upgrade a package?

<p>No.  Packages can be upgraded in place, even in running systems.
Debian has a <tt>start-stop-daemon</tt> program that is invoked to stop,
then restart running process if necessary during a package upgrade.

<sect id="savedebs">Do I have to keep all those .deb archive files on
  my disk?

<p>No.  If you have downloaded the files to your disk
then after you have installed the packages, you can remove them from
your system, e.g. by running <tt>aptitude clean</tt>.

<sect id="keepingalog">How can I keep a log of the packages I added to the
  system?  I'd like to know when which package upgrades and removals have
  occured!

<p>Passing the <tt>--log</tt>-option to <prgn/dpkg/ makes <prgn/dpkg/
log status change updates and actions.  It logs both the
<prgn/dpkg/-invokation (e.g.

<example>
2005-12-30 18:10:33 install hello 1.3.18 2.1.1-4
</example>

<p>) and the results (e.g.

<example>
2005-12-30 18:10:35 status installed hello 2.1.1-4
</example>

<p>)  If you'd like to log all your <prgn/dpkg/ invokations (even those done
using frontends like <prgn/aptitude/), you could add

<example>
log /var/log/dpkg.log
</example>

<p>to your <file>/etc/dpkg/dpkg.cfg</file>.  Be sure the created logfile gets
rotated periodically.  If you're using <prgn/logrotate/, this can be achieved
by creating a file <file>/etc/logrotate.d/dpkg</file> with contents

<example>
/var/log/dpkg {
  missingok
  notifempty
}
</example>

<p>More details on <prgn/dpkg/ logging can be found in the <manref name="dpkg"
section="1"> manual page.

<p><prgn/aptitude/ logs the package installations, removals, and upgrades that
it intends to perform to <file>/var/log/aptitude</file>.  Note that the
<em>results</em> of those actions are not recorded in this file!

<p>Another way to record your actions is to run your package management session
within the <manref name="script" section="1"> program.

<sect id="autoupdate">Can I automatically update the system?
 
<p>Yes. You can use <prgn>cron-apt</prgn>, this tool updates the system at
regular interval by using a cron job. By default it just updates the package
list and download new packages without installing.
 
<p>Note: Automatic upgrade of packages is <strong/NOT/ recommended
in <em>testing</em> or <em>unstable</em> systems as this might bring unexpected
behaviour and remove packages without notice.
 
<sect id="aptproxy">I have several machines how can I download the updates only
one time?
 
<p>If you have more than one Debian machine on your network, it is useful to
use <prgn>apt-proxy</prgn> to keep all of your Debian systems up-to-date.
 
<p><prgn>apt-proxy</prgn> reduces the bandwidth requirements of Debian mirrors
by restricting the frequency of Packages, Releases and Sources file updates
from the back end and only doing a single fetch for any file, independently
of the actual request it from the proxy. <prgn>apt-proxy</prgn> automatically
builds a Debian HTTP mirror based on requests which pass through the proxy. 
 
<p>For more details, see the apt-proxy homepage at <url
id="http://apt-proxy.sourceforge.net/">

<p>Of course, you can get the same benefit if you are already using a standard
caching proxy and all your systems are configured to use it.
