offline.sgml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <!doctype debiandoc system>
  2. <!-- -*- mode: sgml; mode: fold -*- -->
  3. <book>
  4. <title>Using APT Offline</title>
  5. <author>Jason Gunthorpe <email>jgg@debian.org</email></author>
  6. <version>$Id: offline.sgml,v 1.1 1999/02/15 06:38:03 jgg Exp $</version>
  7. <abstract>
  8. This document describes how to use APT in a non-networked environment,
  9. specificaly a 'sneaker-net' approach for performing upgrades.
  10. </abstract>
  11. <copyright>
  12. Copyright &copy; Jason Gunthorpe, 1999.
  13. <p>
  14. "APT" and this document are free software; you can redistribute them and/or
  15. modify them under the terms of the GNU General Public License as published
  16. by the Free Software Foundation; either version 2 of the License, or (at your
  17. option) any later version.
  18. <p>
  19. For more details, on Debian GNU/Linux systems, see the file
  20. /usr/doc/copyright/GPL for the full license.
  21. </copyright>
  22. <toc sect>
  23. <chapt>Introduction
  24. <!-- Overview {{{ -->
  25. <!-- ===================================================================== -->
  26. <sect>Overview
  27. <p>
  28. Normally APT requires direct access to a Debian archive, either from a local
  29. media or through a network. Another common complaint is that a Debian machine
  30. is on a slow link, such as a modem and another machine has a very fast
  31. connection but they are physically distant.
  32. <p>
  33. The solution to this is to use large removable media such as a Zip disc or a
  34. SuperDisk disc. These discs are not large enough to store the entire Debian
  35. archive but can easially fit a subset large enough for most users. The idea
  36. is to use APT to generate a list of packages that are required and then fetch
  37. them onto the disc using another machine with good connectivity. It is
  38. even Possible to use another Debian machine with APT or to use a completely
  39. different OS and a download tool like wget.
  40. <p>
  41. This is achived by creatively manipulating the APT configuration file. The
  42. essential premis to tell APT to look on a disc for it's archive files. Note
  43. that the disc should be formated with a filesystem that can handle long file
  44. names such as ext2, fat32 or vfat.
  45. </sect>
  46. <!-- }}} -->
  47. <chapt>Using APT on both machines
  48. <!-- Overview {{{ -->
  49. <!-- ===================================================================== -->
  50. <sect>Overview
  51. <p>
  52. APT being available on both machines gives the simplest configuration. The
  53. basic idea is to place a copy of the status file on the disc and use the
  54. remote machine to fetch the latest package files and decide which packages to
  55. download. The disk directory structure should look like:
  56. <example>
  57. /disc/
  58. archives/
  59. partial/
  60. lists/
  61. partial/
  62. status
  63. sources.list
  64. apt.conf
  65. </example>
  66. </sect>
  67. <!-- }}} -->
  68. <!-- The configuartion file {{{ -->
  69. <!-- ===================================================================== -->
  70. <sect>The configuration file
  71. <p>
  72. The configuration file should tell APT to store its files on the disc and
  73. to use the configuration files on the disc as well. The sources.list should
  74. contain the proper sites that you wish to use from the remote machine, and
  75. the status file should be a copy of <em>/var/lib/dpkg/status</em>. Please note,
  76. if you are using a local archive you must use copy URIs, the syntax is identical
  77. to file URIs.
  78. <p>
  79. <em>apt.conf</em> must contain the necessary information to make APT use the
  80. disc:
  81. <example>
  82. APT
  83. {
  84. /* This is not necessary if the two machines are the same arch, it tells
  85. the remote APT what architecture the Debian machine is */
  86. Architecture "i386";
  87. Get::Download-Only "true";
  88. };
  89. Dir
  90. {
  91. /* Use the disc for state information and redirect the status file from
  92. the /var/lib/dpkg default */
  93. State "/disc/";
  94. State::status "status";
  95. // Binary caches will be stored localy
  96. Cache::archives "/disc/archives/";
  97. // Location of the source list.
  98. Etc "/disc/";
  99. };
  100. </example>
  101. More details can be seen by examining the apt.conf man page and the sample
  102. configuration file in <em>/usr/doc/apt/examples/apt.conf</em>.
  103. <p>
  104. On the Debian machine the first thing to do is mount the disc and copy
  105. <em>/var/lib/dpkg/status</em> to it. You will also need to create the directories
  106. outlined in the Overview, <em>archives/partial/</em> and <em>lists/partial/</em>
  107. Then take the disc to the remote machine and configure the sources.list.
  108. On the remote machine execute the following:
  109. <example>
  110. # export APT_CONFIG="/disc/apt.conf"
  111. # apt-get update
  112. [ APT fetches the package files ]
  113. # apt-get dist-upgrade
  114. [ APT fetches all the packages needed to upgrade your machine ]
  115. </example>
  116. The dist-upgrade command can be replaced with any-other standard APT commands,
  117. you can even use an APT front end such as <em>gnome-apt</em> [still in
  118. development].
  119. <p>
  120. Now the disc contains all of the index files and archives needed to upgrade
  121. the Debian machine. Take the disc back and run:
  122. <example>
  123. # export APT_CONFIG="/disc/apt.conf"
  124. # apt-get check
  125. [ APT generates a local copy of the cache files ]
  126. # apt-get --no-d -o dir::etc::status=/var/lib/dpkg/status dist-upgrade
  127. [ Or any other APT command ]
  128. </example>
  129. <p>
  130. It is necessary for proper function to re-specify the status file to be the
  131. local one. This is very important!
  132. </sect>
  133. <!-- }}} -->
  134. <chapt>Using APT and wget
  135. <!-- Overview {{{ -->
  136. <!-- ===================================================================== -->
  137. <sect>Overview
  138. <p>
  139. <em>wget</em> is a popular and portable download tool that can run on nearly
  140. any machine. Unlike the method above this requires that the Debian machine
  141. already has a list of available packages.
  142. <p>
  143. The basic idea is to create a disc that has only the archive files downloaded
  144. from the remote site. This is done by using the --print-uris option to apt-get
  145. and then preparing a wget script to actually fetch the packages.
  146. </sect>
  147. <!-- }}} -->
  148. <!-- Operation {{{ -->
  149. <!-- ===================================================================== -->
  150. <sect>Operation
  151. <p>
  152. Unlike the previous techinque no special configuration files are required. We
  153. mearly use the standard APT commands to generate the file list.
  154. <example>
  155. # apt-get dist-upgrade
  156. [ Press no when prompted, make sure you are happy with the actions ]
  157. # apt-get -qq --print-uris dist-upgrade > uris
  158. # awk '{print "wget -O " $2 " " $1}' < uris > /disc/wget-script
  159. </example>
  160. The /disc/wget-script file will now contain a list of wget commands to execute
  161. in order to fetch the necessary archives. This script should be run with the
  162. current directory as the disc's mount point so as to save the output on the
  163. disc.
  164. <p>
  165. The remote machine would do something like
  166. <example>
  167. # cd /disc
  168. # sh -x ./wget-script
  169. [ wait.. ]
  170. </example>
  171. Once the archives are downloaded and the disc returned to the Debian machine
  172. installation can proceed using,
  173. <example>
  174. # apt-get -o dir::cache::archives="/disc/" dist-upgrade
  175. </example>
  176. Which will use the already fetched archives on the disc.
  177. </sect>
  178. <!-- }}} -->
  179. </book>