keeping_your_debian_system_up-to-date.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 9. Keeping your Debian system up-to-date</title><link rel="stylesheet" type="text/css" href="debian.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="home" href="index.en.html" title="The Debian GNU/Linux FAQ" /><link rel="up" href="index.en.html" title="The Debian GNU/Linux FAQ" /><link rel="prev" href="pkgtools.en.html" title="Chapter 8. The Debian package management tools" /><link rel="next" href="kernel.en.html" title="Chapter 10. Debian and the kernel" /><meta xmlns="" name="viewport" content="width=device-width, initial-scale=1" /><style xmlns="" type="text/css">
  3. body {
  4. background-repeat: no-repeat;
  5. background-image: none;
  6. }
  7. </style></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 9. Keeping your Debian system up-to-date</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="pkgtools.en.html"><img src="images/prev.png" alt="Prev" /></a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="kernel.en.html"><img src="images/next.png" alt="Next" /></a></td></tr></table><hr /></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a id="uptodate"></a>Chapter 9. Keeping your Debian system up-to-date</h1></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="uptodate.en.html#howtocurrent">9.1. How can I keep my Debian system current?</a></span></dt><dd><dl><dt><span class="section"><a href="uptodate.en.html#aptitude-upgrade">9.1.1. aptitude</a></span></dt><dt><span class="section"><a href="uptodate.en.html#apt">9.1.2. apt-get and apt-cdrom</a></span></dt><dt><span class="section"><a href="uptodate.en.html#mirror">9.1.3. mirror</a></span></dt></dl></dd><dt><span class="section"><a href="uptodate.en.html#upgradesingle">9.2. Must I go into single user mode in order to upgrade a package?</a></span></dt><dt><span class="section"><a href="uptodate.en.html#savedebs">9.3. Do I have to keep all those .deb archive files on my disk?</a></span></dt><dt><span class="section"><a href="uptodate.en.html#keepingalog">9.4. How can I keep a log of the packages I added to the system? I'd like to know when upgrades and removals have occurred and on which packages!</a></span></dt><dt><span class="section"><a href="uptodate.en.html#autoupdate">9.5. Can I automatically update the system?</a></span></dt><dt><span class="section"><a href="uptodate.en.html#aptcacher">9.6. I have several machines; how can I download the updates only one time?</a></span></dt></dl></div><p>
  8. One of Debian's goals is to provide a consistent upgrade path and a secure
  9. upgrade process. We always do our best to make upgrading to new releases a
  10. smooth procedure. In case there's some important note to add to the upgrade
  11. process, the packages will alert the user, and often provide a solution to a
  12. possible problem.
  13. </p><p>
  14. You should also read the Release Notes document that describes the details of
  15. specific upgrades. It is available on the Debian website at <a class="ulink" href="https://www.debian.org/releases/stable/releasenotes" target="_top">https://www.debian.org/releases/stable/releasenotes</a>
  16. and is also shipped on the Debian CDs, DVDs and Blu-ray discs.
  17. </p><div class="section"><div class="titlepage"><div><div><h2 class="title"><a id="howtocurrent"></a>9.1. How can I keep my Debian system current?</h2></div></div></div><p>
  18. One could simply execute an anonymous ftp call to a Debian archive, then peruse
  19. the directories until one finds the desired file, and then fetch it, and
  20. finally install it using <code class="literal">dpkg</code>. Note that
  21. <code class="literal">dpkg</code> will install upgrade files in place, even on a running
  22. system. Sometimes, a revised package will require the installation of a newly
  23. revised version of another package, in which case the installation will fail
  24. until/unless the other package is installed.
  25. </p><p>
  26. Many people find this approach much too time-consuming, since Debian evolves so
  27. quickly -- typically, a dozen or more new packages are uploaded every week.
  28. This number is larger just before a new major release. To deal with this
  29. avalanche, many people prefer to use a more automated method. Several
  30. different packages are available for this purpose:
  31. </p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="aptitude-upgrade"></a>9.1.1. aptitude</h3></div></div></div><p>
  32. <span class="command"><strong>aptitude</strong></span> is the recommended package manager for Debian GNU/Linux
  33. systems, and is described in <a class="xref" href="pkgtools.en.html#aptitude" title="8.1.3. aptitude">Section 8.1.3, “aptitude”</a>.
  34. </p><p>
  35. Before you can use <span class="command"><strong>aptitude</strong></span> to make an upgrade, you'll have
  36. to edit the <code class="literal">/etc/apt/sources.list</code> file to set it up. If you
  37. wish to upgrade to the latest stable version of Debian, you'll probably want to
  38. use a source like this one:
  39. </p><pre class="screen">
  40. http://ftp.us.debian.org/debian stable main contrib
  41. </pre><p>
  42. You can replace ftp.us.debian.org (the mirror in the United States) with the
  43. name of a faster Debian mirror near you. See the mirror list at <a class="ulink" href="https://www.debian.org/mirror/list" target="_top">https://www.debian.org/mirror/list</a>
  44. for more information.
  45. </p><p>
  46. Or you can use the redirector service httpredir.debian.org which aims to solve
  47. the problem of choosing a Debian mirror. It uses the geographic location of
  48. the user and other information to choose the best mirror that can serve the
  49. files. To take advantage of it use a source like this one:
  50. </p><pre class="screen">
  51. http://httpredir.debian.org/debian stable main contrib
  52. </pre><p>
  53. More details on this can be found in the
  54. <span class="citerefentry"><span class="refentrytitle">sources.list</span>(5)</span>
  55. manual page.
  56. </p><p>
  57. To update your system from the command line, run
  58. </p><pre class="screen">
  59. aptitude update
  60. </pre><p>
  61. followed by
  62. </p><pre class="screen">
  63. aptitude full-upgrade
  64. </pre><p>
  65. Answer any questions that might come up, and your system will be upgraded.
  66. </p><p>
  67. Note that <span class="command"><strong>aptitude</strong></span> is not the recommended tool for doing
  68. upgrades from one Debian GNU/Linux release to another. Use
  69. <span class="command"><strong>apt-get</strong></span> instead. For upgrades between releases you should
  70. read the <a class="ulink" href="https://www.debian.org/releases/stable/releasenotes" target="_top">Release Notes</a>.
  71. This document describes in detail the recommended steps for upgrades from
  72. previous releases as well as known issues you should consider before upgrading.
  73. </p><p>
  74. For details, see the manual page
  75. <span class="citerefentry"><span class="refentrytitle">aptitude</span>(8)</span>,
  76. and the file <code class="filename">/usr/share/aptitude/README</code>.
  77. </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="apt"></a>9.1.2. apt-get and apt-cdrom</h3></div></div></div><p>
  78. An alternative to <span class="command"><strong>aptitude</strong></span> is <span class="command"><strong>apt-get</strong></span>
  79. which is an APT-based command-line tool (described previously in <a class="xref" href="pkgtools.en.html#apt-get" title="8.1.2. APT">Section 8.1.2, “APT”</a>).
  80. </p><p>
  81. <span class="command"><strong>apt-get</strong></span>, the APT-based command-line tool for handling
  82. packages, provides a simple, safe way to install and upgrade packages.
  83. </p><p>
  84. To use <span class="command"><strong>apt-get</strong></span>, edit the
  85. <code class="literal">/etc/apt/sources.list</code> file to set it up, just as for <a class="xref" href="uptodate.en.html#aptitude-upgrade" title="9.1.1. aptitude">Section 9.1.1, “aptitude”</a>.
  86. </p><p>
  87. Then run
  88. </p><pre class="screen">
  89. apt-get update
  90. </pre><p>
  91. followed by
  92. </p><pre class="screen">
  93. apt-get dist-upgrade
  94. </pre><p>
  95. Answer any questions that might come up, and your system will be upgraded. See
  96. also the
  97. <span class="citerefentry"><span class="refentrytitle">apt-get</span>(8)</span>
  98. manual page, as well as <a class="xref" href="pkgtools.en.html#apt-get" title="8.1.2. APT">Section 8.1.2, “APT”</a>.
  99. </p><p>
  100. If you want to use CDs/DVDs/BDs to install packages, you can use
  101. <span class="command"><strong>apt-cdrom</strong></span>. For details, please see the Release Notes,
  102. section "Adding APT sources from optical media".
  103. </p><p>
  104. Please note that when you get and install the packages, you'll still have them
  105. kept in your /var directory hierarchy. To keep your partition from
  106. overflowing, remember to delete extra files using <code class="literal">apt-get
  107. clean</code> and <code class="literal">apt-get autoclean</code>, or to move them
  108. someplace else (hint: use <code class="systemitem">apt-move</code><a id="idm1712" class="indexterm"></a>).
  109. </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="mirror"></a>9.1.3. mirror</h3></div></div></div><p>
  110. This Perl script, and its (optional) manager program called
  111. <span class="command"><strong>mirror-master</strong></span>, can be used to fetch user-specified parts of
  112. a directory tree from a specified host <span class="emphasis"><em>via</em></span> anonymous FTP.
  113. </p><p>
  114. <span class="command"><strong>mirror</strong></span> is particularly useful for downloading large volumes
  115. of software. After the first time files have been downloaded from a site, a
  116. file called <code class="literal">.mirrorinfo</code> is stored on the local host.
  117. Changes to the remote file system are tracked automatically by
  118. <span class="command"><strong>mirror</strong></span>, which compares this file to a similar file on the
  119. remote system and downloads only changed files.
  120. </p><p>
  121. The <span class="command"><strong>mirror</strong></span> program is generally useful for updating local
  122. copies of remote directory trees. The files fetched need not be Debian files.
  123. (Since <span class="command"><strong>mirror</strong></span> is a Perl script, it can also run on non-Unix
  124. systems.) Though the <span class="command"><strong>mirror</strong></span> program provides mechanisms for
  125. excluding files with names matching user-specified strings, this program is
  126. most useful when the objective is to download whole directory trees, rather
  127. than selected packages.
  128. </p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title"><a id="upgradesingle"></a>9.2. Must I go into single user mode in order to upgrade a package?</h2></div></div></div><p>
  129. No. Packages can be upgraded in place, even in running systems. Debian has a
  130. <code class="literal">start-stop-daemon</code> program that is invoked to stop, then
  131. restart running process if necessary during a package upgrade.
  132. </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title"><a id="savedebs"></a>9.3. Do I have to keep all those .deb archive files on my disk?</h2></div></div></div><p>
  133. No. If you have downloaded the files to your disk then after you have
  134. installed the packages, you can remove them from your system, e.g. by running
  135. <code class="literal">aptitude clean</code>.
  136. </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title"><a id="keepingalog"></a>9.4. How can I keep a log of the packages I added to the system? I'd like to know when upgrades and removals have occurred and on which packages!</h2></div></div></div><p>
  137. Passing the <code class="literal">--log</code>-option to <span class="command"><strong>dpkg</strong></span> makes
  138. <span class="command"><strong>dpkg</strong></span> log status change updates and actions. It logs both
  139. the <span class="command"><strong>dpkg</strong></span>-invokation (e.g.
  140. </p><pre class="screen">
  141. 2005-12-30 18:10:33 install hello 1.3.18 2.1.1-4
  142. </pre><p>
  143. ) and the results (e.g.
  144. </p><pre class="screen">
  145. 2005-12-30 18:10:35 status installed hello 2.1.1-4
  146. </pre><p>
  147. ) If you'd like to log all your <span class="command"><strong>dpkg</strong></span> invocations (even those
  148. done using frontends like <span class="command"><strong>aptitude</strong></span>), you could add
  149. </p><pre class="screen">
  150. log /var/log/dpkg.log
  151. </pre><p>
  152. to your <code class="filename">/etc/dpkg/dpkg.cfg</code>. Be sure the created logfile
  153. gets rotated periodically. If you're using <span class="command"><strong>logrotate</strong></span>, this
  154. can be achieved by creating a file <code class="filename">/etc/logrotate.d/dpkg</code>
  155. with the following lines
  156. </p><pre class="screen">
  157. /var/log/dpkg {
  158. missingok
  159. notifempty
  160. }
  161. </pre><p>
  162. More details on <span class="command"><strong>dpkg</strong></span> logging can be found in the
  163. <span class="citerefentry"><span class="refentrytitle">dpkg</span>(1)</span>
  164. manual page.
  165. </p><p>
  166. <span class="command"><strong>aptitude</strong></span> logs the package installations, removals, and
  167. upgrades that it intends to perform to <code class="filename">/var/log/aptitude</code>.
  168. Note that the <span class="emphasis"><em>results</em></span> of those actions are not recorded in
  169. this file!
  170. </p><p>
  171. Another way to record your actions is to run your package management session
  172. within the
  173. <span class="citerefentry"><span class="refentrytitle">script</span>(1)</span>
  174. program.
  175. </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title"><a id="autoupdate"></a>9.5. Can I automatically update the system?</h2></div></div></div><p>
  176. Yes. You can use <span class="command"><strong>cron-apt</strong></span>; this tool updates the system at
  177. regular intervals using a cron job. By default it just updates the package
  178. list and downloads new packages, but without installing them.
  179. </p><p>
  180. Note: Automatic upgrade of packages is <span class="strong"><strong>NOT</strong></span>
  181. recommended in <span class="emphasis"><em>testing</em></span> or <span class="emphasis"><em>unstable</em></span>
  182. systems as this might bring unexpected behaviour and remove packages without
  183. notice.
  184. </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title"><a id="aptcacher"></a>9.6. I have several machines; how can I download the updates only one time?</h2></div></div></div><p>
  185. If you have more than one Debian machine on your network, it is useful to use
  186. <span class="command"><strong>apt-cacher</strong></span> to keep all of your Debian systems up-to-date.
  187. </p><p>
  188. <span class="command"><strong>apt-cacher</strong></span> reduces the bandwidth requirements of Debian
  189. mirrors by restricting the frequency of Packages, Releases and Sources file
  190. updates from the back end and only doing a single fetch for any file,
  191. independently of the actual request from the proxy.
  192. <span class="command"><strong>apt-cacher</strong></span> automatically builds a Debian HTTP mirror based
  193. on requests which pass through the proxy.
  194. </p><p>
  195. Of course, you can get the same benefit if you are already using a standard
  196. caching proxy and all your systems are configured to use it.
  197. </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="pkgtools.en.html"><img src="images/prev.png" alt="Prev" /></a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="kernel.en.html"><img src="images/next.png" alt="Next" /></a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 8. The Debian package management tools </td><td width="20%" align="center"><a accesskey="h" href="index.en.html"><img src="images/home.png" alt="Home" /></a></td><td width="40%" align="right" valign="top"> Chapter 10. Debian and the kernel</td></tr></table></div></body></html>