开发人员可以在Windows 10上运行Bash Shell和用户模式Ubuntu Linux二进制文件

本文介绍了Windows 10开发者如何在系统上直接运行Bash Shell和用户模式的Ubuntu Linux二进制文件,无需虚拟机。这一新特性允许开发人员快速、轻量级地使用Linux命令行工具,如awk、sed、grep等,甚至可以通过apt-get安装额外的软件,如Redis和Emacs。这是一个针对开发者的功能,旨在消除跨平台工作流程中的障碍,适用于需要在Windows环境中使用Linux工具的开发人员。
摘要由CSDN通过智能技术生成

UPDATE: I've recorded a 30 min video with developers from the project as well as Dustin from Ubuntu about HOW this works if you want more technical details.

更新:我已经与该项目的开发人员以及来自Ubuntu的Dustin录制了30分钟的视频,内容是有关如何获取更多技术细节的方法的。

As a web developer who uses Windows 10, sometimes I'll end up browsing the web and stumble on some cool new open source command-line utility and see something like this:

作为使用Windows 10的Web开发人员,有时我最终会浏览Web并偶然发现一些很酷的新开放源代码命令行实用程序,并看到类似以下内容的内容:

A single lonely $

In that past, that $ prompt meant "not for me" as a Windows user.

在过去,$提示符表示Windows用户“不适合我”。

I'd look for prompts like

我会寻找类似的提示

C:\>

or

要么

PS C:\>

Of course, I didn't always find the prompts that worked like I did. But today at BUILD in the Day One keynote Kevin Gallo announced that you can now run "Bash on Ubuntu on Windows." This is a new developer feature included in a Windows 10 "Anniversary" update (coming soon). It lets you run native user-mode Linux shells and command-line tools unchanged, on Windows.

当然,我并不总是能找到像我一样起作用的提示。 但是今天在BUILD的第一天主题演讲中,Kevin Gallo宣布您现在可以在Windows的Ubuntu上运行Bash了。 这是Windows 10“周年纪念”更新中包含的新开发人员功能(即将推出)。 它使您可以在Windows上不更改地运行本机用户模式Linux Shell和命令行工具。

After turning on Developer Mode in Windows Settings and adding the Feature, run you bash and are prompted to get Ubuntu on Windows from Canonical via the Windows Store, like this:

在“ Windows设置”中打开“开发人员模式”并添加功能后,运行bash并提示您通过Windows应用商店从Canonical在Windows上获取Ubuntu,如下所示:

Installing Ubuntu on Windows

This isn't Bash or Ubuntu running in a VM. This is a real native Bash Linux binary running on Windows itself. It's fast and lightweight and it's the real binaries. This is an genuine Ubuntu image on top of Windows with all the Linux tools I use like awk, sed, grep, vi, etc. It's fast and it's lightweight. The binaries are downloaded by you - using apt-get - just as on Linux, because it is Linux. You can apt-get and download other tools like Ruby, Redis, emacs, and on and on. This is brilliant for developers that use a diverse set of tools like me.

这不是在VM中运行的Bash或Ubuntu。 这是在Windows本身上运行的真正的本地Bash Linux二进制文件。 它既快速又轻巧,是真正的二进制文件。 这是Windows之上的正版Ubuntu映像,其中包含我使用的所有Linux工具,例如awk,sed,grep,vi等。它既快速又轻巧。 二进制文件由您使用apt-get下载,就像在Linux上一样,因为它是Linux。 您可以apt-get并下载其他工具,例如Ruby,Redis,emacs等。 对于使用像我这样的多种工具的开发人员来说,这是很棒的。

This runs on 64-bit Windows and doesn't use virtual machines. Where does bash on Windows fit in to your life as a developer?

它在64位Windows上运行,并且不使用虚拟机。 Windows上的bash适合您作为开发人员的生活吗?

If you want to run Bash on Windows, you've historically had a few choices.

如果您想在Windows上运行Bash,从历史上看,您有几种选择。

  • Cygwin - GNU command line utilities compiled for Win32 with great native Windows integration. But it's not Linux.

    Cygwin-为Win32编译的GNU命令行实用程序,具有出色的本机Windows集成。 但这不是Linux。
  • HyperV and Ubuntu - Run an entire Linux VM (dedicating x gigs of RAM, and x gigs of disk) and then remote into it (RDP, VNC, ssh)

    HyperV和Ubuntu-运行整个Linux VM(专用于x gigs的RAM和x gigs的磁盘),然后远程访问它(RDP,VNC,ssh)

    • Docker is also an option to run a Linux container, under a HyperV VM

      Docker还可以在HyperV VM下运行Linux容器

Running bash on Windows hits in the sweet spot. It behaves like Linux because it executes real Linux binaries. Just hit the Windows Key and type bash.

在Windows上运行bash达到了最佳效果。 它的行为类似于Linux,因为它执行真正Linux二进制文件。 只需按Windows键并输入bash。

After you're setup, run apt-get update and get a few developer packages. I wanted Redis and Emacs. I did an apt-get install emacs23 to get emacs. Note this is the actual emacs retrieved from Ubuntu's feed.

设置完成后,运行apt-get update并获取一些开发人员软件包。 我想要Redis和Emacs。 我做了apt-get install emacs23来获取emacs。 请注意,这是从Ubuntu提要中检索到的实际emacs。

Running emacs on Windows

Of course, I have no idea how to CLOSE emacs, so I'll close the window. ;)

当然,我不知道如何关闭emacs,所以我将关闭窗口。 ;)

Note that this isn't about Linux Servers or Server workloads. This is a developer-focused release that removes a major barrier for developers who want or need to use Linux tools as part of their workflow. Here I got Redis via apt-get and now I can run it in standalone mode.

请注意,这与Linux服务器或服务器工作负载无关。 这是一个以开发人员为中心的版本,它消除了希望或需要使用Linux工具作为其工作流程一部分的开发人员的主要障碍。 在这里,我通过apt-get获得了Redis ,现在可以在独立模式下运行它。

Running Redis Standalone on Windows

I'm using bash to run Redis while writing ASP.NET apps in Visual Studio that use the Redis cache. I can then later deploy to Azure using the Azure Redis Cache, so it's a very natural workflow for me.

我在Visual Studio中使用Redis缓存编写ASP.NET应用程序时使用bash运行Redis。 然后,我以后可以使用Azure Redis Cache部署到Azure,因此对我来说这是非常自然的工作流程。

Look how happy my Start Menu is now!

看看我的“开始”菜单现在有多高兴!

A happy start menu witih Ubuntu

Keep an eye out at http://blogs.msdn.microsoft.com/commandline for technical details in the coming weeks. There's also some great updates to the underlying console with better support for control codes, ANSI, VT100, and lots more. This is an early developer experience and the team will be collection feedback and comments. You'll find Ubuntu on Windows available to developers as a feature in a build Windows 10 coming soon. Expect some things to not work early on, but have fun exploring and seeing how bash on Ubuntu on Windows fits into your developer workflow!

请密切注意http://blogs.msdn.microsoft.com/commandline ,了解未来几周的技术细节。 基础控制台也进行了一些重大更新,更好地支持了控制代码, ANSI ,VT100等。 这是早期的开发人员经验,团队将收集反馈和意见。 您将发现Windows上的Ubuntu即将作为构建Windows 10中的功能提供给开发人员。 期待一些事情不会尽早开始,但是请尽情探索并了解Windows上的Ubuntu bash如何适合您的开发人员工作流程!

Sponsor:  BUILD - it’s what being a developer is all about so do it the best you can. That’s why Stackify built Prefix. No .NET profiler is easier or more powerful. You’re 2 clicks and $0 away, so build on! prefix.io

赞助商: BUILD-这就是成为开发人员的全部目的,因此请尽其所能。 这就是Stackify构建Prefix的原因。 没有任何.NET探查器更容易或更强大。 您获得2次点击,距离$ 0,所以继续吧! prefix.io

翻译自: https://www.hanselman.com/blog/developers-can-run-bash-shell-and-usermode-ubuntu-linux-binaries-on-windows-10

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值