欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

x86/ARM架构下的Ubuntu系统换国内源

程序员文章站 2022-07-09 18:46:10
Ubuntu系统本身的源使用的是Ubuntu官方的源,下载速度比较慢,所以建议选择更换成国内的源。1 source.list的构成下面是一个X86 主机上 ubuntu18.04 的中科大源,是由一个国内源镜像url、ubuntu版本代号、软件属性组成。最后的四个词条就是软件的属性。deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiversedeb-src https://mirrors.ustc...

Ubuntu系统本身的源使用的是Ubuntu官方的源,下载速度比较慢,所以建议选择更换成国内的源。

1 source.list的构成

下面是一个X86 主机上 ubuntu18.04 的官方源,是由一个源镜像urlubuntu版本代号软件属性组成。最后的四个词条就是软件的属性。

deb http://archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ bionic main main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse
  • main:完全的*软件。
  • restricted:不完全的*软件。
  • universe:ubuntu官方不提供支持与补丁,全靠社区支持。
  • muitiverse:非*软件,完全不提供支持和补丁。

源镜像url中 /ubuntu/ 收录的软件源是针对 X86 架构的。
查资料发现 ubuntu-ports 收录了arm64, armhf, PowerPC, ppc64el, s390x架构的软件源。在嵌入式ARM架构下,就需要将源镜像url中 /ubuntu/ 替换成 /ubuntu-ports/。最终的 source.list 如下

deb http://archive.ubuntu.com/ubuntu-ports/ bionic main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu-ports/ bionic main main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu-ports/ bionic-updates main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu-ports/ bionic-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu-ports/ bionic-backports main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu-ports/ bionic-security main restricted universe multiverse

2 更换并更新源

sudo mv /etc/apt/sources.list /etc/apt/sources.list-bk
sudo vi /etc/apt/sources.list
#将第一节提到的新内容写入
sudo apt-get update

3 其他

ubuntu的长期维护版本(LTS)的版本代号对照表

版本号 Codename
20.04 focal
18.04 bionic
16.04 xenial
14.04 trusty
12.04 precise

常用国内源镜像url

#中科大源
https://mirrors.ustc.edu.cn/*/

#阿里云源
http://mirrors.aliyun.com/*/

#清华源
https://mirrors.tuna.tsinghua.edu.cn/*/

#网易
http://mirrors.163.com/*/

提示:上述url中的*表示占位,请根据使用的架构选择(X86选择/ubuntu/,ARM等选/ubuntu-ports/)

4 复制可用

以下源我已经Nvidia Jetson系列arm开发板上验证可用。

# 默认注释了源码仓库,如有需要可自行取消注释
deb https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic main 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-security main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse

本文地址:https://blog.csdn.net/u013554213/article/details/107573509