使用apt-mirror构建本地Debian镜像Version 1.0 本教程将为你演示怎么样使用apt-mirror这个工具为本地网络建立一个Debian/Ubuntu镜像。因为假如你要为本地多台Ubuntu或者Debian机器安装或者升级,先在本地网络上建好一个镜像是非常有必要的,因为这样将大大的节省你的网络带宽。 This tutorial shows how to create a Debian/Ubuntu mirror for your local network with the tool apt-mirror. Having a local Debian/Ubuntu mirror is good if you have to install multiple systems in your local network because then all needed packages can be downloaded over the fast LAN connection, thus saving your internet bandwidth. I want to say first that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!
1 Preliminary NoteYou can set up a Debian and Ubuntu mirror on both Debian and Ubuntu systems, i.e., a Debian system can be a Debian and a Ubuntu mirror, as well as a Ubuntu system can be a Ubuntu and a Debian mirror. Please note that you need a fast internet connection to download all the packages to your mirror as well as a lot of hard disk space. In my tests I mirrored the main, contrib, and non-free sections of Debian Sarge and the main, restricted, and universe sections of Ubuntu Edgy Eft which took about 25GB of hard disk space and about 6 hours of download time on a 16MBit DSL line. I will not mirror security updates in this tutorial - I think it's a good idea to always download security updates directly from the internet. That way you can be sure you get the latest ones. I've tested this on a Debian Sarge and a Ubuntu Edgy Eft system. If you use different Debian/Ubuntu versions, the procedure might differ a little bit. You should have already set up a basic Debian Sarge system (e.g. as outlined on pages one and two of http://www.howtoforge.com/perfect_setup_debian_sarge) or a basic Ubuntu Edgy Eft system (e.g. as outlined on pages one to three of http://www.howtoforge.com/perfect_setup_ubuntu_6.10). In this example my local mirror has the IP address 192.168.0.100.
2 Install apt-mirror2.1 Modify /etc/apt/sources.list (Debian Sarge only)If you are on Debian Sarge, you must modify /etc/apt/sources.list to install apt-mirror. I don't know if this is necessary on Debian Etch or Sid, please try it yourself. This step is not necessary for Ubuntu Edgy Eft. vi /etc/apt/sources.list Please add the following line to the file:
Then update the packages database: apt-get update
2.2 Install apt-mirrorThis step is for all systems (Debian and Ubuntu). To install apt-mirror, please run apt-get install apt-mirror
3 Install ApacheLater on, I want to access my new local Debian/Ubuntu mirror over http, therefore I install the Apache web server now: apt-get install apache2 The default document root is /var/www, I will create symlinks from that directory to the location of the Debian and Ubuntu repository later on.
4 Configure apt-mirrorapt-mirror's configuration file is /etc/apt/mirror.list. There should already be a default configuration in it; on Debian Sarge the file looks like this:
|