// ubuntu 24.04 更换为阿里云仓库源

    $ sudo cp /etc/apt/sources.list.d/ubuntu.sources  /etc/apt/sources.list.d/ubuntu.sources.bak
    
    $ cat  > /etc/apt/sources.list.d/ubuntu.sources <<EOF
    Types: deb deb-src
    URIs: https://mirrors.aliyun.com/ubuntu/
    Suites: noble noble-security noble-updates noble-proposed noble-backports
    Components: main restricted universe multiverse
    Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
    EOF
    
    $ sudo apt-get update
    • Types:指定存储库的格式。 deb 表示存储库包含已预编译并准备安装的二进制包。 deb-src 表示需要编译的源代码包。
    • URIs:统一资源标识符,指定 APT 系统获取包的位置。
    • Suites: 表示与 Ubuntu 发布周期的不同版本或阶段相一致的特定软件包集
    • Components:表示软件包的不同分类。
      • main:主要的、经过完全支持的软件包
      • restricted:有一定限制的软件包,一般包含 Ubuntu 支持的专有驱动程序和软件
      • universe:社区维护的软件包
      • multiverse:非自由软件包,也就是说可能不是免费或开源的
    • Signed-By: 指向包含用于验证包真实性的公钥的密钥环文件

    //查看其它仓库

    $ ls /etc/apt/sources.list.d
    docker-ce.list  ubuntu.sources
    $ cat /etc/apt/sources.list.d/docker-ce.list
    deb [arch=amd64 signed-by=/usr/share/keyrings/docker-ce-keyrings.gpg] https://mirrors.aliyun.com/docker-ce/linux/ubuntu noble stable

    ubuntu 已经有了 .sources 文件,为啥还有 .list 文件呢?

    • .list格式:这些文件格式简单,文件中的每一行都指定一个存储库。
    • .sources格式:引入它是为了提供一种更加结构化和通用的方式来定义存储库。这些文件可以包含附加元数据并支持单个文件中的多个存储库定义,这使得它们对于复杂配置特别有用。
    作者:jackzang  创建时间:2025-03-07 17:43
    最后编辑:jackzang  更新时间:2025-03-09 16:17