Before doing anything else, install those:
- VirtualBox: https://www.virtualbox.org/wiki/Downloads
- Vagrant: https://www.vagrantup.com/downloads.html
- git: http://git-scm.com/download/win
Open cmd: Start > type cmd > ENTER
cd C:\path\to\your\vagrant+meteor\project\folder
mkdir shared
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)vagrant init ubuntu/trusty32
(Ubuntu 14.04 32bit - useubuntu/trusty64
for x64)- 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
- Create a new file named mtimv inside the new "shared" folder created on step #2. The contents of the file can be found in below or using the following link: https://gist.github.com/gabrieljenik/d926cbb90706d95abdee#file-mtimv
vagrant up
vagrant ssh
Now that you are inside the VM command-line:
sudo apt-get install curl git
curl https://install.meteor.com | sh
chmod +x ~/shared/mtimv
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. This also applies when you clone an app from git.
Below 2 recipes are given to perform the steps described below.
- (
cd ~/shared
) - Create an app. Example:
meteor create --example leaderboard
- Run mtimv:
./mtimv leaderboard
The app will be automatically launched.
Next time you want to launch it, just follow these steps:
- (
cd ~/shared/leaderboard
) - Run ./mt.sh
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.
To create the app:
- (
cd ~/shared
) meteor create --example leaderboard
To move and mount .meteor directory:
3. cd leaderboard
4. mkdir -p ~/mock/leaderboard
5. mv .meteor ~/mock/leaderboard
6. mkdir .meteor
To launch the app
7. cd leaderboard
8. sudo mount --bind /home/vagrant/mock/leaderboard/.meteor .meteor
9. meteor
(finally!)
10. Go to http://localhost:3000
in Windows browser!
- 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
Thanks for this! It helped. At first I couldn't get mtimv to work:
Turns out that Windows inserted carriage returns when I copy/pasted the file. Instead I just ran
wget https://gist.githubusercontent.com/gabrieljenik/d926cbb90706d95abdee/raw/85a03ac12e013656bf7e01b2ba95a8a4fd1c1475/mtimv
from my ~/shared directory. It works great.