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