win10安装wsl
win10没有微软商店的情况下安装wsl的两种方法
一、使用LxRunOffline工具安装管理wsl:
- 下载LxRunOffline,lxRunOffline下载最新的发行版本
- 下载wsl离线包,WSL_download下载一个喜欢的WSL发行版本。
- 将下载的wsl包后缀名appx修改为zip并解压为tar压缩包。
- 用lxrunoffline按如下格式安装压缩包
# LxRunOffline install -n <子系统名称> -d <安装路径> -f <安装包>.tar.gz
LxRunOffline install -n ubuntu2004 -d D:/wsl/ubuntu2004 -f d:/wsl//ubuntu2004.tar.xz
二、按照微软官网的离线安装说明进行安装:
原文:https://learn.microsoft.com/en-us/windows/wsl/install-manual
Downloading distributions
There are some scenarios in which you may not be able (or want) to, install WSL Linux distributions using the Microsoft Store. You may be running a Windows Server or Long-Term Servicing (LTSC) desktop OS SKU that doesn't support Microsoft Store, or your corporate network policies and/or admins do not permit Microsoft Store usage in your environment. In these cases, while WSL itself is available, you may need to download Linux distributions directly.
If the Microsoft Store app is not available, you can download and manually install Linux distributions using these links:
- Ubuntu
- Ubuntu 22.04 LTS
- Ubuntu 20.04
- Ubuntu 20.04 ARM
- Ubuntu 18.04
- Ubuntu 18.04 ARM
- Ubuntu 16.04
- Debian GNU/Linux
- Kali Linux
- SUSE Linux Enterprise Server 12
- SUSE Linux Enterprise Server 15 SP2
- SUSE Linux Enterprise Server 15 SP3
- openSUSE Tumbleweed
- openSUSE Leap 15.3
- openSUSE Leap 15.2
- Oracle Linux 8.5
- Oracle Linux 7.9
- Fedora Remix for WSL
This will cause the <distro>.appx
packages to download to a folder of your choosing.
If you prefer, you can also download your preferred distribution(s) via the command line, you can use PowerShell with the Invoke-WebRequest cmdlet. For example, to download Ubuntu 20.04:
Invoke-WebRequest -Uri https://aka.ms/wslubuntu2004 -OutFile Ubuntu.appx -UseBasicParsing
Tip If the download is taking a long time, turn off the progress bar by setting $ProgressPreference = 'SilentlyContinue' You also have the option to use the curl command-line utility for downloading. To download Ubuntu 20.04 with curl:
curl.exe -L -o ubuntu-2004.appx https://aka.ms/wslubuntu2004
In this example, curl.exe
is executed (not just curl
) to ensure that, in PowerShell, the real curl executable is invoked, not the PowerShell curl alias for Invoke-WebRequest.
Once the distribution has been downloaded, navigate to the folder containing the download and run the following command in that directory, where app-name
is the name of the Linux distribution .appx file.
Add-AppxPackage .\app_name.appx
wsl -l
will not show that the distribution is installed until this step is complete).If you are using Windows server, or run into problems running the command above you can find the alternate install instructions on the Windows Server documentation page to install the .appx
file by changing it to a zip file.
Once your distribution is installed, follow the instructions to create a user account and password for your new Linux distribution.