在 Windows 上运行 Ruby/Rails 的限制
在 RoR 的安装文档中,它提到在 Windows 上运行 Ruby on Rails 有很多限制,并且在某些情况下,整个库都不起作用。
这些限制有多严重?我是否应该始终默认使用 Linux 来编码/运行 RoR?Iron Ruby 是否有望修复这些限制,或者它们是操作系统本身的核心?
编辑感谢您在 Linux 上安装和运行的答案,但我真的很想了解安装文档和非工作库中引用的功能限制 -我试图找到评论的链接,但在安装 msi 软件包时在安装读我中引用了它,我认为
编辑 感谢您最近对 IronRuby 的引用,它无疑是一个值得关注的项目,并且显然,由于它是一种 .NET 语言,因此如果它能够兑现承诺,那么它将是无价的。 但最终,就我而言,我还是硬着头皮安装了 Ubuntu 服务器。
<偏差> 我几年前就应该这么做
In the installation documentation to RoR it mentions that there are many limitations to running Ruby on Rails on Windows, and in some cases, whole libraries do not work.
How bad are these limitations, should I always default to Linux to code / run RoR, and is Iron Ruby expected to fix these limitations or are they core to the OS itself?
EDIT Thanks for the answer around installation and running on Linux, but I am really trying to understand the limitations in functionality as referenced in the installation documentation, and non-working libraries - I am trying to find a link to the comment, but it was referenced in an installation read me when I installed the msi package I think
EDIT
Thanks for the references to IronRuby lately, it is certainly a project to watch, and as it, obviously, is a .NET language, it will be invaluable if it lives up to the promises. Eventually, however, in my case, I just bit the bullet and installed an Ubuntu server.
<bias> I should've done it years ago </bias>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(16)
就我个人而言,我发现在 Windows 上安装 Ruby + Rails 并运行是小菜一碟。 从下载到浏览,再到我的第一个“HelloWorld”应用程序,我花了 15 分钟。 我什至没有理会任何 InstantRails 的东西。
随后,我不能说我遇到了任何报告的速度问题或 Windows 下的 Gems 问题。
这些人还为 Visual Studio 做了一个很好的 Ruby 开发人员添加:
http://www.sapphiresteel.com/
Personally I found getting Ruby + Rails up and running on windows a piece of cake. From download to browsing to my first 'HelloWorld' app took me all of 15 minutes. I didn't even bother with any of the InstantRails stuff.
Subsequently I can't say I encountered any of the reported speed problems or issues with Gems under Windows.
These guys also do a nice Ruby developers add on for Visual Studio:
http://www.sapphiresteel.com/
当我上次在 Windows 上摆弄 Rails 时,我使用了 Instant Rails,发现这是一个相当痛苦的过程,除了 Instant Rails 缺乏更新(从网站的外观来看,这仍然是一个小问题) ,因为即时 Rails 2.0 使用 ROR 2.0,而最新版本是 2.1)。 您还可以查看 这个问题,因为它提到了许多其他方法可以让 RoR 在 Windows 上轻松运行。
When I last fiddled around with Rails on windows, I used Instant Rails and found it to be a fairly painful process, except for the lack of updates to Instant Rails (which, from the look of the website is still a little bit of a problem, as instant Rails 2.0 uses ROR 2.0, while the newest version is 2.1). You might also look into the answers to this question as it mentions a number of other ways to get RoR running on windows easily.
您可以使用 Windows 选项来启动和安装所有内容,例如 Instantrails:
但是,我的尝试让同事在 Windows 上启动并运行的个人经验是,这是一次非常痛苦的经历。 您应该能够让大部分(如果不是全部)运行,但要准备好花一些时间搞砸(并感到沮丧)。
YMMV
我可能会推荐 Linux 或 Mac 进行 Rails 开发(但我对 Windows 略有偏见,所以你可能需要对此持保留态度)。
You have windows options for getting everything up and installed, such as Instantrails:
However, my personal experience with trying to get colleagues up and running on windows is that it's a pretty painful experience. You should be able to get most (if not everything) running, but be prepared to spend a bit of time mucking round (and getting frustrated).
YMMV
I would probably recommend either Linux or Mac for rails development (but I'm slightly biased against windows, so you may need to take that with a grain of salt).
如果您被 Windows 困住,一个选择是让虚拟服务器运行 Linux/BSD/what-have-you。
它还解决了许多其他问题(允许您轻松尝试多个服务器配置等)。
An option if you're stuck on Windows is to have virtual servers running Linux / BSD / what-have-you.
It solves lots of other problems also (allowing you to try multiple server configurations easily, etc.).
如果您无法摆脱 Windows,请使用 VMware 并运行某种形式的 Linux(ubuntu 很流行)。 你的第一大限制是编译的 gems,它们在 Windows 上不能很好地运行。
大多数教程都假设您处于某种形式的 *nix 状态,当您开始突破基本脚手架时,您就会感到痛苦。 图像处理、全文搜索甚至某些数据库适配器要么只能在 *nix 上运行,要么设置起来很麻烦。
大多数网络主机也运行 Linux,最好在与主机相同的平台上进行开发,以避免部署麻烦。
If you can't get away from windows use VMware and run some form of linux (ubuntu is popular). Your No.1 limitation will be compiled gems which do not play nicely on windows.
The majority of tutorials assume you're on some form of *nix, it's when you start to break outside of basic scaffolding when you'll feel the pain. Image manipulation, full-text search and even some db adapters will either only run on *nix or are a pain to setup.
The majority of web hosts run linux too, it's good to be developing on the same platform as your host, to avoid deployment headaches.
一般来说,Rails 性能在 Windows 上是一个问题。
就您的部署设置而言,您可以在 FCGI 中运行 Rails 或使用 mongrel(并设置 Apache 或 IIS 作为代理)。 mod_rails (http://www.modrails.com) 是当今 Rails 的最佳部署选项,但并非如此不能在 Windows 上运行。
您可能会发现在 Windows 上使用 JRuby 在您想要的任何 JVM 环境(tomcat、J2EE 服务器等)中运行 Rails 会更幸运。
IronRuby 还不能在生产环境中运行 Rails,但最终它的目标是在任何 ASP.NET 环境 (IIS) 中运行 Rails。
In general, Rails performance is a problem on Windows.
As far as your deployment setup, you can either run Rails in FCGI or use mongrel (and set up either Apache or IIS as a proxy). mod_rails (http://www.modrails.com) is the best deployment option for Rails today, but doesn't run on Windows.
You might find more luck using JRuby on Windows to run Rails in whatever JVM environment you want (tomcat, J2EE server, etc).
IronRuby isn't there yet to run Rails in a production environment, but eventually it will be aimed at running Rails inside any ASP.NET environment (IIS).
您可以只使用 Cygwin 及其 Ruby 版本。 这消除了有关编译的 gem 无法在 Windows 上运行的争论 - 我已经成功地以这种方式编译了很多 gem。
You could just use Cygwin and it's version of Ruby. That gets rid of the arguments about compiled gems not working on Windows - I've managed to compile a lot of gems that way.
在Windows下运行的最大限制是很多东西都超级慢。
请参阅此帖子。 供讨论。
像“脚本/控制台”和运行 rake 任务这样的简单事情在 Windows 上花费的时间是 Linux 或 Mac 上的 5 倍。
其他限制包括:
The biggest limitation of running under Windows is that a lot of things are super slow.
See this thread. For a discussion.
Simple things like "script/console" and running rake tasks will take 5 times longer on Windows than they do on Linux or Mac.
Other limitations are:
我自己不是 Rails 开发人员,但我认为这可能很有趣。 Microsoft 发布了 IronRuby 1.0,它是在 .NET 平台上运行的 Ruby 版本,运行速度明显比 Windows 上的官方 Rails 实现快 4 倍。
http://www.drdobbs.com/open-source/224600662
官方网站
http://ironruby.codeplex.com/
I'm not a rails developer myself but I thought this may be of interest. Microsoft has released IronRuby 1.0, it's a version of Ruby that runs on the .NET platform that apparently runs 4x faster than the official Rails implementation on Windows.
http://www.drdobbs.com/open-source/224600662
Official site
http://ironruby.codeplex.com/
为了加速,你可以尝试我的加载器加速器上部(帮助rails在打瞌睡时运行得更快):https://github.com/ rdp/faster_require
还可以检查 spork,它在打瞌睡时也能工作
For a speedup you could try my loader speeder upper (helps rails run faster in doze): https://github.com/rdp/faster_require
Also checkout spork, which works in doze
RailsIntaller 的替代方案是 RailsFTW。 红宝石与 轨道更加更新。
Alternative of RailsIntaller is RailsFTW. The Ruby & Rails are more updated.
以下是 Windows 上 Rails 当前问题的概述:
注意由于 RubyInstaller 团队在为 Ruby 带来稳定性、兼容性和性能方面所做的巨大努力,下面的大部分建议现在已经过时了在 Windows 上。 我不再需要使用 VirtualBox,它充分说明了 Windows 上的 Ruby 已经取得了多大的进步。
如果您想了解更多技术细节,则需要阅读以下内容。 :
最后一篇的选择引用是:
说了这么多,我并不觉得在 Windows 上使用 Rails 进行开发太痛苦。 在大多数情况下,使用 Ruby 是一种乐趣。 我会避免使用 InstantRails,因为坦率地说,使用一键安装程序正确安装 Ruby,然后执行
gem install Rails
一样容易。 如果您需要 Apache 和 MySQL,WAMP 是一个不错的选择,尽管如果您坚持使用这些也不是必需的杂种和 SQLite。我最近所做的就是使用一个与部署服务器密切镜像的 Ubuntu Server 实例来运行 VirtualBox。 我将网络驱动器映射到 Ubuntu 服务器,然后直接在虚拟机上编辑并运行代码。 它几乎不使用任何内存(目前使用约 43MB;与 Firefox 相比,使用约 230MB)并且 Rails 实际上比在 Windows 上本地运行它的性能更好。 另外,您可以相对安全地试验虚拟服务器。 这是一个非常好的设置,我强烈推荐它。
最后,这里有一些针对 Windows 用户的 Ruby/Rails 博客:
Here's an overview of the current issues with Rails on Windows:
Note much of the advice that follows is now outdated due to the magnificent efforts of the RubyInstaller team in bringing stability, compatibility and performance to Ruby on Windows. I no longer have to use VirtualBox, which says a lot about how far Ruby on Windows has come.
If you want more technical detail, the following are required reading. :
Choice quote from that last one is:
Having said all that, I don't find developing with Rails on Windows too painful. Using Ruby is, for the most part, a pleasure. I'd avoid InstantRails because, to be frank, it's just as easy to install Ruby properly using the one-click installer, then doing a
gem install rails
. If you need Apache and MySQL, WAMP is a good bet, although even these aren't required if you just stick with Mongrel and SQLite.What I've taken to doing recently is running VirtualBox with an instance of Ubuntu Server that closely mirrors the deployment server. I map a network drive to the Ubuntu Server, then I edit and run my code directly on the VM. It uses hardly any memory (it's currently using ~43MB; contrast that with Firefox, which is using ~230MB) and Rails actually performs better than running it natively on Windows. Plus you can experiment with your virtual server in relative safety. It's a really nice setup, I highly recommend it.
Finally, here are a couple of Ruby/Rails blogs aimed at Windows users:
我发现在 Windows 上使用 Instant Rails 建立并运行开发环境非常简单。 特别是在使用 Netbeans 或 Radrails 作为 IDE。
不到10分钟的工作。
那些挣扎的人发现问题是什么?
I found getting a development environment up and running with Instant Rails on Windows was really simple. Especially when using Netbeans or Radrails as the IDE.
Less than a 10 minute job.
What did those who struggled find to be the problem?
我在 Windows PC 上开发 Rails 已经有几年了,并且在我第一次开始安装时没有遇到任何真正的问题。 然而,我最近重新构建了我的机器,并努力让一键式 Ruby 安装程序正常工作并获得最新版本的 Gems。 这就是我尝试过的。
选项 1:运行 Linux 虚拟机
Charles Roper 在 Linux 虚拟机中运行 Rails 的想法给我留下了深刻的印象,这也是我最初选择的路线。 一切都很顺利,我一直在 budanters.blogspot.com 上记录它。 然而,我一直在努力从 Windows 主机访问 MySQL 服务器(在 Linux 虚拟机中)。
选项 2:使用 jRuby
我最近安装了 Windows 版本的 NetBeans 6.5 Ruby 捆绑包,并且在不知不觉中,这会安装 JRuby 和 Rails gem。 IDE 有一个用于安装 Gems 的 UI,现在我已经备份了旧应用程序并在我的开发环境中运行。
2009 年 11 月更新
我现在在 Windows 上使用 Netbeans 6.7,总的来说我对它非常满意。 唯一的缺点是它安装了 JRuby 1.2,而我需要手动安装 JRuby 1.3 才能让某些东西正常工作(我不记得是什么),而且我完全无法使用 Capistrano 或 Vlad 部署程序进行部署。 Vlad 使用 Open4 不支持 JRuby。
2010 年 5 月更新
Netbeans 6.8 附带 JRuby 1.4,因此不再需要手动安装 JRuby 1.3。 另外,似乎在 JRuby 1.5 中 Open4 现在可以工作,这意味着 Vlad 可能会开始工作。
I've been developing Rails on a Windows PC for a couple of years and had no real problems installing back when I first started. However I recently re-built my machine and struggled to get the One-Click Ruby installer working and the latest version of Gems. So this is what I tried.
Option 1: Run a Linux Virtual Machine
I was really impressed with Charles Roper's idea of running Rails within a Linux virtual machine, and this is the route I intially went for. It all went pretty smoothly and I've been documenting it at budanters.blogspot.com. However I've been struggling with accessing the MySQL server (in Linux Virtual Machine) from the Windows host.
Option 2: Use jRuby
I recently installed the Windows version of NetBeans 6.5 Ruby bundle, and without being aware of it, this installs JRuby and the Rails gems. The IDE has a UI to install Gems, and I've now got my old application back up and running in my development enviromnent.
Update November 2009
I now use Netbeans 6.7 on Windows and in the whole I am very happy with it. The only downsides are that it installs JRuby 1.2, and I needed to install JRuby 1.3 manually to get something working (I can't remember what) and I have been completely unable to get deployment working with either Capistrano or Vlad the Deployer to work. Vlad uses Open4 which doesn't work with JRuby.
Update May 2010
Netbeans 6.8 comes with JRuby 1.4 so no longer have to fiddle around with manually installing JRuby 1.3. Also it seems that in JRuby 1.5 Open4 will now work, which means Vlad might start working.
还没有人提到 Bitnami RubyStack 吗? 我已经将它与 RadRails 一起使用多年了。 包括 Apache、MySQL/Postgre、phpmyadmin、git 等。可选 Ruby 1.9.2/Rails 3.0b。 您还可以在虚拟机中运行 Ubuntu 风格的 RubyStack,但我还没有尝试过。
Nobody mentioned Bitnami RubyStack yet? I've been using it for years, together with RadRails. Includes Apache, MySQL/Postgre, phpmyadmin, git etc. Optional Ruby 1.9.2/Rails 3.0b. You may also run the Ubuntu flavor of RubyStack in a VM but I haven't tried that yet.
http://railsinstaller.org/ 上有一个打包的安装程序,值得一试。
There is a packaged installer available at http://railsinstaller.org/ which is worth checking out.