1 Dependence
Laptop Windows 10 memory is tight: 16 G,
but some components are required for development, such as Redis (Redisearch, ReJson), MySQL, etc. It is
more convenient and easy to deploy in Linux containerization, and
installing Linux through a virtual machine in Windows will easily lead to Insufficient memory,
however, there will be some problems when using WSL in Windows 10 (specifically, I have not tried it),
at this time, Windows 11 has been released for a while,
upgrade the Windows operating system to 11, Windows 11 supports WSL 2, and takes up more memory Linux is rarely deployed on virtual machines,
so try WSL2 early on.
2 deployment
2.1 Download resources
Download via Microsoft Store: Windows Subsystem for Linux and Ubuntu
- search wsl
- search ubuntu
2.2 Configuring WSL
Turn Windows features on or off through the Control Panel.
- Process:
Open Terminal->control->Programs->Programs and Features->Enable or Disable Windows Features
Add resources required by Linux:
- Windows Subsystem for Linux
- virtual machine platform
2.3 Enable WSL
In order to ensure the normal installation of Ubuntu in the future, WSL must be enabled and the operating system must be restarted.
- Process:
administrator executes terminal: Win+X->terminal administrator - 命令
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
2.4 Install Ubuntu
2.5 View WSL
wsl -l -v
3 Migrating the operating system
The operating system installed through WSL2 is on the C drive by default,
so the operating system is migrated to other drives.
3.1 Default location
There is an ext4 disk image file under the C:\Users{USERNAME}\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc
LocalState folder.
3.2 Migration
3.2.1 Close WSL
wsl --shutdown
3.2.2 View WSL status
wsl -l -v
3.2.3 Export system
As can be seen from the figure above, the name of the operating system is: Ubuntu.
After closing the operating system, migrate the operating system to: D:\WSLinux\ubuntu.tar
# wsl --export OS-Name /path/name.tar
wsl --export Ubuntu D:\WSLinux\ubuntu.tar
3.2.4 Log off the operating system
wsl --unregister Ubuntu
3.2.5 Import the operating system
# wsl --import OS-Name target-path tar-file-path
wsl --import Ubuntu D:\WSLinux\Ubuntu2204 D:\WSLinux\ubuntu.tar --version 2
3.2.6 Add user
ubuntu.exe config --default-user xindaqi
3.3 Restart
4 Summary
none.