新近版本的windows都支持了Linux,操作如下:
控制面板中启用对应的功能
2. 打开powershell,以安装Ubuntu为例,然后执行
PS C:\Users\steven.wang> wsl.exe --update
正在安装: 适用于 Linux 的 Windows 子系统
已安装 适用于 Linux 的 Windows 子系统。
PS C:\Users\steven.wang> wsl --set-default-version 2
有关与 WSL 2 关键区别的信息,请访问 https://aka.ms/wsl2
操作成功完成。
PS C:\Users\steven.wang> wsl --install -d Ubuntu-18.04
Ubuntu 18.04 LTS 已安装。
正在启动 Ubuntu 18.04 LTS...
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: root
adduser: The user `root' already exists.
Enter new UNIX username: apps
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
操作成功完成。
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
apps@steven:~$ ls
apps@steven:~$ pwd
/home/apps