Skip to content

Instantly share code, notes, and snippets.

@rcmiller
Last active August 29, 2015 14:01
Show Gist options
  • Save rcmiller/82b332ca046a42aeb163 to your computer and use it in GitHub Desktop.
Save rcmiller/82b332ca046a42aeb163 to your computer and use it in GitHub Desktop.
Vagrantfile for installing Meteor on Windows.
$script = <<SCRIPT
# install meteor packages
sudo apt-get update
sudo apt-get install -y python-software-properties
sudo add-apt-repository -y ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get remove -y node
sudo apt-get install -y git curl nodejs
curl https://install.meteor.com/ | sudo sh
sudo npm install -g meteorite
# Create a fixup script that moves .meteor folders
# from /vagrant (space synced between VM and host)
# to ~ (local VM space).
cat << 'EOF' > /vagrant/meteorfix
#!/bin/sh
safePlace=/home/vagrant/meteordata
for unhappyFolder in /vagrant/*/.meteor /vagrant/*/packages
do
sudo umount -l $unhappyFolder > /dev/null 2>&1
mkdir -p $safePlace$unhappyFolder/
find $unhappyFolder/ -mindepth 1 -maxdepth 1 -exec mv '{}' $safePlace$unhappyFolder/ ';'
sudo mount --bind $safePlace$unhappyFolder/ $unhappyFolder/
done
EOF
chmod a+x /vagrant/meteorfix
# run the fixup script everytime the vagrant user logs in
cat << 'EOF' >> /home/vagrant/.bashrc
/vagrant/meteorfix
cd /vagrant
EOF
SCRIPT
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "hashicorp/precise32"
config.vm.provision :shell, :inline => $script
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
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment