在Windows 10上为Hyper-V使用增强模式Ubuntu 18.04
I run Windows as my daily driver but I use WSL (Windows Subsystem for Linux) all day long but WSL is just the command-line and has some perf issues with heavy file system work. I use Docker for Windows which works amazingly and has it good perf but sometimes I want to test on a full Ubuntu Desktop.
我将Windows作为日常驱动程序运行,但是整天都使用WSL(Linux的Windows子系统),但是WSL只是命令行,并且在文件系统繁重的工作中存在一些性能问题。 我使用适用于Windows的Docker,它的性能惊人且性能出色,但有时我想在完整的Ubuntu桌面上进行测试。
ASIDE: No joke. My Linux/Ubuntu bona fides go back a while. Here's me installing Ubuntu 10.4 on Windows 7 over 8 years ago. Umuntu ngumuntu ngabantu!
旁白:没有开玩笑。 我Linux / Ubuntu真实情况可以追溯到一段时间。 这是我8年前在Windows 7上安装Ubuntu 10.4的地方。 Umuntu ngumuntu ngabantu!
To be frank, historically Ubuntu has sucked on Window's Hyper-V. If you wanted to get a higher (read: usable) resolution it would take a miracle. If you wanted shared clipboards or shared disk drives, well, again, miracle or a ton of manual set up. It's possible but it's not fun.
坦率地说,从历史上看,Ubuntu吸引了Window的Hyper-V。 如果您想获得更高的分辨率(阅读:可用),那将是一个奇迹。 如果您想要共享剪贴板或共享磁盘驱动器,那么还是要奇迹般地进行大量手动设置。 有可能,但是不好玩。
Why can't it be easy? Well, it is. I installed the Windows 10 "Fall Creators Update" - yes the name is stupid. It's Windows 10 "1809" - that's 2018 and the 9th month. Just type "Winver" from the Start menu. You may have "1803" from March. Go update.
为什么不那么容易? 好吧,是的。 我安装了Windows 10“秋季创作者更新”-是的,这个名称很愚蠢。 它是Windows 10“ 1809”,即2018年和第9个月。 只需从“开始”菜单中键入“ Winver”。 从三月开始,您可能会收到“ 1803”。 去更新。
Windows 10 includes Hyper-V Quick Create which has this suspiciously short list under "Select an operating system." Anytime a list has 1 or 2 items and some whitespace that means it will someday have n+1 list items.
Windows 10包括Hyper-V快速创建,在“选择操作系统”下具有此可疑的简短列表。 每当列表包含1或2个项目以及某些空格时,表示某天它将具有n + 1个列表项目。
Recently Ubuntu 18.04.1 LTS showed up in this list. You can quickly and easily create an Ubuntu VM from here and it's all handled, downloading, network switch, VM create, etc.
最近,Ubuntu 18.04.1 LTS出现在此列表中。 您可以从此处快速轻松地创建Ubuntu VM,并已完成所有操作,下载,网络切换,VM创建等。
I dig it. So click create, start it up...get to the set up screen. Now, here, make sure you click "Require my password to login." What we want to do won't work with "Log in Automatically" and you don't want that anyway.
我喜欢。 因此,单击创建,启动它...进入设置屏幕。 现在,在这里,请确保单击“需要我的密码才能登录”。 我们要执行的操作不适用于“自动登录”,并且您还是不希望这样做。
After you've created your VM and got it mostly setup, close the Hyper-V client window. Just X it out. The VM is still running of course.
创建虚拟机并对其进行主要设置后,请关闭Hyper-V客户端窗口。 只需X出来。 VM当然仍在运行。
Go over to Hyper-V Manager and right click on it and "Connect."
转到Hyper-V Manager,右键单击它,然后单击“连接”。
You'll see a resolution dialog...pick one! Go crazy! Do be aware that there are issues on 4k display but you can adjust within Ubuntu itself.
您会看到一个分辨率对话框...选择一个! 疯了! 请注意,4k显示屏存在问题,但是您可以在Ubuntu本身中进行调整。
Now, BEFORE you click Connect, click "Show Options" and then "Local Resources." Under here, uncheck Smart Cards and Check "Drives."
现在,在单击“连接”之前,单击“显示选项”,然后单击“本地资源”。 在这里,取消选中智能卡,然后选中“驱动器”。
Click OK and Connect...and you get this weird dialog! You're actually RDP'ing into Ubuntu! Rather than using the historical weird Hyper-V Client stuff to talk to Ubuntu and struggle with video cards and resolutions, here you are literally just Remote Desktoping into Ubuntu using integrated open source xrdp!
单击确定并连接...,您将得到这个奇怪的对话框! 您实际上是在RDP进入Ubuntu! 与其使用历史悠久的怪异Hyper-V Client东西与Ubuntu进行对话并与视频卡和分辨率作斗争,这里实际上是使用集成的开源xrdp将桌面远程化到Ubuntu中!
Login with your name and password (remember before when I said don't automatically login? This is why.)
使用您的名称和密码登录(记得之前我说过不要自动登录吗?这就是为什么。)
动态调整大小呢? (What about Dynamic Resizing?)
Here's an even better possible future. What we REALLY want (don't we, Dear Reader) is Dynamic Resolution and Resizing without Reconnection! Today you can just close and reconnect to change resolutions but I'd love to just resize the Ubuntu window like I do Windows 7/8/10 VM client windows.
这是一个更好的未来。 我们真正想要的(亲爱的读者,我们不要)是动态分辨率和调整大小而无需重新连接! 今天,您可以关闭并重新连接以更改分辨率,但是我希望像Windows 7/8/10 VM Client窗口一样调整Ubuntu窗口的大小。
The feature "Dynamic resolution update" was introduced in RDP 8.1. It enables to resize screen resolution on-the-fly.
RDP 8.1中引入了“动态分辨率更新”功能。 它可以即时调整屏幕分辨率的大小。
Since we are using xrdp and that's open source over https://github.com/neutrinolabs/xrdp/ AND there's even a issue about this AND a lovely person has the code in their own branch and agreed to possibly upstream it maybe we can start using it and this great feature will just light up for folks who use Hyper-V Quick Create. Certainly we're talking weeks and months here (unless you want to help) but the lion's share of the work is done. I'm looking forward to resizing Ubuntu VMs dynamically.
由于我们使用的是xrdp,并且是通过https://github.com/neutrinolabs/xrdp/开放的源代码,因此甚至存在一个问题,一个可爱的人在自己的分支中拥有代码,并同意在上游进行开发,也许我们可以开始使用它,这项功能非常强大,只会为使用Hyper-V Quick Create的人们点亮。 当然,我们在这里谈论了数周和数月的时间(除非您想提供帮助),但是大部分工作已经完成。 我期待动态调整Ubuntu VM的大小。
今天处于增强模式下是什么? (What's in Enhanced Mode Today?)
Back to today! You can read about how Linux VMs (Ubuntu or Arch) are set up in this GitHub repo https://github.com/Microsoft/linux-vm-tools You can set them up yourself with scripts, but the nice thing about Hyper-V Quick Create is that the work is done for us to make these "enhanced session" RDP-friendly VMs. No need to fear, you can just read the scripts yourself.
回到今天! 您可以在此GitHub存储库中了解有关如何设置Linux VM(Ubuntu或Arch)的信息。https://github.com/Microsoft/linux-vm-tools您可以使用脚本自行设置它们,但是关于Hyper- V Quick Create的工作是为我们制作这些“增强的会话”,对RDP友好的VM。 不用担心,您可以自己阅读脚本。
I can connect quickly and Enhanced Mode VMs give me:
我可以快速连接,增强模式VM可以为我提供:
-
a shared clipboard
共享剪贴板
-
the resolution of my choice on connect
我选择的连接分辨率
-
fast painting/video/scrolling
快速绘画/视频/滚动
-
automatic shared-drives
自动共享驱动器
-
Smooth and automatic mouse capture
流畅,自动的鼠标捕获
Fantastic.
太棒了
What about installing Visual Studio Code? Of course. And also .NET Core.NET Core, natch.
如何安装Visual Studio Code ? 当然。 还有.NET Core .NET Core,natch。
This took like 10 min and 8 of it was waiting for Hyper-V Create to download Ubuntu. Try it out!
这大约花了10分钟,其中8分钟正在等待Hyper-V Create下载Ubuntu。 试试看!
Sponsor: Check out the latest JetBrains Rider with built-in spell checking, enhanced debugger, Docker support, full C# 7.3 support, publishing to IIS and more advanced Unity support.
赞助商:使用内置的拼写检查,增强的调试器,Docker支持,完整的C#7.3支持,发布到IIS和更高级的Unity支持,查看最新的JetBrains Rider 。
关于斯科特 (About Scott)
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
斯科特·汉塞尔曼(Scott Hanselman)是前教授,前金融首席架构师,现在是演讲者,顾问,父亲,糖尿病患者和Microsoft员工。 他是一位失败的单口相声漫画家,一个玉米种植者和一本书的作者。
翻译自: https://www.hanselman.com/blog/using-enhanced-mode-ubuntu-1804-for-hyperv-on-windows-10