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
相关推荐
難釋懷12 分钟前
Nginx自签名-图形化工具 XCA
运维·nginx
运维栈记2 小时前
API Error: 400 Request body format invalid
linux·ai
志栋智能2 小时前
小步快跑:从单一场景开启超自动化巡检之旅
运维·网络·人工智能·自动化
AugustRed2 小时前
Linux 运维常用命令大全(超全速查表)
运维·网络·php
小白兔奶糖ovo2 小时前
【Leetcode】231. 2的幂
linux·算法·leetcode
Plastic garden2 小时前
Docker(1)
运维·docker·容器
s_w.h3 小时前
【 linux 】动静态库的制作
linux·运维·服务器·算法·bash
songjxin3 小时前
Nginx 日志分析可视化面板
运维·nginx
专注VB编程开发20年3 小时前
安卓APP与服务器通讯技术,文件传输和文字消息收发
运维·服务器
顺风尿一寸3 小时前
深入Linux内核:mkdir系统调用的完整实现解析
linux