ubuntu 20.04 更改国内镜像源-阿里源 确保可用

镜像源是跟linux版本一一对应的,查询自己系统的版本号:

命令:lsb_release -a

cpp 复制代码
ma@cw:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.6 LTS
Release:        20.04
Codename:       focal
ma@cw:~$ 

说明系统版本是 Ubuntu 20.04.6 LTS, 不是请跳过本文章。

1.备份sources.list文件

cpp 复制代码
sudo cp /etc/apt/sources.list /etc/apt/sources.list.back

2.编辑sources.list文件

cpp 复制代码
sudo vim /etc/apt/sources.list
复制代码
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

打开vim编辑器,把sources.list文件中所有的deb文件中未被注释的,全部用#注释掉然后把上面给的国内镜像复制去就可以,并:wq!保存

3.更新

复制代码
sudo apt update
sudo apt upgrade
相关推荐
早睡冠军候选人9 小时前
Ansible学习----管理复杂的 Play 和 Playbook 内容
运维·学习·云原生·ansible
q***040511 小时前
在 Ubuntu 上安装 MySQL 的详细指南
mysql·ubuntu·adb
Robpubking12 小时前
AWS 中 S3 的 server-side encryption 解释与说明
运维·aws
福旺旺12 小时前
Linux——解压缩各类文件
linux
MasterLi802314 小时前
我的读书清单
android·linux·学习
ha204289419414 小时前
Linux操作系统学习之---初识网络
linux·网络·学习
一叶龙洲15 小时前
Ubuntu25.10安装Samba
ubuntu
飞凌嵌入式15 小时前
【玩转多核异构】T153核心板RISC-V核的实时性应用解析
linux·嵌入式硬件·嵌入式·risc-v
陌路2015 小时前
Linux 34TCP服务器多进程并发
linux·服务器·网络
玉树临风江流儿15 小时前
Linux驱动开发实战指南-中
linux·驱动开发