Debian、Ubuntu 源列表说明(2015-08-26 更新)

新手涉及到的教学或入门贴,推荐新手必看,版主维护
头像
自由建客
帖子: 13468
注册时间: 2008-07-30 23:21
系统: Debian stable AMD64

Debian、Ubuntu 源列表说明(2015-08-26 更新)

#1

帖子 自由建客 » 2012-03-07 19:45

概貌:
源列表主文件 /etc/apt/sources.list,兼取 /etc/apt/sources.list.d/*,结果以并集论。
源列表文件以为单位,每行分多个字段,字段间以空白符分隔。井号(#)开头为注释行。


字段说明:

第一字段,指示包类型。
取值仅「deb」「deb-src」两个,分别对应二进制包和源码包。通常仅二进制包有用。

第二字段,指示镜像站点,即「源」!
URL 定位到某个目录,该目录下必有「dists」「pool」两个子目录。如:http://ftp.cn.debian.org/debian/http://ftp.sjtu.edu.cn/ubuntu/

第三字段,指示包的「版本类型」,姑且称为「仓库」。
打开某源,进入「dists」子目录可见该源中有哪些仓库,即其下诸子目录。
命名形式为「系统发行版名-仓库名」,如 Debian 的「jessie-backports」「stretch-updates」,Ubuntu 的「vivid-updates」「wily-proposed」。无仓库名的即为主仓库。
Debian 的 stable、testing 为链接,指向具体系统发行版,会随时间而变。比如,当前 stable 为 jessie,所以 stable-backports 与 jessie-backports 等效。但本人不建义使用 stable、testing,因为下一个 stable 发布后,你的源便自动指向了一个新版本,然而你并未阅读新版本的发行说明,并未做好升级的准备。
Debian 的仓库自 squeeze 起与 Ubuntu 基本相同。除主仓库外,有:
「security」,Ubuntu 用于指安全性更新。即影响系统安全的 bug 修补。Debian 特殊一些,见下文。
「updates」,非安全性更新。即不影响到系统安全的 bug 修补。
「proposed-updates」,预更新。小 beta 版。过后会进入「updates」或「security」。Ubuntu 仅用「proposed」,无后缀「updates」。
「backports」,后备。Debian stable 发布后,Ubuntu 某版本正式发布后,其所有软件版本号便已被冻结,所有软件只修 bug,不增加任何特性。但有人可能需要新特性,甚至某些较新的软件原来根本就没有。该仓库正因此而设,但欠官方维护,且可能在系统正式发布之后过一段时间才有内容。此仓库处于第二优先顺序,而上述几个仓库处于第一优先顺序。安装第二优先顺序的包必须特别指明,见 apt-get(8) aptitude(8) 的 --target-release 选项。
提示:并非所有版本都设有上述全部仓库,请打开源中 dists 目录查看。

后续字段,指示包许可类型。
后续字段排名不分先后,最终结果取其并集。
按包本身的许可及所直接依赖的包的许可划分。打开某仓库,可见几个子目录。
Debian 最多有三种
「main」,本身是自由软件,且所有依赖的包也都是自由软件,此类可称纯自由软件,见 https://www.debian.org/distrib/packages《Debian自由软件指导方针》。
「contrib」,本身是自由软件,但依赖不纯,即依赖中至少有一例 contrib 或 non-free 者。
「non-free」,本身并非自由软件,无论依赖如何。当然,该软件是可免费使用或试用的。免费一例 https://packages.debian.org/jessie/unrar,试用xx天一例 https://packages.debian.org/jessie/rar
Ubuntu 最多有四种
「main」,官方维护的自由软件。
「universe」,社区维护的自由软件。
「restricted」,设备专有驱动。
「multiverse」,同 Debian 的「non-free」。
某些另类的第三方源,未必遵循上述惯例。总之,打开仓库目录自己看。


特别之处:

Debian 安全性更新
不像 Ubuntu 放在「security」仓库,而是放在单独一个源中。各大镜像站通常都把一般的包放在根下来一级的「debian」目录中,而安全性更新则会放在「debian-security」目录中,如果有的话,如 http://ftp.cn.debian.org/debian-security/
Debian 官方建议,所有安全性更新,只从官方主站更新,勿使用其它镜像站,除非你对镜像站非常有信心,见 https://www.debian.org/security/index.en.html。所以,很多镜像站并不提供安全更新源。
安全性更新的第三字段形式固定为「版本名/updates」,如「wheezy/updates」「jessie/updates」。

Debian 多媒体源
一些多媒体软件因牵涉到版权问题,包括硬件解码器,Debian 官方并未收录,有一网站专门填补该空缺,见 http://www.deb-multimedia.org


最后忠告:
不要同时启用多个源,同一仓库的源启用一个即可,否则容易引起混乱。以下实例便是列有多套而仅启用一套。

实例:
Debian 8 jessie

代码: 全选

deb http://ftp.tw.debian.org/debian/ jessie main contrib non-free
deb http://ftp.tw.debian.org/debian/ jessie-updates main contrib non-free
deb http://ftp.tw.debian.org/debian/ jessie-backports main contrib non-free
deb http://security.debian.org/ jessie/updates main contrib non-free
deb http://ftp.yzu.edu.tw/Linux/debian-multimedia/ jessie main non-free

#deb http://ftp.cn.debian.org/debian/ jessie main contrib non-free
#deb http://ftp.cn.debian.org/debian/ jessie-updates main contrib non-free
#deb http://ftp.cn.debian.org/debian/ jessie-backports main contrib non-free
#deb http://ftp.cn.debian.org/debian-security/ jessie/updates main contrib non-free
#deb http://ftp.cn.debian.org/debian-multimedia/ jessie main non-free

#deb http://ftp.sjtu.edu.cn/debian/ jessie main contrib non-free
#deb http://ftp.sjtu.edu.cn/debian/ jessie-updates main contrib non-free
#deb http://ftp.sjtu.edu.cn/debian/ jessie-backports main contrib non-free
#deb http://ftp.sjtu.edu.cn/debian-security/ jessie/updates main contrib non-free
#deb http://ftp.cn.debian.org/debian-multimedia/ jessie main non-free

#deb http://ftp.debian.org/debian/ jessie main contrib non-free
#deb http://ftp.debian.org/debian/ jessie-updates main contrib non-free
#deb http://ftp.debian.org/debian/ jessie-backports main contrib non-free
#deb http://security.debian.org/ jessie/updates main contrib non-free
#deb http://www.deb-multimedia.org/ jessie main non-free
Ubuntu 15.04 vivid

代码: 全选

deb http://mirrors.163.com/ubuntu/ vivid main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ vivid-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ vivid-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ vivid-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ vivid-backports main restricted universe multiverse

#deb http://mirrors.sohu.com/ubuntu/ vivid main restricted universe multiverse
#deb http://mirrors.sohu.com/ubuntu/ vivid-security main restricted universe multiverse
#deb http://mirrors.sohu.com/ubuntu/ vivid-updates main restricted universe multiverse
#deb http://mirrors.sohu.com/ubuntu/ vivid-proposed main restricted universe multiverse
#deb http://mirrors.sohu.com/ubuntu/ vivid-backports main restricted universe multiverse

#deb http://mirrors.aliyun.com/ubuntu/ vivid main restricted universe multiverse
#deb http://mirrors.aliyun.com/ubuntu/ vivid-security main restricted universe multiverse
#deb http://mirrors.aliyun.com/ubuntu/ vivid-updates main restricted universe multiverse
#deb http://mirrors.aliyun.com/ubuntu/ vivid-proposed main restricted universe multiverse
#deb http://mirrors.aliyun.com/ubuntu/ vivid-backports main restricted universe multiverse

#deb http://archive.ubuntu.com/ubuntu/ vivid main restricted universe multiverse
#deb http://archive.ubuntu.com/ubuntu/ vivid-security main restricted universe multiverse
#deb http://archive.ubuntu.com/ubuntu/ vivid-updates main restricted universe multiverse
#deb http://archive.ubuntu.com/ubuntu/ vivid-proposed main restricted universe multiverse
#deb http://archive.ubuntu.com/ubuntu/ vivid-backports main restricted universe multiverse
上次由 自由建客 在 2012-05-10 8:23,总共编辑 3 次。
头像
qy117121
论坛版主
帖子: 50546
注册时间: 2007-12-14 13:40
系统: Winbuntu
来自: 志虚国乌由市
联系:

Re: Debian 源列表说明(第二版)(2012-03-07 首发)

#2

帖子 qy117121 » 2012-03-07 19:46

学习了,还是用ubuntu
渠月 · QY   
本人只会灌水,不负责回答问题
无聊可以点一下→ http://u.nu/ubuntu

Ubuntu 20.04 快速设置指南,请配合浏浏览器自动翻译使用

邮箱 chuan@ubuntu.org.cn
头像
lovebluesky
帖子: 487
注册时间: 2010-02-03 17:09

Re: Debian 源列表说明(第二版)(2012-03-07 首发)

#3

帖子 lovebluesky » 2012-03-07 20:36

mark,喜欢debian,学习了
openSUSE+xfce 13年初开始用,可能要成为我用的最久的linux系统了
之所以xfce的官方理由是他轻便简洁
非官方理由是穷,没钱换高配电脑
继续为了买了mac但任性的换装openSUSE而奋斗!
头像
ever_fly
帖子: 10
注册时间: 2012-03-11 18:08

Re: Debian 源列表说明(第二版)(2012-03-07 首发)

#5

帖子 ever_fly » 2012-03-14 13:56

我不知道为什么我会出这样的错误,为什么dns默认把地址解析成ipv6的地址了?我查过hosts,没有debian的条目。我想问下你们访问http://ftp.cn.debian.org/是ipv6的地址吗?

代码: 全选

W: 无法下载 http://ftp.cn.debian.org/debian/dists/squeeze/updates/main/binary-i386/Packages.gz  404  Not Found [IP: 2001:da8:d800:95::110 80]

W: 无法下载 http://ftp.cn.debian.org/debian/dists/squeeze/updates/contrib/binary-i386/Packages.gz  404  Not Found [IP: 2001:da8:d800:95::110 80]

W: 无法下载 http://ftp.cn.debian.org/debian/dists/squeeze/updates/non-free/binary-i386/Packages.gz  404  Not Found [IP: 2001:da8:d800:95::110 80]

E: 有一些索引文件不能下载,它们可能被忽略了,也可能转而使用了旧的索引文件。
Guide me, in the dark.
头像
nmsfan
帖子: 18958
注册时间: 2009-10-16 22:46
来自: finland

Re: Debian 源列表说明(第二版)(2012-03-07 首发)

#6