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
相关推荐
Caster_Z5 分钟前
WinServer安装VM虚拟机运行Linux-(失败,云服务器不支持虚拟化)
linux·运维·服务器
小小测试开发26 分钟前
提升WebUI自动化效率与性能:从脚本到架构的全链路优化指南
运维·架构·自动化
少废话h1 小时前
Redis主从与集群搭建全指南
大数据·linux·redis·mysql
The star"'1 小时前
mysql(1-3)
运维·mysql·云计算
Cheadmaster2 小时前
20252820_进程管理实验
linux
model20052 小时前
Alibaba linux 3安装LAMP(5)
linux·运维·服务器
哇哈哈&2 小时前
安装wxWidgets3.2.0(编译高版本erlang的时候用,不如用rpm包),而且还需要高版本的gcc++19以上,已基本舍弃
linux·数据库·python
weixin_307779133 小时前
Jenkins中的Jakarta Activation API插件:功能、使用与最佳实践
运维·开发语言·ci/cd·自动化·jenkins
minihuabei4 小时前
跨域拉镜像
linux
王 富贵5 小时前
【Linux】防火墙常用命令(iptables/firewalld/ufw)
linux·运维·服务器