Ubuntu 的源相关介绍(最近在配gstreamer的时候,紧急补充的知识)


PS:要转载请注明出处,本人版权所有。

PS: 这个只是基于《我自己》的理解,
如果和你的原则及想法相冲突,请谅解,勿喷。

环境说明

  System:Linux tegra-ubuntu 4.4.38-tegra #1 SMP PREEMPT Fri Jul 28 09:55:22 PDT 2017 aarch64 aarch64 aarch64 GNU/Linux

前言


  无





什么是源


  源是一个在网络上的软件仓库,这里面存放着各种各样的软件安装包。在我们使用Linux系统的过程中,往往需要安装一些自己需要的软件,这些软件大部分由相关人员打包好了,存放到软件仓库中。在我们个人的Linux系统上,有着一种工具叫做包管理器,专门用来下载和安装我们需要的软件,并且提供自动补全依赖功能。列如:apt,yum,dnf,dpkg。

  下面以debian系的Ubuntu为例,对源和这些工具的关系做一个简单介绍。





客户端—源


  在ubuntu上,在/etc/apt/sources.list目录中,存放了关于源的网络地址和软件仓库名。列如:

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.

deb http://ports.ubuntu.com/ubuntu-ports/ xenial main

deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main
#deb http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted
#deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted

## Uncomment the following two lines to add software from the 'universe'
## repository.
## 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://ports.ubuntu.com/ubuntu-ports/ xenial main universe
 deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main universe
# deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates universe
# deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates universe

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted
# deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-backports main restricted

deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted
# deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security universe
# deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security universe
# deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security multiverse
# deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security multiverse

  首先,debian系的软件包的格式为deb格式。这里的deb deb-src分别代表deb包和deb包对应的源码的地址和仓库。



deb和deb-src格式介绍(具体可参考ubuntu官方文档):
  1. http://xxxx为对应的网络地址

  2. xenial 对应的是ubuntu的系统版本代号,这里为16.04

  3. security,backports,updates,preposed 对应的是ubuntu大的系统版本号中的小版本,我们基本只会用到前面两个。相关介绍:它们分别对应的是安全更新(影响系统性能),后备更新(在ubuntu大版本冻结时,所有对应软件的功能也定型了,后续只会修复bug,哪怕相关软件更新了功能,但是此版本ubuntu不提供新功能,这个小版本就是提供这些软件的新版本的),普通更新(不影响系统性能),预备更新(说白了就是security,updates的beta测试版本,验证稳定后,进入security,updates)。

  4. main,universe,restricted,multiverse 版权限定。他们分别是官方维护的自由软件,社区维护的自由软件,设备驱动,非自由软件,但是可免费使用。

  总的格式为:

  • deb 网络地址 系统代号(大版本)-小版本 版权限定

  • deb-src 网络地址 系统代号(大版本)-小版本 版权限定





客户端—源


  打开一个ubuntu的源,可能如下图:

rep_img

  这里有两个文件夹是我们经常用到的,一个是dists,一个是pool,其他的文件及文件夹一般人不会用到。



dists文件夹:

  分版本,版本限定以及架构存放的软件包的信息,例如下面的这些图:

rep_img

  这里的压缩包里面存放的就是这个仓库的软件信息,有需求可以下载下来分析,里面包含很多有用的信息。(其实我们apt update下载下来的东西就是这个)



pool文件夹:

  里面是所有的包存放的物理地址,这些物理地址的引索在dists文件夹中的压缩包中有。所以直接可以apt install 下载下来,通过dpkg安装。

  pool里面的包也是按照包首字母和版权限定存放的。

  列如包:gstreamer1.0-plugins-ugly

  在ubuntu的软件包搜索中,查找gstreamer1.0-plugins-ugly,找到后,切换到下载页面,可见gstreamer1.0-plugins-ugly的实际下载路径,如下图,意思是在某源的pool/universe/g/gst-plugins-ugly1.0/ 目录下,如图:

rep_img
rep_img

  这样我就找到了这个包

注意:如果通过apt 无法安装某些软件,并且你在ubuntu软件包中搜索到了,请打开对应的限定源并更新即可下载。
服务端—源 常见的有几种
  1. ubuntu 官方源

  2. ppa(Personal Package Archives)





后记


  无

参考文献




打赏、订阅、收藏、丢香蕉、硬币,请关注公众号(攻城狮的搬砖之路)
qrc_img

PS: 请尊重原创,不喜勿喷。

PS: 要转载请注明出处,本人版权所有。

PS: 有问题请留言,看到后我会第一时间回复。


文章作者: Sky
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 Sky !
  目录