Cygwin 与 Linux 虚拟机进行开发?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9778218/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cygwin vs Linux Virtual Machine for Development?
提问by erictheavg
< skippable part >
<可跳过的部分>
I work in IT (mostly desktop support and network administration) in a Windows environment, and I occasionally program.
我在 Windows 环境中从事 IT(主要是桌面支持和网络管理)工作,偶尔会编程。
A couple weeks ago, I decided I couldn't be as effective as I want to be without a Bash environment for my command prompt needs. This is especially true when I am using Ruby and git. I used Msysgit for a while, but I just didn't like how it wasn't extensible like Linux. So, I installed Cygwin and played around with that for a couple weeks.
几周前,我决定如果没有 Bash 环境来满足我的命令提示符需求,我就不能像我想要的那样有效。当我使用 Ruby 和 git 时尤其如此。我使用了一段时间 Msysgit,但我只是不喜欢它不像 Linux 那样可扩展。所以,我安装了 Cygwin 并玩了几个星期。
As great as Cygwin is, it seems like it is meant to be a suped up command prompt, and its compatibility with Linux is just a pleasant side effect. This especially became evident when I tried to upgrade Ruby to 1.9.3 (it worked, but it wasn't straightforward), install rvm (never worked), and install RMagick (may or may not work, but looks like a headache).
尽管 Cygwin 很棒,但它似乎是一个增强的命令提示符,它与 Linux 的兼容性只是一个令人愉快的副作用。当我尝试将 Ruby 升级到 1.9.3(它有效,但并不简单)、安装 rvm(从未有效)和安装 RMagick(可能会也可能不会起作用,但看起来很头疼)时,这一点尤其明显。
So, now I'm considering running Linux in a virtual machine. But I'm worried that might be another can of worms and I'll have wasted hours before I find that out. I like that Cygwin runs in Windows and I get to use my IDE, user folder, and more with it. But I don't like that support for it is not as thorough as for a major distro.
所以,现在我正在考虑在虚拟机中运行 Linux。但我担心这可能是另一罐蠕虫,在我发现之前我会浪费几个小时。我喜欢 Cygwin 在 Windows 中运行,我可以使用我的 IDE、用户文件夹等。但我不喜欢这种支持,因为它不像主要发行版那样彻底。
< /skippable part >
< /可跳过部分>
- Does anyone here have insight on using Cygwin vs running a Linux virtual machine?
- Any advice on setting up a Linux development environment in a virtual machine within Windows?
- 这里有没有人对使用 Cygwin 与运行 Linux 虚拟机有所了解?
- 关于在 Windows 中的虚拟机中设置 Linux 开发环境的任何建议?
采纳答案by hovanessyan
I have faced common issues before, and the best solution according to my experience is just 2 workstations :).
我以前遇到过常见问题,根据我的经验,最好的解决方案是只有 2 个工作站:)。
Apart from that having Linux running in a virtual environment is way better. First of all, you will have full Linux capabilities (except 3d acceleration, but you probably don't need that). You will have the capability of creating snapshots and revert back to them when things go wrong! You can start multiple environment using templates, which is very convenient.
除此之外,让 Linux 在虚拟环境中运行会更好。首先,您将拥有完整的 Linux 功能(3d 加速除外,但您可能不需要)。您将能够创建快照并在出现问题时恢复到它们!您可以使用模板启动多个环境,非常方便。
The only downfall I can think of is performance issues of the host machine. If it's a normal workstation/PC, an IDE + one virtual machine + a 100+tabs browser just makes it slow.
我能想到的唯一缺点是主机的性能问题。如果它是一台普通的工作站/PC,一个 IDE + 一个虚拟机 + 一个 100 多个标签的浏览器只会让它变慢。
回答by Dean Perry
If you're going to be working with Ruby then get an Ubuntu virtual machine up and running :) I've not tried Ruby, etc on Windows but I have heard that it is a pain to setup and configure. I use a Mac for all my Rails development so I cannot comment on the Windows side for that.
如果您打算使用 Ruby,那么请启动并运行 Ubuntu 虚拟机 :) 我没有在 Windows 上尝试过 Ruby 等,但我听说设置和配置很麻烦。我使用 Mac 进行所有 Rails 开发,因此我无法在 Windows 方面对此发表评论。
As for virtual machine creation, I prefer VMware Workstation, however there are free alternatives such as Virtualbox and VMware Server.
至于创建虚拟机,我更喜欢 VMware Workstation,不过也有免费的替代品,例如 Virtualbox 和 VMware Server。
回答by ncremins
Linux in a virtual machine will give you the experience you want more than cygwin or any mock shell as I like to call them.
虚拟机中的 Linux 将为您提供您想要的体验,而不仅仅是 cygwin 或我喜欢称之为的任何模拟 shell。
Running VM's though require a lot of ram depending on whether you want a desktop version of linux or just a command line version.
运行虚拟机虽然需要大量内存,具体取决于您是想要 Linux 的桌面版本还是命令行版本。
Myself in work I have a pc with 8gb of ram and I run ubuntu 64bit as main OS, two ubuntu servers (these are for dev environments two different projects) and a windows 7 VM and a win XP VM.
我自己在工作,我有一台 8gb 内存的电脑,我运行 64 位 ubuntu 作为主操作系统,两台 ubuntu 服务器(这些是用于开发环境的两个不同项目)和一个 Windows 7 VM 和一个 win XP VM。
I can run the two ubuntu servers and one other VM at the same time, key here is more ram if you want to be able to do VM's.
我可以同时运行两台 ubuntu 服务器和另一台虚拟机,如果你想运行虚拟机,这里的关键是更多的内存。
回答by Quamis
1: cygwin is good for quick hacks, and for being able to acces host-os resources(you can run IE for example in a bash script). For something tightly integrated and some "real" word, go to a vm. It will emulate everything and separate development from the real machine, and this may be a good thing in some cases... as a plus it simulates a real server:)
1:cygwin 非常适合快速破解,并且能够访问主机操作系统资源(例如,您可以在 bash 脚本中运行 IE)。对于紧密集成的东西和一些“真实”的词,去一个虚拟机。它将模拟一切并将开发与真实机器分开,在某些情况下这可能是一件好事......作为一个加号,它模拟了一个真实的服务器:)
2: in virtualbox at least, you have shared folders, and you can share a local folder, and see it in the vm as a local folder(local or as a windows share..it actually depends). Then you can use that "entry point" to symlink stuff into the vm, and do the things you need with the real files being located in the real(host) machine
2:至少在virtualbox中,你有共享文件夹,你可以共享一个本地文件夹,并在vm中将其视为本地文件夹(本地或作为Windows共享......实际上取决于)。然后您可以使用该“入口点”将内容符号链接到虚拟机中,并使用位于真实(主机)机器中的真实文件执行您需要的操作
回答by Linuxios
There is something I have heard of called Cooperative Linux. It runs Linux alongside with Windows kernel so you can use them at the same time. I've never used it, but here: http://www.colinux.org/
我听说过一种叫做 Cooperative Linux 的东西。它与 Windows 内核一起运行 Linux,因此您可以同时使用它们。我从未使用过它,但在这里:http: //www.colinux.org/
回答by hornetbzz
I'm using a Linux VM within a Windows seven environment as this VM is as representative as possible of the final production environment. The whole setup is binded to the Eclipse IDE under ms-Windows seven. So this is really great for local full testing, before committing or tagging the tested version to the production servers.
我在 Windows 7 环境中使用 Linux VM,因为该 VM 尽可能代表最终生产环境。整个设置绑定到 ms-Windows 7 下的 Eclipse IDE。因此,在将测试版本提交或标记到生产服务器之前,这对于本地完整测试非常有用。
As you mentioned as well, this takes some time to get properly setup and fully configured. So if your need is only for little tricks or tasks, you may keep using cygwin
. For example, I faced significant issues to configure perl
and compile mysql
within cygwin
. So it's ok for basic usages, but not to fully take advantage of a full linux environment.
正如您所提到的,这需要一些时间才能正确设置和完全配置。因此,如果您只需要小技巧或任务,您可以继续使用cygwin
. 例如,我面对配置显著的问题perl
和编译mysql
内cygwin
。所以基本用法是可以的,但不能充分利用完整的 linux 环境。
Your choice strongly depends on the final server setup purpose. A VM will do it whatever your need is. The setup cost for it is higher, so this time investment must be used often to get returned.
您的选择很大程度上取决于最终的服务器设置目的。无论您需要什么,VM 都会完成它。它的设置成本较高,因此必须经常使用这次投资才能获得回报。
回答by Bassem Reda Zohdy
What I think now is getting the pros of 2 options is using Docker, it is giving you cygwin simplicity and VM functionality with better performance.
我认为现在获得 2 个选项的优点是使用 Docker,它为您提供 cygwin 简单性和具有更好性能的 VM 功能。
回答by SwimBikeRun
SSH into a linux box. This is what everyone does. Why isn't this the answer?
SSH 进入一个 linux 机器。这就是每个人所做的。为什么这不是答案?