目录
1、开启适用于Linux的Windows子系统
Win + R,输入 control appwiz.cpl 命令:
点击 “启用或关闭windows功能”:
勾选 “适用于Linux的Windows子系统”,然后重启计算机:
2、安装WSL
以管理员身份运行 Windows PowerShell,输入以下命令:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
3、安装Ubuntu
打开微软应用商店 Microsoft Store,搜索 “Ubuntu”,下载安装,这里下载的为 Ubuntu18.04 LTS 版本:
如果系统中没有 Microsoft Store ,可以以管理员身份运行 Windows PowerShell,执行以下命令进行安装:
get-appxpackage *store* | remove-Appxpackage
add-appxpackage -register "C:\Program Files\WindowsApps\*Store*\AppxManifest.xml" -disabledevelopmentmode
另外如果 Microsoft Store 连不上网络的话,可以参考文章:Microsoft Store连不上网解决办法
安装之后可以点击启动进入Ubuntu子系统,也可以在应用商店中下载 Windows Terminal 便捷打开:
4、Ubuntu子系统相关配置
设置软件源为国内地址:
#编辑源配置文件
sudo vim /etc/apt/sources.list
#设置为清华的源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
#保存退出
:wq
#更新软件包缓存
sudo apt-get update
sudo apt-get upgrade
其他软件源地址: