Home

Jeff MacLoue

UBUMIRROR - an «intelligent» APT mirror

ubumirror.pl is a simple Perl script to create and maintain functional Ubuntu distribution mirror to aid networked installation and update process. Please use apt-mirror for more general solution.

Installation

Not required, just ensure you have a working wget and the following Perl modules:

  • IO::Zlib
  • File::Find
  • URI
  • Getopt::Std

These are rather common and may be available in the perl package or separate packages from your distribution.

A handy boilerplate Makefile is included in the tar.bz2 distribution to check module availability and copy ubumirror.pl to /usr/local/bin/.

Configuration and invocation

All the configuration is done through the command line. To get a short help on supported switches and default values use --help.

-v option is strongly recommended for interactive use, not much output without it (TODO: add timestamps to messages).

The only required parameter is distribution/repository specification, e.g. lucid/main. For minimal mirror suitable for installation call ubumirror.pl like that:

ubumirror.pl lucid{,-updates,-security}/{main,restricted}

Note the shell expansion in action, this command can be also specified like the following:

ubumirror.pl lucid/main lucid/restricted \

      lucid-updates/main lucid-updates/restricted \

      lucid-security/main lucid-security/restricted

You can also try to mirror updates only:

ubumirror.pl lucid-{updates,security}/{main,restricted}

(however I didn't test this)

Put something like that in your crontab to run daily or hourly or whatever you like.

Using the mirror

  1. Make the mirror directory available through a web server and note the base URL, say, http://server.lan/mirrors/ubuntu/.

  2. Put something like that in your /etc/apt/sources.list:

    deb http://server.lan/mirrors/ubuntu/ lucid main restricted

    deb http://server.lan/mirrors/ubuntu/ lucid-security main restricted

    deb http://server.lan/mirrors/ubuntu/ lucid-updates main restricted

  3. Delete (or better comment out) references to the default Ubuntu archive specifications.

  4. Update package indices - for example with apt-get update.