Copying updates to other systems

It's great that Ubuntu makes its system updates available for free over the Internet. It's not so great that a complete update requires a hefty download. Case in point: just after installation, a complete upgrade to the latest packages of Feisty Fawn needs 300MB worth of files.

If you're working with a single system, then the upgrade is a necessary evil. But if you have two or more machines, does this mean that you need to download 300MB (or more) for each and every computer?

The answer, thankfully, is: not necessarily.

You can simply update the packages on a single system, burn those updates to CD, and copy them to the other machines in your care.

All the updated package files in any Ubuntu system are cached in /var/cache/apt/archives.

So can you just copy these file directly to CD and have Synaptic recognize them? Well, no, not quite. As an intermediate step, you need to create a catalog of these files. Essentially, you're creating your own custom repository. And for this, you need to run dpkg-scanpackages over your directory of Ubuntu packages. dpkg-scanpackages is needed to generate Packages, which Synaptic needs to identify a repository.

dpkg-scanpackages, though, is not installed by default in Ubuntu. You need to install it manually. It's part of dpkg-dev

Here are the steps you need to take to copy the upgrades from one Ubuntu machine to another.

On your source machine:
1) Install dpkg-dev.

sudo apt-get install dpkg-dev

2) Go to the /var/cache/apt/archives directory:

cd /var/cache/apt/archives

3) Generate the Packages file. In the example below, you the Packages file will end up in your home directory.

dpkg-scanpackages . /dev/null > ~/Packages

4) Go back to your home directory and compress the Packages file:

cd ~
gzip Packages

5) Burn the contents of /var/cache/apt/archives and the resulting Packages.gz file into a CD. Just keep them all at the CD's top-level directory.

On your target machine:
1) Fire up Synaptic. Open the Repositories dialog.

2) On the Repository dialog window, click on Third-Party Software.

3) Click on Add CD-ROM... Synaptic will search your CD for Packages.gz, which will then point to the update files on the same CD. Synaptic will prompt you for a label for the CD.

4) On the main Synaptic menu, click on Reload. Your custom repository of Ubuntu updates will now be visible to Synaptic. From here on, just follow the usual update procedure under Synaptic.

This procedure is not perfect. There may be some required packages not found in your customized CD hence causing the installation of some packages to fail. That said, Synaptic and APT are smart enough not to cause any conflicts. The main purpose here is to reduce the amount of data you need to download for updates.

Note that, by extension, this procedure can apply to non-Internet connected machines. It can also apply to additional packages, not just updates, that you might want to install via APT or Synaptic. So let's say you're in the mountains somewhere and you want to install Ubuntu with LAMP for a classroom, you could prepare a customized CD as above to update existing packages and add needed ones.