]> git.saurik.com Git - apt.git/blame - doc/offline.dbk
apt-private: #ifdef HAVE_STRUCT_STATFS_F_TYPE, not #if
[apt.git] / doc / offline.dbk
CommitLineData
271733ee 1<?xml version="1.0" encoding="UTF-8"?>
271733ee
GJ
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
5abbf5bb 4<!ENTITY % aptent SYSTEM "apt.ent"> %aptent;
271733ee 5<!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent"> %aptverbatiment;
5abbf5bb 6<!ENTITY % aptvendor SYSTEM "apt-vendor.ent"> %aptvendor;
271733ee
GJ
7]>
8
9<book lang="en">
10
a66a514f
AL
11<title>Using APT Offline</title>
12
271733ee
GJ
13<bookinfo>
14
15<authorgroup>
16 <author>
17 <personname>Jason Gunthorpe</personname><email>jgg@debian.org</email>
18 </author>
19</authorgroup>
20
21<releaseinfo>Version &apt-product-version;</releaseinfo>
a66a514f
AL
22
23<abstract>
271733ee
GJ
24<para>
25This document describes how to use APT in a non-networked environment,
03af163f 26specifically a 'sneaker-net' approach for performing upgrades.
271733ee 27</para>
a66a514f
AL
28</abstract>
29
271733ee
GJ
30<copyright><year>1999</year><holder>Jason Gunthorpe</holder></copyright>
31
32<legalnotice>
33<title>License Notice</title>
34<para>
a66a514f 35"APT" and this document are free software; you can redistribute them and/or
271733ee
GJ
36modify them under the terms of the GNU General Public License as published by
37the Free Software Foundation; either version 2 of the License, or (at your
a66a514f 38option) any later version.
271733ee
GJ
39</para>
40<para>
b176de3a 41For more details, on Debian systems, see the file
2926128f 42/usr/share/common-licenses/GPL for the full license.
271733ee
GJ
43</para>
44</legalnotice>
a66a514f 45
271733ee 46</bookinfo>
a66a514f 47
271733ee 48<chapter id="ch1"><title>Introduction</title>
a66a514f 49
271733ee
GJ
50<section id="s1.1"><title>Overview</title>
51<para>
a66a514f
AL
52Normally APT requires direct access to a Debian archive, either from a local
53media or through a network. Another common complaint is that a Debian machine
271733ee 54is on a slow link, such as a modem and another machine has a very fast
a66a514f 55connection but they are physically distant.
271733ee
GJ
56</para>
57<para>
58The solution to this is to use large removable media such as a Zip disc or a
a66a514f 59SuperDisk disc. These discs are not large enough to store the entire Debian
271733ee
GJ
60archive but can easily fit a subset large enough for most users. The idea is
61to use APT to generate a list of packages that are required and then fetch them
62onto the disc using another machine with good connectivity. It is even
63possible to use another Debian machine with APT or to use a completely
64different OS and a download tool like wget. Let <emphasis>remote
65host</emphasis> mean the machine downloading the packages, and <emphasis>target
66host</emphasis> the one with bad or no connection.
67</para>
68<para>
03af163f 69This is achieved by creatively manipulating the APT configuration file. The
46e39c8e 70essential premise to tell APT to look on a disc for it's archive files. Note
3a8776a3 71that the disc should be formatted with a filesystem that can handle long file
a66a514f 72names such as ext2, fat32 or vfat.
271733ee
GJ
73</para>
74</section>
a66a514f 75
271733ee 76</chapter>
a66a514f 77
271733ee 78<chapter id="ch2"><title>Using APT on both machines</title>
a66a514f 79
271733ee
GJ
80<section id="s2.1"><title>Overview</title>
81<para>
82APT being available on both machines gives the simplest configuration. The
83basic idea is to place a copy of the status file on the disc and use the remote
84machine to fetch the latest package files and decide which packages to
a66a514f 85download. The disk directory structure should look like:
271733ee
GJ
86</para>
87<screen>
a66a514f
AL
88 /disc/
89 archives/
90 partial/
91 lists/
92 partial/
93 status
94 sources.list
95 apt.conf
271733ee
GJ
96</screen>
97</section>
98
99<section id="s2.2"><title>The configuration file</title>
100<para>
101The configuration file should tell APT to store its files on the disc and to
102use the configuration files on the disc as well. The sources.list should
103contain the proper sites that you wish to use from the remote machine, and the
104status file should be a copy of <emphasis>/var/lib/dpkg/status</emphasis> from
105the <emphasis>target host</emphasis>. Please note, if you are using a local
106archive you must use copy URIs, the syntax is identical to file URIs.
107</para>
108<para>
109<emphasis>apt.conf</emphasis> must contain the necessary information to make
110APT use the disc:
111</para>
112<screen>
a66a514f
AL
113 APT
114 {
115 /* This is not necessary if the two machines are the same arch, it tells
800c34cb 116 the remote APT what architecture the target machine is */
a66a514f 117 Architecture "i386";
271733ee 118
a66a514f
AL
119 Get::Download-Only "true";
120 };
271733ee 121
a66a514f
AL
122 Dir
123 {
124 /* Use the disc for state information and redirect the status file from
125 the /var/lib/dpkg default */
126 State "/disc/";
127 State::status "status";
128
03af163f 129 // Binary caches will be stored locally
a66a514f 130 Cache::archives "/disc/archives/";
c86f0a01 131 Cache "/tmp/";
271733ee 132
a66a514f
AL
133 // Location of the source list.
134 Etc "/disc/";
271733ee
GJ
135 };
136</screen>
137<para>
a66a514f 138More details can be seen by examining the apt.conf man page and the sample
271733ee
GJ
139configuration file in
140<emphasis>/usr/share/doc/apt/examples/apt.conf</emphasis>.
141</para>
142<para>
143On the target machine the first thing to do is mount the disc and copy
144<emphasis>/var/lib/dpkg/status</emphasis> to it. You will also need
145to create the directories outlined in the Overview,
146<emphasis>archives/partial/</emphasis> and
147<emphasis>lists/partial/</emphasis>. Then take the disc to the
148remote machine and configure the sources.list. On the remote
149machine execute the following:
150</para>
151<screen>
a66a514f
AL
152 # export APT_CONFIG="/disc/apt.conf"
153 # apt-get update
154 [ APT fetches the package files ]
155 # apt-get dist-upgrade
800c34cb 156 [ APT fetches all the packages needed to upgrade the target machine ]
271733ee
GJ
157</screen>
158<para>
46e39c8e 159The dist-upgrade command can be replaced with any other standard APT commands,
271733ee
GJ
160particularly dselect-upgrade. You can even use an APT front end such as
161<emphasis>dselect</emphasis>. However this presents a problem in communicating
162your selections back to the local computer.
163</para>
164<para>
165Now the disc contains all of the index files and archives needed to upgrade the
166target machine. Take the disc back and run:
167</para>
168<screen>
a66a514f
AL
169 # export APT_CONFIG="/disc/apt.conf"
170 # apt-get check
171 [ APT generates a local copy of the cache files ]
2a65de6b 172 # apt-get --no-d -o dir::state::status=/var/lib/dpkg/status dist-upgrade
a66a514f 173 [ Or any other APT command ]
271733ee
GJ
174</screen>
175<para>
176It is necessary for proper function to re-specify the status file to be the
a66a514f 177local one. This is very important!
271733ee
GJ
178</para>
179<para>
180If you are using dselect you can do the very risky operation of copying
b2e465d6 181disc/status to /var/lib/dpkg/status so that any selections you made on the
271733ee
GJ
182remote machine are updated. I highly recommend that people only make
183selections on the local machine - but this may not always be possible. DO NOT
184copy the status file if dpkg or APT have been run in the mean time!!
185</para>
186</section>
187
188</chapter>
189
190<chapter id="ch3"><title>Using APT and wget</title>
191
192<section id="s3.1"><title>Overview</title>
193<para>
194<emphasis>wget</emphasis> is a popular and portable download tool that can run
195on nearly any machine. Unlike the method above this requires that the Debian
196machine already has a list of available packages.
197</para>
198<para>
a66a514f
AL
199The basic idea is to create a disc that has only the archive files downloaded
200from the remote site. This is done by using the --print-uris option to apt-get
201and then preparing a wget script to actually fetch the packages.
271733ee
GJ
202</para>
203</section>
a66a514f 204
271733ee
GJ
205<section id="s3.2"><title>Operation</title>
206<para>
03af163f
AL
207Unlike the previous technique no special configuration files are required. We
208merely use the standard APT commands to generate the file list.
271733ee
GJ
209</para>
210<screen>
211 # apt-get dist-upgrade
a66a514f 212 [ Press no when prompted, make sure you are happy with the actions ]
271733ee
GJ
213 # apt-get -qq --print-uris dist-upgrade &gt; uris
214 # awk '{print "wget -O " $2 " " $1}' &lt; uris &gt; /disc/wget-script
215</screen>
216<para>
217Any command other than dist-upgrade could be used here, including
b2e465d6 218dselect-upgrade.
271733ee
GJ
219</para>
220<para>
221The /disc/wget-script file will now contain a list of wget commands to execute
a66a514f 222in order to fetch the necessary archives. This script should be run with the
271733ee 223current directory as the disc's mount point so as to save the output on the
a66a514f 224disc.
271733ee
GJ
225</para>
226<para>
a66a514f 227The remote machine would do something like
271733ee
GJ
228</para>
229<screen>
a66a514f
AL
230 # cd /disc
231 # sh -x ./wget-script
232 [ wait.. ]
271733ee
GJ
233</screen>
234<para>
a66a514f
AL
235Once the archives are downloaded and the disc returned to the Debian machine
236installation can proceed using,
271733ee
GJ
237</para>
238<screen>
a66a514f 239 # apt-get -o dir::cache::archives="/disc/" dist-upgrade
271733ee
GJ
240</screen>
241<para>
a66a514f 242Which will use the already fetched archives on the disc.
271733ee
GJ
243</para>
244</section>
245
246</chapter>
a66a514f 247
a66a514f 248</book>