2011-12-15

Local APT mirror: WWW server setup

TRANSFERRED.

Finally, I think I have all the necessary files downloaded to my Debian "wheezy" box for a local APT mirror. The plan is to update the mirror every night. I used a fast 100/100Mbps Internet connection to do the initial download of the "i386" and "amd64" binary hierarchies for "wheezy" main, contrib and non-free, and moved the files to their final resting place using my laptop and an external hard drive. Downloading and moving all that data was a pain but hopefully it will be worth it.

If you haven't read it yet, Packt Publishing has an excellent blog entry by Christopher Edwards on setting up local APT mirror repositories: Create a Local Ubuntu Repository using Apt-Mirror and Apt-Cacher (it's nominally for Ubuntu but that hardly makes any difference in this case).

As the blog entry explains, you don't have to maintain a full mirror (or mirrors) - you can configure the machines in your network to use "APT Cacher" and keep only those files that you actually use. If I were doing this again, I'd go that route.

Now, the next thing to do is set up the Apache WWW server to serve the files. This is exceedingly easy:
# apt-get install apache2
By default, the files to be served are located in /var/www. So we make a symbolic link from our local APT mirror into /var/www:
# cd /var/www
# ln -si /var/spool/apt-mirror/mirror/ftp.us.debian.org/debian wheezy-i386
I called the link "wheezy-i386" just to remind myself what's in the repository.

Now, over on a "client" machine of our shiny new APT repository, we edit /etc/apt/sources.list so it has only the following line (for wheezy):
deb http://192.168.0.1/wheezy-i386/ wheezy main contrib non-free
(Of course, replace 192.168.0.1 with the IP address of the machine where your local APT repository resides.) The run "apt-get update" as root and fire away!

No comments:

Post a Comment