win10添加 Microsoft store中自带的Ubuntu18.04linux
在win10的系统有支持linux内核的工具wsldocker
在任务栏总搜索“功能”ubuntu
勾选适用于Linux的windows子系统;等待升级。windows
而后在Microsoft store中查找Ubuntu安全
我这里使用的是18.04,因此主要说下这个版本的。bash
下载好以后,等待安装、重启电脑、win键中会有一个Ubuntu的图标之后使用时即可以点击这里进去工具
附加:升级wsl、启用systemctl(该版本默认未启用)、安装dockercode
系统设置中找到"更新与安全"--->将版本升级至最新版(可能须要30 - 60min)component
以后参考官方的文档来操做:orm
https://docs.microsoft.com/en-us/windows/wsl/wsl2-install
https://discourse.ubuntu.com/t/using-snapd-in-wsl2/12113
运行以上两行命令(切记使用管理员身份)
这里就是进行了两项设置:make sure that both the Virtual Machine Platform and Windows Subsystem for Linux optional components are installed.
大概就是启用了了Virtual Machine Platform and Windows Subsystem 这两个
而后将wsl的版本升级到2.0版本,仍是在PowerShell中或者cmd中(管理员身份)
<Distro> 这个参数使用 wsl -l来查看;例如:
启用systemctl
https://discourse.ubuntu.com/t/using-snapd-in-wsl2/12113
进入到Ubuntu系统中,运行一下两行命令:
sudo daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target
exec sudo nsenter -t $(pidof systemd) -a su - $LOGNAME
具体含义能够参考官网的文档!
如今就能够是用systemctl 命令了;