跳转至

Ubuntu Ports

地址

https://mirrors.ustc.edu.cn/ubuntu-ports/

说明

Ubuntu 软件源

收录架构

arm64, armhf, PowerPC, ppc64el, s390x

收录版本

所有 Ubuntu 当前对该架构支持的版本,包括开发版

对于 Ubuntu 不再支持的版本,请参考 ubuntu-old-releases

使用说明

手动更改配置文件

Warning

操作前请做好相应备份

/etc/apt/sources.list/etc/apt/sources.list.d/ubuntu.sources 文件中,将软件源的地址改为 http://mirrors.ustc.edu.cn/ubuntu-ports

什么是 DEB822 (.sources) 文件格式?

自新版本的 Debian 与 Ubuntu 起,例如:

  • Debian 12 的容器镜像
  • Ubuntu 24.04

默认预装的系统中 APT 的系统源配置文件不再是传统的 /etc/apt/sources.list。传统格式(又被称为 One-Line-Style 格式)类似如下:

deb http://mirrors.ustc.edu.cn/debian/ bookworm main contrib

新的 DEB822 格式自 APT 1.1(2015 年发布)起支持,后缀为 .sources,存储在 /etc/apt/sources.list.d/ 目录下,格式类似如下:

Types: deb
URIs: https://mirrors.ustc.edu.cn/debian
Suites: bookworm
Components: main contrib

在切换软件源时,需要根据实际情况选择对应的格式进行修改

关于 DEB822 格式的设计考虑,可以参考官方文档(英文)。

可以使用如下命令:

安全更新源注意事项

因镜像站同步有延迟,可能会导致生产环境系统不能及时检查、安装上最新的安全更新,不建议替换 security 源。 但是由于 Ubuntu Ports 中软件与安全更新源地址相同,因此以下提供的例子中均一并替换。

  • 传统格式(/etc/apt/sources.list

    sudo sed -i 's@//ports.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list
    
  • DEB822 格式(/etc/apt/sources.list.d/ubuntu.sources

    sudo sed -i 's@//ports.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list.d/ubuntu.sources
    

以下是参考配置内容,同时修改了软件源与安全更新源

/etc/apt/sources.list
# 默认注释了源码仓库,如有需要可自行取消注释
deb https://mirrors.ustc.edu.cn/ubuntu-ports/ jammy main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ jammy main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu-ports/ jammy-security main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ jammy-security main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu-ports/ jammy-updates main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ jammy-updates main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu-ports/ jammy-backports main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ jammy-backports main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.ustc.edu.cn/ubuntu-ports/ jammy-proposed main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ jammy-proposed main restricted universe multiverse
/etc/apt/sources.list.d/ubuntu.sources
Types: deb
URIs: https://mirrors.ustc.edu.cn/ubuntu-ports
Suites: jammy jammy-updates jammy-backports
Components: main restricted universe multiverse

Types: deb
URIs: https://mirrors.ustc.edu.cn/ubuntu-ports
Suites: jammy-security
Components: main universe restricted multiverse

如果需要使用源码仓库,可以在 Types 中添加 deb-src

如果需要使用预发布软件源,可以在 Suites 中添加 jammy-proposed

/etc/apt/sources.list
# 默认注释了源码仓库,如有需要可自行取消注释
deb https://mirrors.ustc.edu.cn/ubuntu-ports/ focal main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ focal main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu-ports/ focal-security main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ focal-security main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu-ports/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ focal-updates main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu-ports/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ focal-backports main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.ustc.edu.cn/ubuntu-ports/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ focal-proposed main restricted universe multiverse
/etc/apt/sources.list.d/ubuntu.sources
Types: deb
URIs: https://mirrors.ustc.edu.cn/ubuntu-ports
Suites: focal focal-updates focal-backports
Components: main restricted universe multiverse

Types: deb
URIs: https://mirrors.ustc.edu.cn/ubuntu-ports
Suites: focal-security
Components: main universe restricted multiverse

如果需要使用源码仓库,可以在 Types 中添加 deb-src

如果需要使用预发布软件源,可以在 Suites 中添加 focal-proposed

/etc/apt/sources.list
# 默认注释了源码仓库,如有需要可自行取消注释
deb https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-proposed main restricted universe multiverse
/etc/apt/sources.list.d/ubuntu.sources
Types: deb
URIs: https://mirrors.ustc.edu.cn/ubuntu-ports
Suites: bionic bionic-updates bionic-backports
Components: main restricted universe multiverse

Types: deb
URIs: https://mirrors.ustc.edu.cn/ubuntu-ports
Suites: bionic-security
Components: main universe restricted multiverse

如果需要使用源码仓库,可以在 Types 中添加 deb-src

如果需要使用预发布软件源,可以在 Suites 中添加 bionic-proposed

/etc/apt/sources.list
# 默认注释了源码仓库,如有需要可自行取消注释
deb https://mirrors.ustc.edu.cn/ubuntu-ports/ xenial main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ xenial main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-security main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-updates main restricted universe multiverse

deb https://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-backports main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-proposed main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-proposed main restricted universe multiverse
/etc/apt/sources.list.d/ubuntu.sources
Types: deb
URIs: https://mirrors.ustc.edu.cn/ubuntu-ports
Suites: xenial xenial-updates xenial-backports
Components: main restricted universe multiverse

Types: deb
URIs: https://mirrors.ustc.edu.cn/ubuntu-ports
Suites: xenial-security
Components: main universe restricted multiverse

如果需要使用源码仓库,可以在 Types 中添加 deb-src

如果需要使用预发布软件源,可以在 Suites 中添加 xenial-proposed

更改后请运行 sudo apt-get update 更新索引以生效。

Tip

使用 HTTPS 可以有效避免国内运营商的缓存劫持,但需要事先安装 apt-transport-https

镜像下载

相关架构的 ISO 下载请参考 ubuntu-cdimage

相关链接

Ubuntu ARM

https://wiki.ubuntu.com/ARM

Ubuntu PowerPC

https://wiki.ubuntu.com/PowerPC

Ubuntu ppc64el

https://wiki.ubuntu.com/ppc64el

Ubuntu s390x

https://wiki.ubuntu.com/S390X