GNU/Linux Desktop Survival Guide by Graham Williams |
|||||
Maintaining a Distribution Archive |
Downloaded Debian packages are placed into /var/cache/apt/archive. You can have the files moved into a local hierarchy that mirrors a standard Debian distribution hierarchy. Then you can point the /etc/apt/sources.list to this local archive by using the file:// format.
To set up a local machine as a local (partial) mirror of the Debian archive, wajig will use the apt-move package.
Edit /etc/apt-move.conf to
set the DIST to match your system (default is stable):
DIST=unstable |
The wajig command move will then move any
packages in your /var/cache/apt/archives into the Debian
mirror being created (/mirrors/debian is created by default):
$ wajig move |
You can actually create a complete mirror with:
# apt-move mirror |
These commands place the packages into /mirrors/debian. To
make it available on your web server simply:
# cd /var/www # ln -s /mirrors pub |
The file /etc/apt/sources.list can then be updated to point
to the new archive as the first place to check for packages (place
this lines first in the file):
deb http://athens/pub/debian unstable main contrib non-free |
All of this might happen on your server (called athens in this example) and other machines on your local network can then access the local archive by adding the above line to /etc/apt/sources.list.
If your server is not the most up to date machine (since you may not
want to run the risk of your server becoming unstable), you can
rsync all packages in /var/cache/apt/archives on
other machines to the server and then run the move command on
the server:
# rsync -vr friend:/var/cache/apt/archives/ /var/cache/apt/archives/ # ssh friend wajig clean (apt-get clean) # wajig move (apt-move update) |
#!/usr/bin/env python import os hosts = ['friend', 'cargo'] archive = '/var/cache/apt/archives/' for h in hosts: os.system('rsync -vr %s:%s %s' % (h, archive, archive)) os.system('ssh %s wajig clean' % h) os.system('wajig move') |
# chmod u+x apt-archive.py |
# ./apt-archive.py |
Copyright © 1995-2006 [email protected]