We’re excited to announce starting today you can try the Windows Subsystem for Linux 2 by installing Windows build 18917 in the Insider Fast ring! In this blog post we’ll cover how to get started, the new wsl.exe commands, and some important tips. Full documentation about WSL 2 is available on our docs page.
我们很高兴地宣布,从今天开始,您可以在Insider Fast环中安装Windows版本18917,从而尝试Linux 2的Windows子系统! 在此博客文章中,我们将介绍如何入门,新的wsl.exe命令以及一些重要提示。 有关WSL 2的完整文档可在我们的文档页面上找到 。
WSL 2入门 (Getting Started with WSL 2)
We can’t wait to see how you start using WSL 2. Our goal is to make WSL 2 feel the same as WSL 1, and we look forward to hearing your feedback on how we can improve. The Installing WSL 2 docs explains how to get up and running with WSL 2.
我们迫不及待地想看看您如何开始使用WSL2。我们的目标是使WSL 2感觉与WSL 1相同,我们期待听到您对如何改进WSL的反馈。 《 安装WSL 2》文档说明了如何启动和运行WSL 2。
There are some user experience changes that you’ll notice when you first start using WSL 2. Here are the two most important changes in this initial preview.
首次开始使用WSL 2时,您会注意到一些用户体验更改。这是此初始预览中最重要的两个更改。
将Linux文件放在Linux根文件系统中 (Place your Linux files in your Linux root file system)
Make sure to put the files that you will be accessing frequently with Linux applications inside of your Linux root file system to enjoy the file performance benefits. We understand that we have spent the past three years telling you to put your files into your C drive when using WSL 1, but this is not the case in WSL 2. To enjoy the faster file system access in WSL 2 these files must be inside of the Linux root file system. We have also made it possible for Windows apps to access the Linux root file system (like File Explorer! Try running: explorer.exe . in the home directory of your Linux distro and see what happens) which will make this transition significantly easier.
确保将您经常使用Linux应用程序访问的文件放在Linux根文件系统中,以享受文件性能优势。 我们了解到,过去三年来,我们一直在告诉您在使用WSL 1时将文件放入C驱动器,但在WSL 2中并非如此。要在WSL 2中享受更快的文件系统访问权限,这些文件必须位于内部Linux根文件系统。 我们还使Windows应用程序可以访问Linux根文件系统(例如File Explorer!尝试在Linux发行版的主目录中运行: explorer.exe . ,看看会发生什么情况),这将大大简化此过渡过程。
在初始版本中使用动态IP地址访问Linux网络应用程序 (Access your Linux network applications with a dynamic IP address in initial builds)
WSL 2 includes a huge architecture change using virtualization technology, and we are still working on improving the networking support. Since WSL 2 now runs in a virtual machine, you will need to use that VM’s IP address to access Linux networking applications from Windows, and vice versa you will need the Windows host’s IP address to access Windows networking applications from Linux. We aim to include the ability for WSL 2 to access network applications with localhost as soon as we can! You can find full details and steps on how to do this in our documentation here.
WSL 2包括使用虚拟化技术的巨大体系结构更改,我们仍在努力改善网络支持。 由于WSL 2现在在虚拟机中运行,因此您将需要使用该VM的IP地址从Windows访问Linux网络应用程序,反之亦然,您将需要Windows主机的IP地址从Linux访问Windows网络应用程序。 我们旨在包括WSL 2能够尽快通过localhost访问网络应用程序的功能! 您可以在此处的文档中找到有关如何执行此操作的完整详细信息和步骤。
To read more about the user experience changes please see our documentation: User Experience Changes Between WSL 1 and WSL 2.
要了解有关用户体验更改的更多信息,请参见我们的文档: WSL 1和WSL 2之间的用户体验更改 。
新的WSL命令 (New WSL Commands)
We’ve also added some new commands to help you control and view your WSL versions and distros.
我们还添加了一些新命令来帮助您控制和查看WSL版本和发行版。
-
wsl --set-version <Distro> <Version>Use this command to convert a distro to use the WSL 2 architecture or use the WSL 1 architecture.wsl --set-version <Distro> <Version>使用此命令可以将发行版转换为使用WSL 2体系结构或使用WSL 1体系结构。: the specific Linux distro (e.g. “Ubuntu”)
:特定的Linux发行版(例如“ Ubuntu”)
: 1 or 2 (for WSL 1 or 2)
:1或2(对于WSL 1或2)
-
wsl --set-default-version <Version>Changes the default install version (WSL 1 or 2) for new distributions.wsl --set-default-version <Version>更改新发行版的默认安装版本(WSL 1或2)。 -
wsl --shutdownImmediately terminates all running distributions and the WSL 2 lightweight utility virtual machine.wsl --shutdown立即终止所有正在运行的发行版和WSL 2轻量级实用程序虚拟机。The VM that powers WSL 2 distros is something that we aim to manage entirely for you, and so we spin it up when you need it and shut it down when you don’t. There could be cases where you would want to shut it down manually, and this command lets you do that by terminating all distributions and shutting down the WSL 2 VM.
支持WSL 2发行版的VM是我们旨在完全为您管理的东西,因此我们在需要时将其启动,而在不需要时将其关闭。 在某些情况下,您可能希望手动将其关闭,而该命令可通过终止所有发行版并关闭WSL 2 VM来实现。
-
wsl --list --quietOnly list the distribution names.wsl --list --quiet仅列出分发名称。This command is useful for scripting since it will only output the names of distributions you have installed without showing other information like the default distro, versions, etc.
该命令对于脚本编写很有用,因为它将仅输出您已安装的发行版的名称,而不会显示其他信息,例如默认发行版,版本等。
-
wsl --list --verboseShows detailed information about all the distributions.wsl --list --verbose显示有关所有发行版的详细信息。This command lists the name of each distro, what state the distro is in, and what version it is running. It also shows which distributions is default with an asterisk.
该命令列出了每个发行版的名称,发行版所处的状态以及运行的版本。 它还显示带星号的默认分配。
展望未来,听听您的反馈意见 (Looking ahead and hearing your feedback)
You can expect to get more features, bugfixes, and general updates to WSL 2 inside of the Windows Insiders program. Stay tuned to their experience blog and this blog right here to learn more WSL 2 news.
您可以期望在Windows Insiders程序中获得对WSL 2的更多功能,错误修复和常规更新。 请继续关注他们的经验博客和此博客,以了解更多WSL 2新闻。
If you run into any issues, or have feedback for our team please file an issue on our Github at: github.com/microsoft/wsl/issues, and if you have general questions about WSL you can find all of our team members that are on Twitter on this twitter list.
如果您遇到任何问题,或者对我们的团队有任何反馈,请在我们的Github上提交问题: github.com/microsoft/wsl/issues ,如果您对WSL有一般性的疑问,可以找到我们所有的团队成员。在Twitter上的此Twitter列表中 。