WSL笔记

安装

打开powershell,执行

wsl.exe --install

将自动下载、安装一个Ubuntu系统。最后按照提示,创建这个Ubuntu的账户即可。

关闭WSL

wsl --shutdown

解决无法ping通域名

在 Windows 的文件资源管理器中的文件路径中输入并打开文件夹: %USERPROFILE%

新建 .wslconfig文件,输入如下内容:

# Settings apply across all Linux distros running on WSL 2
[wsl2]

# Limits VM memory to use no more than 4 GB, this can be set as whole numbers using GB or MB
memory=8GB

# Sets the VM to use two virtual processors
processors=8

[experimental]
autoMemoryReclaim=gradual # 开启自动回收内存,可在 gradual, dropcache, disabled 之间选择
networkingMode=mirrored # 开启镜像网络
dnsTunneling=true # 开启 DNS Tunneling
firewall=true # 开启 Windows 防火墙
autoProxy=true # 开启自动同步代理
sparseVhd=true # 开启自动释放 WSL2 虚拟硬盘空间

留下评论

您的邮箱地址不会被公开。 必填项已用 * 标注