有没有可能在没有微软商店的 Windows10WSL 中安装 Ubuntu?

在我的工作不允许安装应用程序从微软商店。是的,这是一个银行,不支持 Windows10(这是地狱)。

有没有可能在 WSL 中安装 Ubuntu 而不需要从应用程序商店下载?

或者有没有可能在没有微软商店的情况下下载 Ubuntu 应用然后安装它?

133673 次浏览

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.

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!!!

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!

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)

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.

In an administrator PowerShell or Windows Command Prompt and then restarting your machine:

wsl --install --distribution Ubuntu

You can get distributions list by:

wsl --list --online