Is there any ways to install WSL on non-C drive?

Due to a small SSD space, I can not afford a WSL (Windows Sub-system for Linux) to be installed by default in Local-drive (C), by windows store.

Can I install WSL on a different drive? I have searched through-out google, there is no mention of this problem.


Solution 1:

Yes. Now open Powershell.

  • Run Set-Location DriveLetter: where DriveLetter is the drive where WSL will be installed.

  • Then create a directory for WSL with New-Item WSL -Type Directory.

  • Now set location there with Set-Location .\WSL.

  • Now download the appx package with Invoke-WebRequest -Uri appx_package_url -OutFile Linux.appx -UseBasicParsing.

  • Now we will unpack appx with Copy-Item .\Linux.appx .\Linux2.appx and then Rename-Item .\Linux2.appx -Newname "Linux2.zip" and then Expand-Archive .\Linux2.zip.

  • Now Get-Childitem -Filter *.exe and you will find an .exe file named by the distro you downloaded. Run that to setup WSL you are done.

List of links of wsl distros here