1. 管理员打开PowerShell,开启WSL功能:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
2. 应用商店下载安装ubuntu
默认工作路径:C:\Users\abnk\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs
Ubuntu中由apt-get获得的文件包保存在/var/cache/apt/archives
3. VMWare和Hyper-v冲突的解决:
bcdedit /set hypervisorlaunchtype off
重启或手动停止Hyper-v服务
bcdedit /set hypervisorlaunchtype auto
用VM就关,用Hyper-v就开
4. 更改源:
sudo cp /etc/apt/sources.list /etc/apt/sources.list_bak sudo vim /etc/apt/sources.list
修改:
:%s/security.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g
:%s/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g
参考:https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
生效:
sudo apt update
5. 安装gcc、g++
sudo apt install gcc g++