16.9. Building a Complete Debian Mirror with apt-mirror
Problem
You want to provision your Debian hosts over the network from a local server, and you want a complete local mirror for this. How do you do this?
Solution
You need a Debian-based HTTP server to do this. There are two Debian applications for creating a local mirror: apt-mirror, which creates a complete mirror, and apt-proxy, which creates a partial mirror. In this recipe, we'll make a complete mirror with apt-mirror.
You will need anywhere from 40–120 GB of storage, according to which releases you want and how many CPU architectures. First, install apt-mirror in the usual Debian manner, plus Lighttpd:
# aptitude install apt-mirror lighttpdThen, edit /etc/apt/mirror.list to include your chosen repositories. You want to use Debian mirrors that are close to you, which you will find at the mirror list page (http://www.debian.org/mirror/list). They may not be geographically close, but you should run some ping and tcptraceroute tests to get an idea of which ones perform well. This example uses the mirror at http://linux.csua.berkeley.edu/debian:
## /etc/apt/mirror.list ############# config ################## # # set base_path /var/spool/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 nthreads 20 set tilde 0 # ############# end config ############## # debian Etch (stable) deb http://linux.csua.berkeley.edu/debian ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access