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
相关推荐
慕容雪_1 天前
运维笔记-笔记本无线网卡连接wifi,有线网卡连接内网
运维·内网·远程
小杰帅气1 天前
进程优先级与切换调度
linux·运维·服务器
方便面不加香菜1 天前
Linux基本指令(1)
linux
MIXLLRED1 天前
Ubuntu 22.04/ROS2 Humble下使用Intel RealSense D435i相机
ubuntu·d435i·ros2·深度相机
华纳云IDC服务商1 天前
DNS负载均衡能自动避开故障服务器吗?
运维·服务器·负载均衡
济6171 天前
linux(第十四期)--Uboot移植(1)-- Ubuntu20.04
linux
奋斗的阿狸_19861 天前
键盘组合键监听与 xterm 唤醒程序
linux·运维·服务器
小张成长计划..1 天前
【linux】2:linux权限的概念
linux·运维·服务器
马踏岛国赏樱花1 天前
Windows与Ubuntu双系统,挂载D/E盘到Ubuntu下时只能读的问题
linux·windows·ubuntu
ben9518chen1 天前
Linux操作系统基本使用
linux·运维·服务器