2

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.

5

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

6
  • Oh man! It just saved my ssd space! A little curiosity: the process Set-Location, New-Item these thing could have been done in normal commands like cd D:\, mkdir WSL ... i mean, why did you suggested these types of commands instead? – DG_ Jul 30 '20 at 6:44
  • Because I am familiar with using full commands instead of aliases. Welcome – programmer365 Jul 30 '20 at 6:47
  • now I have got an issue with permission, anything I try to open with vim/ touch a file, even inside ubuntus file, it shows Permission denied – DG_ Jul 30 '20 at 9:29
  • do chmod +x before execution – programmer365 Jul 30 '20 at 9:30
  • 1
    by the way, for future users, who may face problem like this, what I did stupid is I edited .bashrc / .zshrc directly with my text editor program which is installed on windows machine, DO NOT EVER DO THAT – DG_ Jul 31 '20 at 5:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.