Tutorial for running Meteor in Windows using Vagrant
BEFORE YOU CONTINUE:
mrtis no longer used with Meteor 1.0
These days some people were discussing at meteor-talk group about running Meteor at Windows and I’ve recommended them using Vagrant. It’s a very developer-friendly piece of software that creates a virtual machine (VM) which let you run any operating system wanted and connect to it without big efforts of configuration (just make the initial installation and you have it working).
Many packages (I've tested) for running Meteor+Vagrant fails because Meteor writes its mongodb file and also other files inside local build folder into a shared folder between the Windows host and the Linux guest, and it simply does not work. So I've put my brain to work and found a solution: do symlinks inside the VM (but do not use ln. Use mount so git can follow it). It’s covered on steps 8 to 15.
If you have no idea what I’m talking about, I’ve made a tutorial to install Ubuntu Precise x86 through Windows command-line with Meteor very simple to follow:
set PATH=%PATH%;C:\Program Files (x86)\Git\bin(Append git binaries to path so vagrant can run ssh)
vagrant init precise32 http://files.vagrantup.com/precise32.box(To install Ubuntu 10.04 x86)
config.vm.provision :shell, :path => "meteor.sh" config.vm.network :forwarded_port, guest: 3000, host: 3000 config.vm.provider "virtualbox" do |v| v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"] end
vagrant up(It will download box, configure meteor and get it up)
vagrant ssh(It will connect on the VM and expose its command-line)
Now that you are inside the VM command-line, you can use it as your server:
cd /vagrant(This is by default shared with the host)
mrt create ~/meteorapp
mrt create meteorapp && cd meteorapp && rm -rf .meteor && mkdir .meteor/(Check your Windows folder you’ve created. It will be there!)
sudo mount --bind /home/vagrant/meteorapp/.meteor/ /vagrant/meteorapp/.meteor/ echo “sudo mount --bind /home/vagrant/meteorapp/.meteor/ /vagrant/meteorapp/.meteor/” >> ~/.bashrc && source ~/.bashrc mrt run
http://localhost:3000in Windows browser and see it running! :)
The point here is to use the
.meteor folder of your app pointing to another place inside the VM (run
ls -la .meteor/ on command-line and you will see the symbolic link), so Meteor uses the VM folder, not Windows folder, and won’t have permissions problems. You will also need to do all git flow inside Ubuntu command-line, because Windows can’t follow those links.
vagrant reload --no-provisionor just remove the shell path you’ve put on Vagrantfile on line 10.
That’s it. There's a project that does it automatically in win.meteor.com
Hope you like it,