前言
由于种种原因,例如下载速度慢、找不到所需应用等,我们经常需要修改debian系统的软件源文件/etc/apt/sources.list,之前一直是直接在网上搜索别人现有的源内容,然后复制粘贴过去···今天,我们来看看这个sources.list究竟是啥子一个格式来的。先通过一个示例文件,分析sources.list各个行的格式,然后依葫芦画瓢,我们尝试编写适合ubuntu18.04的sources.list。
sources.list的格式 探究
输入
cat /etc/apt/sources.list
可以看到类似如下的内容:
deb http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ trusty universe
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty universe
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe
···
除了注释##外,核心的语句其实就是两类:
deb http://us.archive.ubuntu.com/ubuntu/ trusty universe
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty unniverse
其中deb和deb-src的区别在于:
The lines starting with "deb" are binary pack