Ubuntu下用多个Sources.list文件加速APT

来源:岁月联盟 编辑:zhuzhu 时间:2007-08-22
Ubuntu下用多个Sources.list文件加速APT内容简介:当多个源上都有同一个包时,只会从第一个源下载,因此应该将速度最快的源列在前头。 版本较新的apt都支持sources.list.d/目录形式的源列表,可以更方便地安排源条目例如: $ cd /etc/apt/sources.list.d/$ ls

当多个源上都有同一个包时,只会从第一个源下载,因此应该将速度最快的源列在前头。

 

版本较新的apt都支持sources.list.d/目录形式的源列表,可以更方便地安排源条目例如:

 

 

$ cd /etc/apt/sources.list.d/$ ls00.list                 debian.ustc.edu.cn -> local50.list                 debian.ustc.edu.cn_src -> mirrors.geekbone.org$ ll *.listlrwxrwxrwx 1 root root 5 2006-10-28 14:23 00.list -> locallrwxrwxrwx 1 root root 18 2006-10-28 14:19 50.list -> debian.ustc.edu.cn$ cat localdeb file:/home/user debs/$ cat debian.ustc.edu.cndeb http://debian.ustc.edu.cn/debian sid main contrib non-freedeb http://debian.ustc.edu.cn/debian-multimedia unstable maindeb http://debian.ustc.edu.cn/debian-uo sid marillat misc ustcdeb http://debian.ustc.edu.cn/debian-uo sid marillat misc ustcdeb http://debian.ustc.edu.cn/rarewares.org sid main$ cat debian.ustc.edu.cn_srcdeb-src http://debian.ustc.edu.cn/debian sid main contrib non-free$ cat mirrors.geekbone.orgdeb http://mirrors.geekbone.org/debian sid main contrib non-free

 

这么安排的好处是,apt系统只认*.list文件为可用的源列表,并按文件名顺序排列条目,需要增加源、剔除源或调整源优先级时,只需操作这些[0-9][0-9].list符号链接即可,而无须触动实际的列表文件。