Custom wsl installation location and coexistence of multiple wsl

Custom wsl installation location

  1. Download the wsl appx image https://docs.microsoft.com/en-au/windows/wsl/install-manual, such as the downloaded Ubuntu 18.04

  2. Change the suffix Appx of the downloaded file to zip, and then unzip it to the location where you want to install the wsl. For example, if it is installed to the Z drive, then decompress to the Z drive. For example, my current directory is Z, and the unzipped directory is Ubuntu18.04onWindows_1804

    $ tree -L 1 Ubuntu18.04onWindows_1804/
    Ubuntu18.04onWindows_1804/
    ├── AppxBlockMap.xml
    ├── AppxManifest.xml
    ├── AppxMetadata
    ├── AppxSignature.p7x
    ├── Assets
    ├── [Content_Types].xml
    ├── fsserver
    ├── install.tar.gz
    ├── resources.pri
    ├── rootfs
    ├── temp
    └── ubuntu1804.exe
    
  3. Double-click ubuntu1804.exe, it will automatically install ubuntu wsl in this directory, wait for a while

Therefore, this installation method is equivalent to the green version of wsl, wherever it is decompressed, it will run (install).

So many versions of wsl are also very easy, you can install it anywhere.

Migrating WSL installed on the system disk

If you want to move the wsl installed in the system disk by default to another directory, use the tool: https://github.com/DDoSolitary/LxRunOffline. Usage is very simple, open powershell:

# 查看当前已经安装的wsl
PS G:\桌面\LxRunOffline-v3.4.0> .\LxRunOffline.exe list
Legacy
Ubuntu-18.04

# 移动指定的wsl
# 比如移动Legacy到Z:\LegacyWSL目录下
PS G:\桌面\LxRunOffline-v3.4.0> .\LxRunOffline.exe move -n Legacy -d 'Z:\LegacyWSL\'

I think it would be better to backup the necessary things in the original wsl to the new wsl, and then uninstall it directly.

Guess you like

Origin www.cnblogs.com/f-ck-need-u/p/12717497.html
Recommended