以前在windows上都是通过VMware开Linux,不仅需要破解,还慢。既然有了WSL2这种好东西,不得用起来😏。
之前在公司是装的WSL,结果好多功能用不了。。大意了,WSL2改进的不是一点点啊
PS:虽然windows安装WSL2的博客无数,但最好还是学着从official website上一步步进行,博客类的仅供参考~
Pre-action
enable windows11 WSL and hypervisor functions:
Install WSL command
Open PowerShell or Windows Command Prompt in administrator,enter the following command, The –install command performs the following actions:
Enables the optional WSL and Virtual Machine Platform components
Downloads and installs the latest Linux kernel
Sets WSL 2 as the default
Downloads and installs the Ubuntu Linux distribution (reboot may be required)
wsl --install
Restart your windows
Change the default Linux distribution installed
see Linux distribution supported:
wsl --list --online
for example, install Ubuntu 22.04:
wsl --install -d Ubuntu-22.04
set a user account and password at the same time.
install successful
check Linux and wsl verison
wsl -l -v
New Linux installations, installed using the wsl –install command, will be set to WSL 2 by default.
custom shell style
background image
Settings → Profiles → Ubuntu 22.04.02 LTS → Additional settings → Appearance → Background image
output:
more setting options in Appearance, help yourself.
move wsl2 to other drives
To unregister and uninstall a WSL distribution:
wsl --unregister <DistributionName>
move Ubuntu22.04 to D:/
wsl --shutdown
wsl --export Ubuntu-22.04 D:\develop\wsl2\export.tar
wsl --unregister Ubuntu-22.04
wsl --import Ubuntu-22.04 D:\develop\wsl2\ubuntu22-04 D:\develop\wsl2\export.tar --version 2
File storage
open Windows File Explorer, enter:\\wsl$
what’s more, you can also find your linux distribution in Linux
beside File Explorer left-bar:
Q&A
Error code: xxx/0x80072ee2
科学上网