Mirroring Ubuntu (Edgy)
Thursday October 26, 2006 by Derek Young
We have a number of people at work running Ubuntu. I decided to make updates and installs much faster by creating a local mirror that we could all share.
Since Ubuntu is based on Debian, you mirror them the same way, using debmirror. debmirror is smart about incremental changes to the mirror, only bringing down changed packages.
To bring down a full mirror of edgy I first imported the public gpg key used to verify the packages:
gpg --keyserver subkeys.pgp.net --recv 437D05B5
Then to bring down the mirror of main, universe, multiverse, and restricted (i386 only, and no source packages):
debmirror ./repos --host=archive.ubuntulinux.org --root=ubuntu/ --nosource --passive --progress --method=ftp --section=main,universe,multiverse,restricted --arch=i386 --dist=edgy,edgy-backports,edgy-security,edgy-updates
Even with a good net connection this took about 12 hours. To give you an idea about the relative size of each of the sections:
| 3.7G | main |
| 737M | multiverse |
| 31M | restricted |
| 9.9G | universe |
Then on the mirror machine I set up apache to serve up the packages:
sudo apt-get install apache2 sudo emacs -nw /etc/apache2/sites-available/mirror
In the new file “mirror” I made an alias to support “http://bigu/mirror” and pointed it to my repos directory (which I put in the file system at /bigu/mirror/repos. bigu happens to be the name of the machine). I also turned on directory indexing for debugging:
/etc/apache2/sites-available/mirror:
Alias /mirror /bigu/mirror/repos
<Directory /bigu/mirror/repos>
Options +Indexes
</Directory>
Then enable the site:
sudo a2ensite mirror
sudo /etc/init.d/apache2 reload
I added the debmirror command to cron to run once a day in the middle of the night. (actually I wrapped the command to a script).
To point to the mirror, edit /etc/apt/sources.list on the machine you care want to use it. Comment out all lines that start with “deb http://” or “deb cdrom”. Leave the deb-src lines since the mirror doesn’t include the source packages. Add these lines to the bottom of the file (using the correct host name of your mirror):
deb http://bigu/mirror/ edgy main universe multiverse restricted
deb http://bigu/mirror/ edgy-backports main universe multiverse restricted
deb http://bigu/mirror/ edgy-security main universe multiverse restricted
deb http://bigu/mirror/ edgy-updates main universe multiverse restricted
Then sudo apt-get update on this machine (not the mirror machine). You should see it hitting the mirror.
Package updates on this machine should be lightning fast now!
To point a dapper machine to the mirror while upgrading, edit source.list and make the changes I listed above. Then change all references to dapper to edgy (search and replace). To run the update:
sudo apt-get update
sudo apt-get install dist-upgrade
(I’m not sure how to do the same thing through update-manager and still use the mirror. It’s probably possible.)

A simple Eclipse editor plug-in - just-one-space Toward a mouseless work environment

Hello Derek,
I really appreciate your article, but I must admit I’m having some troubles in making it download the indicated files. If I run the command you posted, then debmirror does only download all the Packages files, but no deb file. Is there maybe something more to know in order to make debmirror work the right way?
Best regards,
Daniel
— Daniel Rampanelli Feb 15, 05:37 AM #