Win10 WSL换源

0、需求

  • Win10内置的WSL默认是国外服务器,在国内更新、下载很慢
  • 将服务器改为国内的镜像服务器速度会快很多

1、操作

  • 备份原始文件,便于出错后恢复

    • cp /etc/apt/sources.list /etc/apt/sources.list.20200722
  • 修改服务器地址

    • sudo vi /etc/apt/sources.list
    • 将里面的内容删除,变为国内镜像服务器地址
    • 以下为阿里云镜像
      	deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
      	deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
      	deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
      	deb 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 main restricted universe multiverse
      	deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
      	deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
      	deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
      	deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
      
  • 更新

    • sudo apt update

2、参考资料

  • Ubuntu - WSL系统更换国内源【WSL第三弹】
  • Ubuntu 更换 apt 源为阿里云

你可能感兴趣的:(环境配置)