Ubuntu 24.04下载源更新

[背景]

        在树莓派上安装了Ubuntu24.04, 但是下载源默认是ubuntu官方的源,所以想替换成国内的下载源。但是在修改的过程,发现Ubuntu24.04让使用DEB822的格式配置下载源文件。

[替换过程]

        这里以替换aliyun的源为例,对应arm平台的地址:ubuntu镜像_ubuntu下载地址_ubuntu安装教程-阿里巴巴开源镜像站阿里巴巴开源镜像站为您提供免费的ubuntu下载地址及ubuntu安装教程,ubuntu镜像简介:Ubuntu,是一款基于 Debian Linux 的以桌面应用为主的操作系统,内容涵盖文字处理、电子邮件、软件开发工具和 Web 服务等,可供用户免费下载、使用和分享。Ubuntu 提供了一个健壮、功能丰富的计算环境,既适合家庭使用又适用于商业环境,为用户带来了了尽善尽美的使用体验。阿里巴巴开源镜像站,持续同步 Ubuntu、Ubuntu-ports 等最新版镜像文件,为开发者提供极致的下载体验。阿里巴巴开源镜像站icon-default.png?t=N7T8https://developer.aliyun.com/mirror/ubuntu?spm=a2c6h.13651102.0.0.3e221b11IP2lW2        按照以前的流程,应该先备份/etc/apt/source.list, 现在先打开/etc/apt/source.lit, 看到以下内容:

# Ubuntu sources have moved to the /etc/apt/sources.list.d/ubuntu.sources
# file, which uses the deb822 format. Use deb822-formatted .sources files
# to manage package sources in the /etc/apt/sources.list.d/ directory.
# See the sources.list(5) manual page for details.

        根据这个提示, 去查看对应的文件: /etc/apt/sources.list.d/ubuntu.sources, 打开后可以看到格式如下:

Types: deb
URIs: http://ports.ubuntu.com/ubuntu-ports
Suites: noble noble-updates noble-backports
Components: main universe restricted multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

# Ubuntu security updates. Aside from URIs and Suites,
# this should mirror your choices in the previous section.
Types: deb
URIs: http://ports.ubuntu.com/ubuntu-ports
Suites: noble-security
Components: main universe restricted multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

        现在可以直接注释这几行, 或者直接删除这个文件,新增对应源的文件,我现在创建的文件是aliyun.sources, 内容如下:

Types: deb
URIs: https://mirrors.aliyun.com/ubuntu-ports/
# Suites: noble noble-security noble-backports noble-updates noble-proposed
Suites: noble noble-security noble-backports noble-updates
Components:  main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

Types: deb-src
URIs: https://mirrors.aliyun.com/ubuntu-ports/
# Suites: noble noble-security noble-backports noble-updates noble-proposed
Suites: noble noble-security noble-backports noble-updates
Components:  main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

        这里参考官方的格式以及阿里云提供的源格式:

        (1)Types:deb 是指二进制包的位置,deb-src 则是源码包的位置,根据需要分开配置

        (2)URIs:对应下载源的URL, aliyun对应的URL: ubuntu-ports安装包下载_开源镜像站-阿里云

        (3)Suites:通常是版本或者版本加上"-security" "-backports" "-updates"等格式

        (4)Components:按照main restricted universe multiverse格式填写

        (5)Signed-By:按照ubuntu.sources中的复制过来

        【NOTE】Suites, Components等参数都可以按照自己的需求进行修改,并不是要把全部的类型都写上去,按需即可!!!

deb https://mirrors.aliyun.com/ubuntu-ports/ noble main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu-ports/ noble main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu-ports/ noble-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu-ports/ noble-security main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu-ports/ noble-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu-ports/ noble-updates main restricted universe multiverse

# deb https://mirrors.aliyun.com/ubuntu-ports/ noble-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu-ports/ noble-proposed main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu-ports/ noble-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu-ports/ noble-backports main restricted universe multiverse

        源文件中对这部分数据的解释:

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

## Ubuntu distribution repository
##
## The following settings can be adjusted to configure which packages to use from Ubuntu.
## Mirror your choices (except for URIs and Suites) in the security section below to
## ensure timely security updates.
##
## Types: Append deb-src to enable the fetching of source package.
## URIs: A URL to the repository (you may add multiple URLs)
## Suites: The following additional suites can be configured
##   <name>-updates   - Major bug fix updates produced after the final release of the
##                      distribution.
##   <name>-backports - 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.
## Components: Aside from main, the following components can be added to the list
##   restricted  - Software that may not be under a free license, or protected by patents.
##   universe    - Community maintained packages.
##                 Software from this repository is only maintained and supported by Canonical
##                 for machines with Ubuntu Pro subscriptions. Without Ubuntu Pro, the Ubuntu
##                 community provides best-effort security maintenance.
##   multiverse  - Community maintained of restricted. Software from this repository is
##                 ENTIRELY UNSUPPORTED by the Ubuntu team, and may not be under a free
##                 licence. Please satisfy yourself as to your rights to use the software.
##                 Also, please note that software in multiverse WILL NOT receive any
##                 review or updates from the Ubuntu security team.
##
## See the sources.list(5) manual page for further settings.

         到此, 修改完毕, 使用如下命令跟新下载源:

sudo apt-get update

[其他]

        注: 下方的源仅适用于配置 x86 架构下的 ubuntu系统,如果您的系统为 ARM, PowerPC等其他架构,请按照上方的教程进行配置即可,即ubuntu-ports的源。

        针对X86平台的机器, 更换方式大同小异, 这里提供几个国内的下载源,清华大学源和163源似乎还没有Ubuntu 24.04的源,暂时先提供下边两个吧。

        【USTC】

Types: deb
URIs: https://mirrors.ustc.edu.cn/ubuntu
Suites: noble noble-updates noble-backports
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

Types: deb
URIs: https://mirrors.ustc.edu.cn/ubuntu
Suites: noble-security
Components: main restricted universe multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

        【Aliyun】 

Types: deb
URIs: https://mirrors.aliyun.com/ubuntu/
Suites: noble noble-updates noble-backports
Components: main universe restricted multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

# Ubuntu security updates. Aside from URIs and Suites,
# this should mirror your choices in the previous section.
Types: deb
URIs: https://mirrors.aliyun.com/ubuntu/
Suites: noble-security
Components: main universe restricted multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

  • 31
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值