Skip to content

Instantly share code, notes, and snippets.

@joserc87
Created May 30, 2017 11:45
Show Gist options
  • Save joserc87/722304795e684f0039acbf50b310d1ee to your computer and use it in GitHub Desktop.
Save joserc87/722304795e684f0039acbf50b310d1ee to your computer and use it in GitHub Desktop.
MEAN stack vagrant based on Ubuntu 16.04
#!/usr/bin/env bash
echo "Provision VM START"
echo "=========================================="
sudo apt-get update
#install nodejs
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get update
sudo apt-get install -y git python build-essential make nodejs
#install mongo db
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo apt-get update
#install base npm packages
sudo npm install -g bower
sudo npm install -g grunt-cli
sudo npm install -g express
sudo npm install -g yo
echo ""
echo "=========================================="
echo "Node setup:"
node -v
echo "Provision VM finished"
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# box to build virtual evironment to build off of.
config.vm.box = "ubuntu/xenial64"
# configurating the vm
config.vm.provider "virtualbox" do |v|
v.name = "node_hackathon_vm"
# max 75% CPU cap
v.customize ["modifyvm", :id, "--cpuexecutioncap", "75"]
# 4GB ram
v.memory = 4094
end
# run "bootstrap.sh" shell script when setting up our machine
config.vm.provision :shell, :privileged => false, :path => "bootstrap.sh"
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
config.vm.network :forwarded_port, guest: 3000, host: 3000
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network :private_network, ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network :public_network
# If true, then any SSH connections made will enable agent forwarding.
# Default value: false
# config.ssh.forward_agent = true
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "./data", "/vagrant_data", create: "true"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment