win10 添加 Microsoft store 中自带的 Ubuntu18.04、启用 systemctl 命令

https://blog.csdn.net/weixin_42324489/article/details/102891526open in new window

win10 添加 Microsoft store 中自带的 Ubuntu18.04、启用 systemctl 命令

鲁滨逊 ⊙ 2019-11-04 10:29:58 1321 收藏 3

展开

win10 添加 Microsoft store 中自带的 Ubuntu18.04

在 win10 的系统有支持 linux 内核的工具 wsl

在任务栏总搜索“功能”

勾选适用于 Linux 的 windows 子系统;等待升级。

然后在 Microsoft store 中查找 Ubuntu

我这里使用的是 18.04,所以主要说下这个版本的。

下载好之后,等待安装、重启电脑、win 键中会有一个 Ubuntu 的图标以后使用时便可以点击这里进去

附加:升级 wsl、启用 systemctl(该版本默认未启用)、安装 docker

系统设置中找到"更新与安全"--->将版本升级至最新版(可能需要 30 - 60min)

之后参考官方的文档来操作:

https://docs.microsoft.com/en-us/windows/wsl/wsl2-installopen in new window

https://discourse.ubuntu.com/t/using-snapd-in-wsl2/12113open in new window

运行以上两行命令(切记使用管理员身份)

这里就是进行了两项设置: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 中(管理员身份)

这个参数使用 wsl -l 来查看;例如:

启用 systemctl

https://discourse.ubuntu.com/t/using-snapd-in-wsl2/12113open in new window

进入到 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 命令了

window10 系统优化

windows 服务器 system 进程 cpu 占用率高解决方案(ntoskrnl.exe)

https://blog.csdn.net/qxyywy/article/details/127361735

System 进程占用 CPU 过高

https://blog.csdn.net/qq_43890555/article/details/107236138
Last Updated:
Contributors: 刘荣杰