Using APT Offline - Using APT on both machines

[ previous ] [ Abstract ] [ Copyright Notice ] [ Contents ] [ next ]

# Using APT Offline
Chapter 2 Using APT on both machines

## 2.1 Overview

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:

           /disc/
             archives/
                partial/
             lists/
                partial/
             status
             sources.list
             apt.conf

## 2.2 The configuration file

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. 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:

          APT
          {
            /* This is not necessary if the two machines are the same arch, it tells
               the remote APT what architecture the Debian machine is */
            Architecture "i386";

            Get::Download-Only "true";
          };

          Dir
          {
            /* Use the disc for state information and redirect the status file from
               the /var/lib/dpkg default */
            State "/disc/";
            State::status "status";

            // Binary caches will be stored locally
            Cache::archives "/disc/archives/";
            Cache "/tmp/";

            // Location of the source list.
            Etc "/disc/";
          };

More details can be seen by examining the apt.conf man page and the sample configuration file in /usr/doc/apt/examples/apt.conf.

On the remote Debian 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:

          # export APT_CONFIG="/disc/apt.conf"
          # apt-get update
          [ APT fetches the package files ]
          # apt-get dist-upgrade
          [ APT fetches all the packages needed to upgrade your machine ]

The dist-upgrade command can be replaced with any-other standard APT commands, particularly dselect-upgrad. You can even use an APT front end such as dselect However this presents a problem in communicating your selections back to the local computer.

Now the disc contains all of the index files and archives needed to upgrade the Debian machine. Take the disc back and run:

           # export APT_CONFIG="/disc/apt.conf"
           # apt-get check
           [ APT generates a local copy of the cache files ]
           # apt-get --no-d -o dir::etc::status=/var/lib/dpkg/status dist-upgrade
           [ Or any other APT command ]

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!!

[ previous ] [ Abstract ] [ Copyright Notice ] [ Contents ] [ next ]

Using APT Offline