WSL win10 linux 子系统Ubuntu18.04下更改apt源为阿里云源

新安装了WSL-Ubuntu默认的apt源是国外的源。国内访问速度会很慢。所以更改国内源是非常有必要的。

步骤:

  • 备份list文件
cd /etc/apt/
sudo cp sources.list sources.list.bak
  • 修改list文件
sudo vim sources.list

等等用vim打开以后好像不会修改,尴尬~~幸好wsl和主机win10系统文件可以相互访问,所以可以将sources.list拷贝到win10目录,改好之后在移回来。/mnt/d对应win10的d盘

cp sources.list /mnt/d

cp /mnt/d/sources.list 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-get update
sudo apt-get upgrade

注意:ubuntu18.04是bionic,如果您是其他版本,可以先用指令查看系统版本(代号),然后在修改sources.list文件。

lsb_release -c

 

你可能感兴趣的:(linux开发,阿里云)