"APT" and this document are free software; you can redistribute them and/or modify them under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
For more details, on Debian GNU/Linux systems, see the file /usr/share/common-licenses/GPL for the full license.
Normally APT requires direct access to a Debian archive, either from a local media or through a network. Another common complaint is that a Debian machine is on a slow link, such as a modem and another machine has a very fast connection but they are physically distant.
The solution to this is to use large removable media such as a Zip disc or a SuperDisk disc. These discs are not large enough to store the entire Debian archive but can easily fit a subset large enough for most users. The idea is to use APT to generate a list of packages that are required and then fetch them onto the disc using another machine with good connectivity. It is even possible to use another Debian machine with APT or to use a completely different OS and a download tool like wget. Let remote host mean the machine downloading the packages, and target host the one with bad or no connection.
This is achieved by creatively manipulating the APT configuration file. The essential premise to tell APT to look on a disc for it's archive files. Note that the disc should be formated with a filesystem that can handle long file names such as ext2, fat32 or vfat.
APT being available on both machines gives the simplest configuration. The
basic idea is to place a copy of the status file on the disc and use the
remote machine to fetch the latest package files and decide which packages to
download. The disk directory structure should look like:
The configuration file should tell APT to store its files on the disc and to use the configuration files on the disc as well. The sources.list should contain the proper sites that you wish to use from the remote machine, and the status file should be a copy of /var/lib/dpkg/status from the target host. Please note, if you are using a local archive you must use copy URIs, the syntax is identical to file URIs.
apt.conf must contain the necessary information to make APT use the
disc:
On the target machine the first thing to do is mount the disc and copy
/var/lib/dpkg/status to it. You will also need to create the directories
outlined in the Overview, archives/partial/ and lists/partial/.
Then take the disc to the remote machine and configure the sources.list.
On the remote machine execute the following:
Now the disc contains all of the index files and archives needed to upgrade
the target machine. Take the disc back and run:
It is necessary for proper function to re-specify the status file to be the local one. This is very important!
If you are using dselect you can do the very risky operation of copying disc/status to /var/lib/dpkg/status so that any selections you made on the remote machine are updated. I highly recommend that people only make selections on the local machine - but this may not always be possible. DO NOT copy the status file if dpkg or APT have been run in the mean time!!
wget is a popular and portable download tool that can run on nearly any machine. Unlike the method above this requires that the Debian machine already has a list of available packages.
The basic idea is to create a disc that has only the archive files downloaded from the remote site. This is done by using the --print-uris option to apt-get and then preparing a wget script to actually fetch the packages.
Unlike the previous technique no special configuration files are required. We
merely use the standard APT commands to generate the file list.
The /disc/wget-script file will now contain a list of wget commands to execute in order to fetch the necessary archives. This script should be run with the current directory as the disc's mount point so as to save the output on the disc.
The remote machine would do something like