Table of Contents

Local mirror

When installing a serious set of almost equal Debian or Ubuntu machines, it might be useful to create a local apt mirror. This has the advantage of saving bandwidth when installing more machines but more important, this gives the option to have 100% certaincy in doing reproducible upgrades on internal development, test and production systems.

Apt-mirror

Apt-mirror is a useful tool for this. It will allow you to select which parts of the apt software archive an official mirror (eg. etch, etch-security, for only amd64 etc) you want to mirror. This is useful because it allows a finer degree of control compared with plain rsync.

apt-get install apt-mirror

Create an appropriate /etc/apt/mirror.list file. All repository lines which are normally in sources.list must be present in the file. And this has to be done for each separate architecture.

#set base_path      /var/spool/apt-mirror
set base_path      /export/www-root/repository-mirrors
#
# ## Mention: the base path and directories must be writable:
# set mirror_path  $base_path/mirror
# set skel_path    $base_path/skel
# set var_path     $base_path/var
#
# set cleanscript  $var_path/clean.sh
#
# set defaultarch amd64
#
set nthreads       2
set tilde          0
#
deb-i386     http://debian.slimdevices.com stable main
deb-amd64    http://debian.slimdevices.com stable main
deb-i386     http://debian.slimdevices.com testing main
#deb-amd64    http://debian.slimdevices.com testing main
#deb-i386     http://debian.slimdevices.com unstable main
#deb-amd64    http://debian.slimdevices.com unstable main
#
# set cleanscript $var_path/clean.sh
clean        http://debian.slimdevices.com

Create (or move) the three needed subdirectories: mirror, skel and var in the $base_path location (they are created in the application default location).

Showtime! Running the command below will start the mirroring process. It might be stopped during a run. When restarted, it will continue where is has ended. Remember, the ubuntu-7.10/debian-4.0 archive for only the i386 architecture is about 30GB big.

apt-mirror /etc/apt/mirror.list

Now link the directory in base_path to an apache (virtual)server and make the directory tree accessible with http. As a last step update /etc/apt/sources.list at all client machines.

Debmirror

Debmirror is another useful tool for this. It will allow you to select which parts of the apt software archive an official mirror (eg. etch, etch-security, for only amd64 etc) you want to mirror. This is useful because it allows a finer degree of control compared with plain rsync. See: https://help.ubuntu.com/community/Debmirror

Local Cache

Better use apt-proxy (or apt-cacher for a large set of machines) when saving bandwidth is the only thing needed.