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
相关推荐
Why not try?!3 分钟前
Centos7 中 Docker运行配置Apache
运维·docker·容器
杰克逊的日记10 分钟前
Flink运维要点
大数据·运维·flink
hnlucky25 分钟前
如何彻底清空docker里面不使用的容器?
运维·docker·容器
像风一样的男人@35 分钟前
Linux --systemctl损坏
linux·运维·服务器
南棱笑笑生38 分钟前
20250515测试飞凌的OK3588-C的核心板在Linux R4下适配以太网RTL8211F-CG时跑iperf3的极速
linux·服务器·网络
南方以南_40 分钟前
【云实验】搭建个人网盘实验
linux·运维·服务器
humors22141 分钟前
Windows运维工具批处理版
运维·windows·计算机·电脑·笔记本·维护·台式机
酷爱码1 小时前
Linux实现临时RAM登录的方法汇总
linux·前端·javascript
muxue1781 小时前
chmod 777含义:
linux
Snasph1 小时前
Ubnutu ADB 无法识别设备的解决方法
ubuntu·adb