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