Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 26 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save ahoereth/2607d2ee99103a0a9bc9 to your computer and use it in GitHub Desktop.
Save ahoereth/2607d2ee99103a0a9bc9 to your computer and use it in GitHub Desktop.

Tutorial: Meteor on Windows using Vagrant

Requirements

Before doing anything else, install those:

Steps on Windows command-line:

Open cmd: Start > type cmd > ENTER

  1. cd C:\path\to\your\vagrant+meteor\project\folder
  2. mkdir shared
  3. set PATH=%PATH%;C:\Program Files (x86)\Git\bin (Append git binaries to path so vagrant can run ssh - you should add git to your PATH environmental variable permanently so you don't have to run this everytime)
  4. vagrant init ubuntu/trusty32 (Ubuntu 14.04 32bit - use ubuntu/trusty64 for x64)
  5. Edit the Vagrantfile and add the following inside the Vagrant.configure(...) block:
    config.vm.synced_folder './shared', '/home/vagrant/shared'
    
    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
    
  6. vagrant up
  7. vagrant ssh

Now that you are inside the VM command-line:

Steps on Ubuntu command-line:

  1. sudo apt-get install curl git
  2. curl https://install.meteor.com | sh

Creating an app

This also applies when you clone an app from git. The idea is to move the .meteor folder out of the shared directory and link it back in. MongoDB cannot run in the shared folder because of permission problems. Create all apps in the ~/shared folder to make their code available to the Windows host.

  1. (cd ~/shared)
  2. meteor create --example leaderboard
  3. cd leaderboard
  4. mkdir -p ~/mock/leaderboard
  5. mv .meteor ~/mock/leaderboard
  6. mkdir .meteor
  7. sudo mount --bind /home/vagrant/mock/leaderboard/.meteor .meteor
  8. meteor (finally!)

Go to http://localhost:3000 in Windows browser!

Hints:

  • Make sure you do version control INSIDE THE VM, so the software can follow the mounted .meteor directory.
  • You will have to remount (step 7 above) the .meteor directory on every vagrant restart. Mount the directory before you do any version control!
  • To halt a vagrant VM: vagrant halt
  • To destroy a VM: vagrant destroy
  • You might want to run sudo apt-get update in the VM to install the latest Ubuntu security updates

Original tutorial by @gabrielsapo

@dmalik
Copy link

dmalik commented Oct 30, 2014

Thanks for this.

@alysdal
Copy link

alysdal commented Nov 1, 2014

I needed this, thank you.

@Yathushan
Copy link

Hi there I get to step 5 and after editing the config section of the vagrant file, I am still unable to vagrant up. It keeps informing me that my provider "hyper-v" is not supported by trusty 64, which makes sense because this is what is listed in the vagrant cloud.

I am not sure where I am going wrong. Any help would be much appreciated. Thanks

@fongandrew
Copy link

@Yathushan, you want to use VirtualBox for your provider, not Hyper-V. If you have already installed VirtualBox, you may also need to change your default provider to VirtualBox (see https://docs.vagrantup.com/v2/providers/default.html) or manually specify the VirtualBox provider by adding --provider=virtualbox to the relevant command.

Note that if you're on Windows 8.1, you may have to disable Hyper-V in order for VirtualBox to work: See https://docs.vagrantup.com/v2/hyperv/index.html.

@Yathushan
Copy link

@fongandrew

Thank you very much. I just modified the vagrantfile with ENV['VAGRANT_DEFAULT_PROVIDER'] = 'virtualbox' and then after had to modify the base.rb file with regards to a file path and it all worked out fine.

@teadrinker
Copy link

Hello, thank you a lot, this worked for me!

Hmm, but how to proceed, I tried messing around with the example, but how do I refresh the app from the server?
The commandline is stuck and does not seem to take any additional commands after (8), ctrl-Z works, and it says "Stopped meteor", however running it again gives me:

Can't listen on port 3000. Perhaps another Meteor is running?

While I can use "ps -x | grep meteor" and "kill -s KILL ..." to get rid of the leftovers, I quite certain I am missing something here concerning refreshing the app from the sources...

EDIT, SOLVED!
Turns out this is a basic Linux Bash thing: ctrl-z just pauses the program, ctrl-c is the one to use!
I did play with linux before, but I guess 15 years has clouded those memories...

@dotnetwise
Copy link

nfs without dedicated ip does not seem to actually work -> see this comment
https://gist.github.com/gabrielhpugliese/5855677#comment-1315481

@ahoereth
Copy link
Author

ahoereth commented Nov 4, 2014

Mhh nfs worked for me - at least it does not give me any error. Removed it for now, will test it later.

@DiegoAz
Copy link

DiegoAz commented Dec 5, 2014

Hi.Thanks, this worked for me.

@gabrieljenik
Copy link

Please, find an updated version here.
https://gist.github.com/gabrieljenik/d926cbb90706d95abdee

Pull request work too for gists?

@gabrieljenik
Copy link

Has anybody tried to install android mobile platform on the vagrant environment?

@elGusto
Copy link

elGusto commented Jan 13, 2015

@gabrieljenik

I did and it works just perfect. I just spent a little while figuring out how to let VB capture the usb port and let adb recognize the device.

@PanArnaud
Copy link

It was very useful ! Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment