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
相关推荐
j_xxx404_40 分钟前
Linux:进程虚拟地址空间|虚拟内存管理
linux·运维·服务器
江畔何人初1 小时前
pod的定义以及创建过程
linux·运维·云原生
德尔塔大雨淋1 小时前
VLLM 中的module PASS 和FUN PASS
linux·服务器·vllm
末日汐1 小时前
linux线程
linux·运维
玉梅小洋1 小时前
CentOS :yum源配置及验证指南
linux·运维·centos·yum
zxsz_com_cn1 小时前
设备预测性维护算法核心功能有哪些?六大模块拆解智能运维的“技术骨架”
运维·算法
自可乐1 小时前
n8n全面学习教程:从入门到精通的自动化工作流引擎实践指南
运维·人工智能·学习·自动化
枷锁—sha2 小时前
【SRC】越权漏洞检测
运维·服务器·网络·安全·网络安全·系统安全
UP_Continue2 小时前
Linux--进程控制
linux·运维·服务器
请输入蚊子2 小时前
«操作系统真像还原» 第二章 编写MBR主引导记录
linux·汇编·操作系统·bochs·操作系统真像还原