Creating a local ubuntu repository

Configuring a local Ubuntu dist Mirror

Installing apt-mirror

sudo apt-get install apt-mirror
sudo mkdir -p /mnt/mirrors/apt-mirror/mirror /mnt/mirrors/apt-mirror/skel /mnt/mirrors/apt-mirror/var

Configuring apt-mirror

Update the storage directory, the number of threads and update to use the UK Ubuntu mirror.

sudo vi /etc/apt/mirror.list
set base_path    /mnt/mirrors/apt-mirror
...
set nthreads     5
...
:%s/archive.ubuntu.com/gb.archive.ubuntu.com/g

Starting the mirroring

apt-mirror

/etc/apt/mirror.list

############# config ##################
#
set base_path    /mnt/mirrors/apt-mirror
#
# 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  
# set postmirror_script $var_path/postmirror.sh
# set run_postmirror 0
set nthreads     5
set _tilde 0
#
############# end config ##############
deb-amd64 http://gb.archive.ubuntu.com/ubuntu maverick main restricted universe multiverse
deb-amd64 http://gb.archive.ubuntu.com/ubuntu maverick-security main restricted universe multiverse
deb-amd64 http://gb.archive.ubuntu.com/ubuntu maverick-updates main restricted universe multiverse
deb-i386 http://gb.archive.ubuntu.com/ubuntu maverick main restricted universe multiverse
deb-i386 http://gb.archive.ubuntu.com/ubuntu maverick-security main restricted universe multiverse
deb-i386 http://gb.archive.ubuntu.com/ubuntu maverick-updates main restricted universe multiverse
deb-src http://gb.archive.ubuntu.com/ubuntu maverick main restricted universe multiverse
deb-src http://gb.archive.ubuntu.com/ubuntu maverick-security main restricted universe multiverse
deb-src http://gb.archive.ubuntu.com/ubuntu maverick-updates main restricted universe multiverse
deb-amd64 http://gb.archive.ubuntu.com/ubuntu natty main restricted universe multiverse
deb-amd64 http://gb.archive.ubuntu.com/ubuntu natty-security main restricted universe multiverse
deb-amd64 http://gb.archive.ubuntu.com/ubuntu natty-updates main restricted universe multiverse
deb http://gb.archive.ubuntu.com/ubuntu natty main restricted universe multiverse
deb http://gb.archive.ubuntu.com/ubuntu natty-security main restricted universe multiverse
deb http://gb.archive.ubuntu.com/ubuntu natty-updates main restricted universe multiverse
deb-i386 http://gb.archive.ubuntu.com/ubuntu natty main restricted universe multiverse
deb-i386 http://gb.archive.ubuntu.com/ubuntu natty-security main restricted universe multiverse
deb-i386 http://gb.archive.ubuntu.com/ubuntu natty-updates main restricted universe multiverse
deb-src http://gb.archive.ubuntu.com/ubuntu natty main restricted universe multiverse
deb-src http://gb.archive.ubuntu.com/ubuntu natty-security main restricted universe multiverse
deb-src http://gb.archive.ubuntu.com/ubuntu natty-updates main restricted universe multiverse
deb-amd64 http://gb.archive.ubuntu.com/ubuntu oneiric main restricted universe multiverse
deb-amd64 http://gb.archive.ubuntu.com/ubuntu oneiric-security main restricted universe multiverse
deb-amd64 http://gb.archive.ubuntu.com/ubuntu oneiric-updates main restricted universe multiverse
deb-i386 http://gb.archive.ubuntu.com/ubuntu oneiric main restricted universe multiverse
deb-i386 http://gb.archive.ubuntu.com/ubuntu oneiric-security main restricted universe multiverse
deb-i386 http://gb.archive.ubuntu.com/ubuntu oneiric-updates main restricted universe multiverse
deb-src http://gb.archive.ubuntu.com/ubuntu oneiric main restricted universe multiverse
deb-src http://gb.archive.ubuntu.com/ubuntu oneiric-security main restricted universe multiverse
deb-src http://gb.archive.ubuntu.com/ubuntu oneiric-updates main restricted universe multiverse
deb-amd64 http://gb.archive.ubuntu.com/ubuntu precise main restricted universe multiverse
deb-amd64 http://gb.archive.ubuntu.com/ubuntu precise-security main restricted universe multiverse
deb-amd64 http://gb.archive.ubuntu.com/ubuntu precise-updates main restricted universe multiverse
deb-i386 http://gb.archive.ubuntu.com/ubuntu precise main restricted universe multiverse
deb-i386 http://gb.archive.ubuntu.com/ubuntu precise-security main restricted universe multiverse
deb-i386 http://gb.archive.ubuntu.com/ubuntu precise-updates main restricted universe multiverse
deb-src http://gb.archive.ubuntu.com/ubuntu precise main restricted universe multiverse
deb-src http://gb.archive.ubuntu.com/ubuntu precise-security main restricted universe multiverse
deb-src http://gb.archive.ubuntu.com/ubuntu precise-updates main restricted universe multiverse
clean http://gb.archive.ubuntu.com/ubuntu

/etc/apt/sources.list

deb http://homer.internal:8000/ubuntu/ maverick main restricted universe multiverse
deb-src http://homer.internal:8000/ubuntu/ maverick main restricted universe multiverse
deb http://homer.internal:8000/ubuntu/ maverick-updates main restricted universe multiverse
deb-src http://homer.internal:8000/ubuntu/ maverick-updates main restricted universe multiverse
deb http://homer.internal:8000/ubuntu/ maverick-security main restricted universe multiverse
deb-src http://homer.internal:8000/ubuntu/ maverick-security main restricted universe multiverse

References

Creating an Ubuntu repository mirror with apt-mirror
Ubuntu Forums