Ubantu设置国内镜像(阿里云、华为云)

1. 确定系统版本

国内有很多 Ubuntu 的镜像源,包括阿里的、网易的,还有很多教育网的源,比如:清华源、中科大源等。

不同的 ubantu 版本对应的镜像源有所不同,所以需要先查看系统的版本号:

bash 复制代码
lsb_release -a

// output
root@DESKTOP-Q58L5PB:/etc/apt# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.6 LTS
Release:        20.04
Codename:       focal

可以看到系统的版本号是 20.04.6 LTS,注意这个开发代号 Codename = focal,Ubuntu每一个版本都有一个代号,这个一定要跟国内源对应,否则会出问题。


2. 镜像

2.1 阿里云镜像

通过以下地址可以看到阿里云 Ubuntu 各个版本的镜像地址,从中选择自己的系统版本就好,一定要选择 Codename 对应的版本。镜像地址: ubuntu镜像_ubuntu下载地址_ubuntu安装教程-阿里巴巴开源镜像站

以下是20.04.6 LTS 对应 forcal 的镜像源信息。

bash 复制代码
deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

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

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

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

deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
  1. 备份官方镜像
bash 复制代码
sudo cp /etc/apt/sources.list /etc/apt/sources.list.back
  1. 编辑 sources.list
bash 复制代码
vim /etc/apt/sources.list
  1. 更新镜像源
bash 复制代码
sudo apt update
sudo apt upgrade

2.2 其他

ubuntu | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror

ubuntu | 镜像站使用帮助 | 华为软件镜像站


Reference

  1. https://blog.csdn.net/MacWx/article/details/137689898
  2. https://blog.csdn.net/shenzhenyancheng/article/details/126786768
相关推荐
秋风起,再归来~10 分钟前
【Linux庖丁解牛】—进程优先级!
linux·运维·服务器
cosX+sinY29 分钟前
ubuntu 20.04 编译运行lio-sam,并保存为pcd
linux·ubuntu·机器人
Lary_Rock1 小时前
Android 编译问题 prebuilts/clang/host/linux-x86
android·linux·运维
熬夜学编程的小王1 小时前
【Linux篇】理解信号:如何通过信号让程序听从操作系统的指令
linux·信号产生·软件条件产生信号
绵绵细雨中的乡音2 小时前
Linux进程学习【基本认知】
linux·运维·学习
Johny_Zhao2 小时前
MySQL 高可用集群搭建部署
linux·人工智能·mysql·信息安全·云计算·shell·yum源·系统运维·itsm
珹洺3 小时前
Linux操作系统从入门到实战(三)Linux基础指令(上)
linux·运维·服务器
再睡一夏就好3 小时前
Linux常见工具如yum、vim、gcc、gdb的基本使用,以及编译过程和动静态链接的区别
linux·服务器·c语言·c++·笔记
归寻太乙3 小时前
Linux环境变量
linux·运维·服务器
Sapphire~3 小时前
Linux-06 ubuntu 系统截图软件使用简单记录
linux·运维·ubuntu