Thursday, January 5, 2012

Rails Virutalization

Rails virtualization for Windows 7 64-bit 


First off, a caveat, this will work for pretty much any system that can install jruby with a little tweaking.
I was attempting to follow engineyard's virtualization tutorial and ran into a bit of a snag.  It seems that vagrant doesn't play well with 64-bit windows systems (for now).  There is an easy solution however.
Steps
  1. Install java 64-bit and jruby 64 bit. (Note, you may need to add jruby to your path depending on what you did during install)
  2. Install vagrant  
    1. jgem install jruby-openssl jruby-win32ole
    2. jgem install vagrant
  3. Download and install Virtualbox.
  4. Download the enginyard rails setup or make your own. Unzip it to desired directory.
  5. Add the vagrant box using: vagrant box add [name] package.box  (make sure you're in the directory of the box you downloaded/made.
  6. Start vagrant : vagrant up
  7. Login to it: vagrant ssh
  8. You're done!

Some of you may wonder why you would ever go through the hassle.  Honestly, it's pretty easy to just set up a dedicated system for this.  The reason why I ended up using this solution was because I needed a way to do this sort of thing at work where I can't install anything (hence using the jar version of jruby) and at home my wife loves windows over linux.  Not sure what's wrong with Fedora, but for some reason she doesn't like it so we ended up in boot wars.  This mostly fixes the issue.  Not to mention I can share the environments very easily.

[Edit]
Depending on your setup you may encounter an issue where the vm won't start, you'll need to disable usb 2.0 on the machine or install the extras from Oracle.