是否可以通过“wsl --import”制作distro.exe?

Goa*_*ead 3 jetbrains-ide windows-subsystem-for-linux

wsl --export通过wsl --import.

但与我在 Window Store 上安装 WSL Ubuntu 时不同,没有创建distro.exe诸如ubuntu.exe(在“开始”菜单中找到)之类的文件。因此,从 JetBrain IDE 获取 WSL 支持存在问题。这是因为 JetBrain IDE 通过distro.exe文件识别到 WSL 的路径。

如果有人解决了这个问题,我想得到一些帮助。感谢您阅读。

编辑:Windows 是 v.1909(操作系统版本 18363.592),我尝试https://winaero.com/blog/export-import-wsl-linux-distro-windows-10/

Goa*_*ead 5

我找到了解决方案。(Windows 10 build 18363.592)

1. 导出您的 WSL 发行版

wsl --export {your_distribution_name} rootfs.tar.gz导出您的 wsl 发行版。(您的发行版将被保存到 tarball 中。)

2. 通过 Distro-Launcher 安装你的发行版

我用的是Yuk7 的版本。首先,下载 Launcher.exe,并将其重命名,your_distro_name.exe然后制作目录以定位 WSL 发行版。将your_distro_name.exerootfs.tar.gz在那里。

现在您可以安装发行版,只需运行your_distro_name.exe. 安装后,您可以在 powershell 中运行您的发行版。PS > your_distro_name

3. Settig wsl.distributions.xml

C:\users\\{user_name}\\.{jetbrains_ide_name_version}\config\options\wsl.distributions.xml

Jetbrains IDE 通过 支持 WSL wsl.distributions.xml,您应该将您的添加distro.exe到此以在 Jetbrains IDE 上使用 WSL。

<application>
  <component name="WslDistributionsService" version="1">
    <descriptors>
      <set>
        <descriptor>
          <id>DEBIAN</id>
          <microsoft-id>Debian</microsoft-id>
          <executable-path>debian.exe</executable-path>
          <presentable-name>Debian GNU/Linux</presentable-name>
        </descriptor>
        <descriptor>
          <id>KALI</id>
          <microsoft-id>kali-linux</microsoft-id>
          <executable-path>kali.exe</executable-path>
          <presentable-name>Kali Linux</presentable-name>
        </descriptor>
        ...
      </set>
    </descriptors>
  </component>
</application>
Run Code Online (Sandbox Code Playgroud)
<!-- DESCRIPTOR FOR YOUR DISTRO -->
<descriptor>
  <id>YOUR_DISTRO_NAME</id>
  <microsoft-id>Your-distro-name</microsoft-id>
  <executable-path>your_distro_name.exe</executable-path>
  <presentable-name>your_distro_name</presentable-name>
</descriptor>
Run Code Online (Sandbox Code Playgroud)

只需添加<descriptor><set>.

4. 重新启动您的 JetBrains IDE

最后,我可以在另一台机器的 WebStorm 中使用我导出的 wsl 发行版 :)