112

On my work are not allowed to install apps from the Microsoft Store. Yes, this is a bank, that not supported Windows 10 (it's hell).

Is it possible to install Ubuntu in WSL without downloading it from the app store?

Or is it possible to download Ubuntu app without Microsoft Store and then install it?

bigspawn
  • 1,727
  • 3
  • 16
  • 16
  • 1
    Did it work for you? What are we supposed to do after running Add-AppxPackage distro.appx ? – Raj Shah Aug 05 '20 at 07:40
  • @RajShah It is silent giving impression that probably nothing happened. Please try searching "ubuntu" in the left-bottom windows search. Do you see ubuntu? What happens after you click on it? – qqqqq May 19 '21 at 18:02

6 Answers6

124

Yes, it is possible to download the app without the Store. Some available distributions are listed in the Manual Installation section of the MS guide (https://learn.microsoft.com/en-us/windows/wsl/install-manual)

The actual manual installation instructions are hidden in the Server Install section of the manual (https://learn.microsoft.com/en-us/windows/wsl/install-on-server), but my understanding is that you can just run the .appx file you downloaded and it should work anyway.

Whether it's wise to install WSL/Ubuntu on a work computer that you don't control is another question, but one which only you can answer.

Harun
  • 1,582
  • 1
  • 10
  • 8
  • 1
    I'm wondering if there's a way to get 20.04? It's in the store (which my company blocks) but doesn't seem available for direct download on that site (or any where else) – Matt Jun 10 '20 at 18:47
  • 4
    I ran Add-AppxPackage .\Ubuntu_2004.2020.424.0_x64.appx, the command completed without any error but that's it nothing else happened. When I run wsl it still shows me that there are no installed distros – Raj Shah Aug 05 '20 at 07:37
  • 1
    What to do after running Add-AppxPackage ? Any help would be appreciated – Raj Shah Aug 05 '20 at 07:39
  • I don't know the details of what Add-AppxPackage does - I only used the instructions in the first link (Manual Installation) to download the distro, for the actual install I used the instructions in the second link (Server Install). – Harun Aug 06 '20 at 05:00
  • 1
    This worked for me, but I had to make sure, that I had also activated/installed the "Virtual Machine Platform" (required reboot). This option is available by going to the Control Panel and chosing "Activate Windows Features..." to the left. – Paul Oct 26 '20 at 10:24
  • one more note: for me it did work, but only with PowerShell 5.1, not with 7.1.3. I got the error `Add-AppPackage: The 'Add-AppPackage' command was found in the module 'Appx', but the module could not be loaded. For more information, run 'Import-Module Appx'` – Pizzamaka Apr 21 '21 at 06:34
  • per the link in this answer, i downloaded the appx file and ran it. when i did "wsl --list" it didn't show up yet. so i used the start menu to launch ubuntu, created the user/password, and now it shows up in the list. – oaklodge Aug 09 '21 at 08:57
92

I had the same problem, could do it like this (from PowerShell):

# go into some folder into which you want the file to be downloaded
cd <somefolder>

# download Ubuntu 20.04
Invoke-WebRequest -Uri https://aka.ms/wslubuntu2004 -OutFile Ubuntu.appx -UseBasicParsing

# install downloaded *.appx file
Add-AppxPackage .\Ubuntu.appx

Afterwards I did Windows+S and typed "Ubuntu" to show the installed app, then executed it to finish setup (new user name + password must be given).

I checked the success doing: wsl --list --verbose and received this:

  NAME                   STATE           VERSION
  Ubuntu-20.04           Running         1

So finally, I needed to convert my Ubuntu to WSL2 like this:

wsl --set-version Ubuntu-20.04 2

Voila!

Software Craftsman
  • 2,999
  • 2
  • 31
  • 47
  • 2
    Thx this worked for me. The cmds worked in powershell 5.1 but weren't happy in powershell 7-preview. – Barry McDermid Dec 01 '20 at 14:26
  • 2
    Thank you very much for this, it worked perfectly! Only one comment on my side, before launching the last wsl commands (wsl --list and wsl --set-version ) I had to exit the PS from Admin mode, then everything worked fine. – MrBreaker_1972 Jun 17 '21 at 10:16
  • 4
    Command for kalilinux: ```Invoke-WebRequest -Uri https://aka.ms/wsl-kali-linux-new -OutFile Kali.appx -UseBasicParsing``` Link for other distros: https://learn.microsoft.com/en-us/windows/wsl/install-manual – Th3B0Y Jun 24 '21 at 00:37
  • I got error: `Add-AppxPackage: The 'Add-AppxPackage' command was found in the module 'Appx', but the module could not be loaded. For more information, run 'Import-Module Appx'.` By going to explorer and launching the "ubuntu.appx" worked. Not sure why. (I am on windows 10) – Jayan Sep 03 '21 at 17:06
  • 2
    Also, it's wise to mention that this file is about 800mb so make sure you have internet data (for those that are capped) – Chiaro Oct 01 '21 at 09:30
  • 1
    Thanks! Answers like this are highly appreciated! – DannyThunder Nov 24 '21 at 08:17
  • If `Add-AppxPackage .\Ubuntu_2004.2020.424.0_x64.appx` get you an error in powershell on command not found, use `Import-Module Appx -usewindowspowershell` which will force run with the classic PowerShell. – koushik Jan 18 '22 at 17:28
  • 1
    Invoke-WebRequest is not suitable for my country, Used IDM instead. Because I live in Iraq the power is down every few minutes, unstable internet. Iraqis only: don`t waste time, use IDM instead of Invoke-WebRequest to download the Package – Raiden Core Jun 08 '22 at 15:28
  • WSL2 is super slow to do anything (compilation, computation), stick with WSL1. – synkro Sep 02 '22 at 02:41
6

In an administrator PowerShell or Windows Command Prompt:

wsl --install --distribution Ubuntu

and then restarting your machine.

You can get distributions list by:

wsl --list --online
Oboroten
  • 381
  • 7
  • 10
5

I created a powershell script to install wsl2 with optional X-Windows and Pulse Audio support. I also captured my experience with installing wsl without Store access in the Readme.md.

For the detail see here: https://github.com/andras-varro/wsl2i

I believe these are the most important points:

  1. Check if your installation supports WSL2: Windows logo key + R, type winver [enter]. You should have Version 1903 or higher, with Build 18362 or higher

  2. Enable WSL2

    1. Open an admin prompt (Press shift+ctrl and click on PowerShell/cmd)
    2. dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
    3. Reboot your computer
    4. Download and install the WSL2 kernel from: https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
    5. Open a PowerShell or cmd and execute: wsl --set-default-version 2
  3. Install a Linux distro

    1. Please only download an available distro from here: https://learn.microsoft.com/en-us/windows/wsl/install-manual Explanation: if you install through appx installer without Windows Store enabled, you might run into a 'File not found' or 0x80070002 error.
    2. Create a location on your system drive (see: https://learn.microsoft.com/en-us/windows/wsl/install-win10#troubleshooting-installation, but it works for me on D: drive) where you want your distro to run from (like c:\work\wsl)
    3. Extract the downloaded distro appx file using your favorite zip tool (7Zip or WinZip or ..) into the selected location (Right click on the appx and extract to the created folder (like c:\work\wsl))
    4. Set access rights for your Linux installer folder so that everybody has all the rights Open a cmd or PowerShell and execute: icacls [your folder] /t /grant Everyone:(OI)(CI)F Example: icacls c:\work\wsl /t /grant Everyone:(OI)(CI)F
    5. Start the setup as Administrator. Example with Ubuntu: right click on ubuntu2004.exe and select Run as adminsitrator
    6. Follow the on screen instructions
  4. Test your WSL2

    1. After the setup finished and you have the Linux command prompt try to start bash from Windows' Run (Win+R)
    2. Exit from the started bash and from the bash you got after the installation
    3. Start bash from Windows' Run (Win+R) (again)
Andras
  • 61
  • 1
  • 3
  • Executing ubuntu.exe manually worked while `Add-AppxPackage .\Ubuntu.appx` failed. Changing grants was not required. – real_paul Jul 14 '21 at 07:38
  • for me granting only worked in `cmd`, not PowerShell! and the solution worked, after trying many solutions for many hours. you are my hero <3 – Hannes Schneidermayer Mar 22 '22 at 16:24
3

Yes, It is possible to install Ubuntu without opening the store.

  1. Open settings in windows and enable developer mode.

  2. Once the developer mode is enabled, Go to Windows search and Type Bash.

  3. It will open Bash command prompt. Allow it to download Ubuntu automatically.

Cheers!!!

ravibagul91
  • 20,072
  • 5
  • 36
  • 59
  • 3
    The OP does not have access to the store. I think your suggestion is just merely a shortcut not to have manually open the store. This doesn't help if corporate policy does not allow store access – Tschenser May 27 '20 at 16:43
3

You can use winget (Windows Package Manager):

winget install -e --id Canonical.Ubuntu

To get another version than the "latest", search for them via:

winget search -s winget Ubuntu

If you omit the -s winget option, the versions from other sources like the Microsoft store will be displayed too.

Corbie
  • 819
  • 9
  • 31