<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Chapter 2. Using APT on both machines</title> <meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"/> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <link rel="home" href="index.html" title="Using APT Offline"/> <link rel="up" href="index.html" title="Using APT Offline"/> <link rel="prev" href="ch1.html" title="Chapter 1. Introduction"/> <link rel="next" href="ch3.html" title="Chapter 3. Using APT and wget"/> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">Chapter 2. Using APT on both machines</th> </tr> <tr> <td align="left"><a accesskey="p" href="ch1.html">Prev</a> </td> <th width="60%" align="center"> </th> <td align="right"> <a accesskey="n" href="ch3.html">Next</a></td> </tr> </table> <hr/> </div> <div class="chapter"> <div class="titlepage"> <div> <div> <h1 class="title"><a id="ch2"/>Chapter 2. Using APT on both machines</h1> </div> </div> </div> <div class="toc"> <p> <strong>Table of Contents</strong> </p> <dl class="toc"> <dt> <span class="section"> <a href="ch2.html#s2.1">2.1. Overview</a> </span> </dt> <dt> <span class="section"> <a href="ch2.html#s2.2">2.2. The configuration file</a> </span> </dt> </dl> </div> <div class="section"> <div class="titlepage"> <div> <div> <h2 class="title"><a id="s2.1"/>2.1. Overview</h2> </div> </div> </div> <p> 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: </p> <pre class="screen"> /disc/ archives/ partial/ lists/ partial/ status sources.list apt.conf </pre> </div> <div class="section"> <div class="titlepage"> <div> <div> <h2 class="title"><a id="s2.2"/>2.2. The configuration file</h2> </div> </div> </div> <p> 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 <span class="emphasis"><em>/var/lib/dpkg/status</em></span> from the <span class="emphasis"><em>target host</em></span>. Please note, if you are using a local archive you must use copy URIs, the syntax is identical to file URIs. </p> <p> <span class="emphasis"><em>apt.conf</em></span> must contain the necessary information to make APT use the disc: </p> <pre class="screen"> APT { /* This is not necessary if the two machines are the same arch, it tells the remote APT what architecture the target 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/"; }; </pre> <p> More details can be seen by examining the apt.conf man page and the sample configuration file in <span class="emphasis"><em>/usr/share/doc/apt/examples/apt.conf</em></span>. </p> <p> On the target machine the first thing to do is mount the disc and copy <span class="emphasis"><em>/var/lib/dpkg/status</em></span> to it. You will also need to create the directories outlined in the Overview, <span class="emphasis"><em>archives/partial/</em></span> and <span class="emphasis"><em>lists/partial/</em></span>. Then take the disc to the remote machine and configure the sources.list. On the remote machine execute the following: </p> <pre class="screen"> # 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 the target machine ] </pre> <p> The dist-upgrade command can be replaced with any other standard APT commands, particularly dselect-upgrade. You can even use an APT front end such as <span class="emphasis"><em>dselect</em></span>. However this presents a problem in communicating your selections back to the local computer. </p> <p> Now the disc contains all of the index files and archives needed to upgrade the target machine. Take the disc back and run: </p> <pre class="screen"> # export APT_CONFIG="/disc/apt.conf" # apt-get check [ APT generates a local copy of the cache files ] # apt-get --no-d -o dir::state::status=/var/lib/dpkg/status dist-upgrade [ Or any other APT command ] </pre> <p> It is necessary for proper function to re-specify the status file to be the local one. This is very important! </p> <p> 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!! </p> </div> </div> <div class="navfooter"> <hr/> <table width="100%" summary="Navigation footer"> <tr> <td align="left"><a accesskey="p" href="ch1.html">Prev</a> </td> <td align="center"> </td> <td align="right"> <a accesskey="n" href="ch3.html">Next</a></td> </tr> <tr> <td align="left" valign="top">Chapter 1. Introduction </td> <td align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td align="right" valign="top"> Chapter 3. Using APT and wget</td> </tr> </table> </div> </body> </html>