Archives: October 2010

Release Party Ubuntu Mirror

Our Ubuntu LoCo release parties always end up being part-install-fest. Even when we used to meet at pubs in the early days, people would pull out laptops to burn ISOs for each other and get assistance with upgrades.

As the maintainer of a local university mirror, I took along a mini-mirror to our Lucid Release party and will be doing it for the Maverick party tomorrow. If anyone wants to do this at future events, it's really not that hard to organise, you just need the bandwidth to create the mirror. Disk space requirements (very rough, per architecture, per release): package mirror 50GiB, Ubuntu/Kubuntu CDs 5GiB, Xubuntu/Mythbuntu/UbuntuStudio CDs 5GiB, Ubuntu/Kubuntu/Edubuntu DVDs: 10GiB.

I took the full contents of our ubuntu-archive mirror, but you can probably get away with only i386 and amd64 for the new release people are installing and any old ones they might be upgrading from. You can easily create a partial (only selected architectures and releases) Ubuntu mirror using apt-mirror or debmirror. It takes a while on the first run, but once you have a mirror, updating it is quite efficient.

The CD and DVD repos can easily be mirrored with rsync. Something like --include '*10.04*'.iso' --exclude '*.iso' will give you a quick and dirty partial mirror.

As to the network. I took a 24port switch and a pile of flyleads. A laptop with 1TB external hard drive ran the mirror. At this point, you pick between providing Internet access as well (which may result in some poorly-configured machines upgrading over the Internet) or doing it all offline (which makes sense in bandwidth-starved South Africa). For lucid, I chose to run this on a private network - there was a separate WiFi network for Internet access. This slightly complicates upgrades because update-manager only shows the update button when it can connect to changelogs.ubuntu.com, but that's easily worked around:

cd /var/www
for file in meta-release meta-release-development meta-release-lts meta-release-lts-development meta-release-lts-proposed meta-release-proposed meta-release-unit-testing; do
    wget -nv -N "http://changelogs.ubuntu.com/$file"
done

Instead of getting people to reconfigure their APT sources (and having to modify those meta-release files), we set our DNS server (dnsmasq) to point all the mirrors that people might be using to itself. In /etc/hosts:

10.0.0.1        mirror za.archive.ubuntu.com archive.ubuntu.com security.ubuntu.com mirror.is.co.za ubuntu.saix.net ftp.leg.uct.ac.za ftp.sun.ac.za ubuntu.mirror.ac.za changelogs.ubuntu.com

Dnsmasq must be told to provide DHCP leases /etc/dnsmasq.conf: :

domain=ubuntu-za.lan
dhcp-range=10.0.0.2,10.0.0.255,12h
dhcp-authoritative

Then we ran an Apache (all on the default virtualhost) serving the Ubuntu archive mirror as /ubuntu, the meta-release files in the root, and CDs / DVDs in /ubuntu-releases, /ubuntu-cdimage. There were a couple of other useful extras thrown in.

We could have also run ftp and rsync servers, and provided a netboot environment. But there was a party to be had :)

For the maverick party, I used this script to prepare the mirror. It's obviously very specific to my local mirror. Tweak to taste:

#!/bin/bash
set -e
set -u

MIRROR=ftp.leg.uct.ac.za
MEDIA=/media/external/ubu

export GNUPGHOME="$MEDIA/gnupg"
gpg --no-default-keyring --keyring trustedkeys.gpg --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5 2EBC26B60C5A2783

debmirror --host $MIRROR --root ubuntu --method rsync \
    --rsync-options="-aIL --partial --no-motd" -p --i18n --getcontents \
    --section main,universe,multiverse,restricted \
    --dist $(echo {lucid,maverick}{,-security,-updates,-backports,-proposed} | tr ' ' ,) \
    --arch i386,amd64 \
    $MEDIA/ubuntu/

debmirror --host $MIRROR --root medibuntu --method rsync \
    --rsync-options="-aL --partial --no-motd" -p --i18n --getcontents \
    --section free,non-free \
    --dist lucid,maverick \
    --arch i386,amd64 \
    $MEDIA/medibuntu/

rsync -aHvP --no-motd --delete \
    rsync://$MIRROR/pub/packages/corefonts/ \
    $MEDIA/corefonts/

rsync -aHvP --no-motd --delete \
    rsync://$MIRROR/pub/linux/ubuntu-changelogs/ \
    $MEDIA/ubuntu-changelogs/

rsync -aHvP --no-motd \
    rsync://$MIRROR/pub/linux/ubuntu-releases/ \
    --include 'ubuntu-10.10*' --include 'ubuntu-10.04*' \
    --exclude '*.iso' --exclude '*.template' --exclude '*.jigdo' --exclude '*.list' --exclude '*.zsync' --exclude '*.img' --exclude '*.manifest' \
    $MEDIA/ubuntu-releases/

rsync -aHvP --no-motd \
    rsync://$MIRROR/pub/linux/ubuntu-dvd/ \
    --exclude 'gutsy' --exclude 'hardy' --exclude 'jaunty' --exclude 'karmic' \
    $MEDIA/ubuntu-cdimage/

We'll see how it works out tomorrow. Looking forward to a good party.