use*_*798 9 repository rsync mirrors apt-mirror
拥有本地存储库可能非常有用。可以用于rsync创建存储库镜像,但这会导致下载所有版本,甚至是较旧的版本,并且会包含可能不需要的体系结构文件。
apt-mirror允许有选择地选择存储库的部分。mirrorkit提供 apt-mirror 的前端。
为 Ubuntu 档案的选定部分创建本地存储库镜像的最佳方法是什么?
例如,人们可能希望包括:
Main、Restricted、Universe、Multiverse、All Ubuntu 和 Lubuntu,但不包括其他衍生产品,例如 Kubuntu 和 Xubuntu。
只有 AMD64 和 i386 但不包括其他架构。
只有 Trusty Tahr,但不是 Precise Penguin 或 Utopic Unicorn。
人们可能希望配置该过程,使其从本地镜像下载,而不是从主存档下载。
如何创建使用本地存储库apt-mirror,并mirrorkit为选定的架构,释放,或Ubuntu变种?
CD 存储库和软件存储库是两个不同的组件(它们甚至有单独的 Launchpad 页面:cdmirrors和archivemirrors)。因此,镜像它们是两个不同的任务。此外,虽然各种风格在 CD 存储库上具有不同的文件夹,但它们共享一个软件存储库。因此,您可以有选择地镜像每种口味的图像,而不是软件。对于软件仓库,您可以根据以下内容有选择地进行镜像:
trusty,precise等)amd64,i386等)deb] 与源 [ deb-src])trusty,trusty-updates,trusty-backports等)main,multiverse等)要镜像软件存储库,请使用apt-mirror.
apt-mirror使用/etc/apt/mirror.list. 它的格式非常类似于sources.list. 包安装的配置文件有一些注释掉的选项,列出了它们的默认值。如果您愿意,可以取消注释并更改它们。
要镜像存储库,您需要mirror.list像您一样添加一行sources.list:
deb http://us.archive.ubuntu.com/ubuntu trusty main multiverse restricted universe
Run Code Online (Sandbox Code Playgroud)
默认是只镜像主机的架构,所以如果你在 64 位 Ubuntu 上,只会amd64被镜像。您需要添加另一行表单:
deb-i386 http://us.archive.ubuntu.com/ubuntu trusty main multiverse restricted universe
Run Code Online (Sandbox Code Playgroud)
对于源包:
deb-src http://us.archive.ubuntu.com/ubuntu trusty main multiverse restricted universe
Run Code Online (Sandbox Code Playgroud)
如果您正在寻找一个相当完整的镜像,这些行将是最少的(我也建议使用-updates频道):
deb http://us.archive.ubuntu.com/ubuntu trusty main multiverse restricted universe
deb http://us.archive.ubuntu.com/ubuntu trusty-security main multiverse restricted universe
deb-i386 http://us.archive.ubuntu.com/ubuntu trusty main multiverse restricted universe
deb-i386 http://us.archive.ubuntu.com/ubuntu trusty-security main multiverse restricted universe
Run Code Online (Sandbox Code Playgroud)
最后,您需要添加clean一行,以便过滤存储库中不再可用的包以进行删除:
clean http://us.archive.ubuntu.com/ubuntu
Run Code Online (Sandbox Code Playgroud)
假设您的变量是(默认值):
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
Run Code Online (Sandbox Code Playgroud)
然后:
$mirror_path/parent-hostname/directory(so /var/spool/apt-mirror/mirror/us.archive.ubuntu.com/ubuntu)clean.sh(这将是一组rm命令来删除过时的包和目录)会/var/spool/apt-mirror/var/clean.sh。/var/spool/apt-mirror/var.该apt-mirror软件包安装了一个 cron 作业 ( /etc/cron.d/apt-mirror),您应该编辑它以启用它(通过取消注释包含 的行/usr/bin/apt-mirror)。您还应该添加一个用于运行的 cron 作业clean.sh(我每周运行一次)。
当然,您应该更换http://us.archive.ubuntu.com./ubuntu为您喜欢的任何镜像。
| 归档时间: |
|
| 查看次数: |
13613 次 |
| 最近记录: |