debian软件源source.list文件格式说明

本文详细解析了debian操作系统中source.list文件的格式,包括deb和deb-src的区别、ftp镜像URL、debian版本号的含义以及软件包的分布。解释了如何按需修改source.list,避免源的混用问题,并介绍了更新软件包列表信息和升级debian的步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在安装完debian操作系统之后大家做的第一件事大概就是修改source.list文件了吧,否则你是无法在线更新软件的,那么source.list文件中的各个配置项的具体含义你搞懂了么?下面就以我的source.list文件为例为大家讲解一下。

deb http://mirrors.163.com/debian/ wheezy main non-free contrib
deb http://mirrors.163.com/debian/ wheezy-proposed-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ wheezy main non-free contrib
deb-src http://mirrors.163.com/debian/ wheezy-proposed-updates main non-free contrib

其中可以把每一行分为四个部分,说白了,当你在线更新某个软件时,debian就是遵照这四个选项(准确的说是后三项)的指示找到软件来给你安装的:

deb    ###   ftp地址                         ###  版本代号   ###  限定词
deb    ###   http://mirrors.163.com/debian/ ###  wheezy    ###   main non-free contrib

其中,

1. 第一部分

第一部分为deb或者deb-src,其中前者代表软件的位置,后者代表软件的源代码的位置

2. 第二部分

第二部分为你的ftp镜像的url,以我的为例,我是用的是大陆速度较快的网易镜像。在浏览器中打开此链接以后会发现有如下内容:

其中:

/dists/ 目录包含"发行版"(distributions), 此处是获得 Debian 发布版本(releases)和已发布版本(pre-releases)的软件包的正规途径. 有些旧软件包及 packages.gz 文件仍在里面.

/pool/ 目录为软件包的物理地址. 软件包均放进一个巨大的 "池子(pool)", 按照源码包名称分类存放. 为了方便管理, pool 目录下按属性再分类("main", "contrib" 和 "non-free"), 分类下面再按源码包名称的首字母归档. 这些目录包含的文件有: 运行于各种系统架构的二进制软件包, 生成这些二进制软件包的源码包.你可以执行命令 apt-cache showsrc mypackagename, 查看 'Directory:' 行获知

linux-debian软件安装包sources.list 路径 /etc/apt # deb cdrom:[Debian GNU/Linux 8.2.0 _Jessie_ - Official amd64 CD Binary-1 20150906-11:13]/ jessie main # deb cdrom:[Debian GNU/Linux 8.2.0 _Jessie_ - Official amd64 CD Binary-1 20150906-11:13]/ jessie main # deb http://ftp.debian.org/debian/ experimental main deb http://mirrors.ustc.edu.cn/debian/ jessie main contrib non-free deb-src http://mirrors.ustc.edu.cn/debian/ jessie main contrib non-free deb http://mirrors.ustc.edu.cn/debian/ jessie-proposed-updates main contrib non-free deb-src http://mirrors.ustc.edu.cn/debian/ jessie-proposed-updates main contrib non-free deb http://mirrors.ustc.edu.cn/debian/ jessie-updates main contrib non-free deb-src http://mirrors.ustc.edu.cn/debian/ jessie-updates main contrib non-free # deb http://mirrors.163.com/debian/ jessie main non-free contrib # deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib # deb http://mirrors.163.com/debian/ jessie-backports main non-free contrib # deb-src http://mirrors.163.com/debian/ jessie main non-free contrib # deb-src http://mirrors.163.com/debian/ jessie-updates main non-free contrib # deb-src http://mirrors.163.com/debian/ jessie-backports main non-free contrib # deb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib # deb-src http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib # deb http://cs3.swfu.edu.cn/debian/ jessie main contrib non-free # Line commented out by installer because it failed to verify: # deb http://security.debian.org/ jessie/updates main # Line commented out by installer because it failed to verify: # deb-src http://security.debian.org/ jessie/updates main # jessie-updates, previously known as 'volatile' # A network mirror was not selected during install. The following entries # are provided as examples, but you should amend them as appropriate # for your mirror of choice. # deb http://ftp.debian.org/debian/ jessie-updates main # deb-
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值