Creating a Ruby on Rails Environment on Windows, in a Vm Vagrant Box

Creating a Ruby on Rails environment on Windows, in a VM Vagrant Box

Installing osx in Vagrant is probably possible but it would likely be quite hard, and its not really what vagrant is designed for.

As for your other questions vagrant sounds like the perfect fit.

With Vagrant you could start up an ubuntu vm and get your rails setup going. Then you could just forward a port on your local machine to the vm and load the rails site as if it were running locally on your windows PC. A quick google gets this vagrant box that looks like it might work for you - https://github.com/amaia/rails-starter-box

To work with the site you can just share a folder between the vm and your local machine which will allow you to edit images and code with your windows apps (Photoshop, sublime) so you don't actually need to install these in the ubuntu vm at all, and can pretty much work as normal.

Git is much the same... I prefer to SSH into the vagrant box and use git on the command line in ubuntu but you can just as easily use gitbash or tortoisegit from windows in the repo folder... works just as well.

Developing Ruby and Rails in Windows? Or Linux VM

You should also checkout the vagrant project which creates headless (non-gui) VMs and makes it easier to work with your files, etc in Windows while the code actually gets run on the Vagrant VM. Also, since its headless, the graphical UI isn't eating up resources and has less impact on your host machine.

Check out these resources:

http://www.vagrantup.com/

http://blog.dcxn.com/2013/07/12/introduction-to-vagrant-for-rails-developers/

http://railscasts.com/episodes/292-virtual-machines-with-vagrant

*Also if you're learning Rails, you MUST checkout Railscasts http://railscasts.com/

can't connect localhost:3000 ruby on rails in vagrant

The solution is running the code below to start your server:

rails s -b 0.0.0.0

I found this solution from another post about same problem.
The answerer said 'You'll want to make sure that the server is binded to 0.0.0.0 so that all interfaces can access it."

I hope this post helps people who encounter the same problem :)

Getting Rsync 3.0.9 to work on Vagrant VM box through Cygwin on windows 7

This turned out to be a bunch of brick-walls you have to circumvent when installing Rsync and setting it up correctly for Vagrant on Windows 7.

First of all, the error "rsync" could not be found on your PATH. Make sure that rsync is properly installed on your system and available on the PATH. was due to the fact that

1) Environment variable for Cygwin was placed in the latest order in the PATH, I changed it to the beginning of the path

2) During installation of Cygwin and Rsync, I installed individual "subpackages" instead of installing everything, thinking that it would be okay. Turns out I was wrong. I installed everything in the Admin package and Net package (not the SRC but just the bins), and then it started working. I suggest you set-up Cygwin again and really try to download everything if you see that error.
(I found these solutions through this post on SO cygwin + rsync)

Now, I could go into CMD and type rsync, and it would show up correctly. But then when I ran vagrant up it gave me another error saying

There was an error when attempting to rsync a synced folder. Please inspect the error message below for more info.

Host path: /c/Users/xxxxx Guest path: /vagrant
Command: rsync --verbose --archive --delete -z --copy-links
--chmod=ugo=rwX --no-perms --no-owner --no-group --rsync-path sudo rsync -e ssh -p 2222 -o StrictHostKeyCh
/c/Users/xxxx / vagrant@127.0.0.1:/vagrant
Error: cygwin warning: MS-DOS style path detected:
C:/Users/xxxxxxx Preferred POSIX
equivalent is:
/cygdrive/c/Users/xxxx CYGWIN
environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames Warning: Permanently added '[127.0.0.1]:2222' (ECDSA) to the list of
known hosts. rsync: change_dir "/c/Users/xxxxxxx"
failed: No such file or directory (2) rsync error: some files/attrs
were not transferred (see previous errors) (code 23) at
/usr/src/ports/rsync/rsync-3.0.9-1/src/rsync-3.0.9/main.c(1052)
[sender=3.0.9]

I googled solution to this error and found this site. https://github.com/mitchellh/vagrant/issues/3230

Then there's a bug with Vagrant and cwrsync that I mentioned in #3086.
For now, just edit
C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.5.1\plugins\synced_folders\rsync\helper.rb
and add hostpath = "/cygdrive" + hostpath to line 74. It's a terrible
solution but quick and simple.

Editing that helper.rb file and adding hostpath at line 74 (just made some blank lines right there and pasted it in) and now it works perfectly!!!!

Rsync makes the shared folder soooooo much faster on Rails!!!! I think it is worth the pain of setting it up correctly. Try it!!

Unable to start Rails in VM within Windows

rails server like any web server is meant to run as a persistent process. It sits there and waits for web requests - so the behavior you are seeing is actually exactly how it is supposed to work.

To exit the server (and most unix programs) you can send the terminate command with CTRL + C.

You can also run the server in the background in Bash by starting it with:

rails s &

You can then return it to the foreground with fg. Although I usually just open another shell window instead.

Ubuntu on VirtualBox and Rails server

By default, VirtualBox's NAT allows the virtual machine to access the Internet ; but doesn't allow the physical machine to access the Virtual one.


The simplest solution would be to use another networking setting than NAT, for your Virtual Machine -- for instance, bridge should work fine (your VM would be visible on your network, though).

Another solution would be to use port forwarding ; about that, this article might help : Howto Access via ssh a Virtualbox Guest machine.



Related Topics



Leave a reply



Submit