有时候需要我们在本地解析 atop日志 binlog和慢查询。查看离线项目日志时,也想用linux命令快速检索,而我们电脑又是windows系统,装双系统又不太方便实惠。此时若是有个Linux系统就好了。于是 我们想到启用windows自带的Linux,对付atop、binlog、慢查询是足够了。
Windows启用自带Linux
来源:https://zhuanlan.zhihu.com/p/438255467
1、 以管理员身份打开powershell
右键开始点击Windows Powershell(管理员)打开powershell
Powershell默认没开启复制粘贴快捷按钮,打开属性勾选上即可
2、 执行下面两行代码
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
3、 安装Linux内核更新包,下载后双击安装即可
https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
4、 执行下面代码
wsl --set-default-version 2
5、 打开Microsoft Store软件,搜索安装18.04版本的ubuntu:
6、 安装完powershell输入ubuntu打开进入Linux(可能需要重启电脑), lsb_rel