WSL2 ubuntu子系统换源

文章目录

1.直接编辑/etc/apt/sources.list文件(需要使用 sudo):

将原文件做备份:

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

编辑文件

复制代码
sudo vi /etc/apt/sources.list

2.将文件中的内容删除,将以下对应版本镜像源复制到里面。

ubuntu的镜像源

ubuntu18.04(bionic)配置如下:

复制代码
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

# deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

ubuntu 20.04(focal) 配置如下:

复制代码
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

# deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

3.更新

复制代码
sudo apt-get update
相关推荐
kk”5 小时前
Linux的组和权限管理
linux·运维·服务器
智购科技智能售货柜6 小时前
2026自动售货机整机可靠性测试:从高低温交变到EMC电磁兼容的认证工程实践~YH
运维·服务器·数据库·人工智能·物联网
mohesashou7 小时前
红帽linux的K8S部署
linux·kubernetes·ansible
xiaoye-duck7 小时前
《Linux网络编程》UDP Socket 编程实战:从 Echo 回显、通用字典服务到套接字封装全流程
linux·网络·udp
酒神dnspup7 小时前
CDN 回源检测怎么做?用 DNSPup 验证节点命中、源站暴露与多地可用性
运维·服务器·网络·网络协议·tcp/ip
Rain的Java大神之路8 小时前
短信接口被狂刷怎么处理
java·运维·后端·web安全·面试·架构·xss
江南风月8 小时前
3分钟快速上手日志审计系统 WGLOG v2.2 更新了什么
运维·服务器·网络
孙克旭_8 小时前
Docker 镜像构建|Vue+SpringBoot+Go 多语言项目 Dockerfile 案例
linux·运维·vue.js·spring boot·docker·dockerfile
life码农9 小时前
Linux截取Nginx指定时间段日志的三种方法(grep/awk/sed)
linux·nginx