Creating a M.E.A.N. Vagrant Virtual Development Environment
Vagrant is open-source software used to create lightweight and portable virtual development environments. Vagrant works like a "wrapper" for VirtualBox that can create, configure, and destroy virtual machines with the use of its own terminal commands. Vagrant facilitates the setup of environments without any direct interaction with VirtualBox and allows developers to use preferred editors and browsers in their native operating system. This blog describes a typical workflow using Vagrant in a development environment.
MEAN is a boilerplate that provides a nice starting point for MongoDB, Node.js, Express, and AngularJS based applications. It is designed to give you quick and organized way to start developing of MEAN based web apps with useful modules like mongoose and passport pre-bundled and configured. We mainly try to take care of the connection points between existing popular frameworks and solve common integration problems.
- Download Git for Windows:
- Run the installer and "next" through the wizard until the step to adjust your PATH environment.
- Choose the third option, "Run Git and included tools from within the Windows Command prompt"
- Important: On the next step, "Configuring the line ending conversions", choose the second option: "Checkout as-is, commit Unix-style line endings".
- Choose "next" through any additional steps to complete the Git for Windows install.
- Open the Windows Command Prompt as Administrator
Get the Code
Clone your forks of the
mean repositories to a directory on your host machine:
git clone https://github.com/<username>/mean.git git clone --recursive https://github.com/<username>/mean-vagrant.git
Change directory to your
cd into the mean-vagrant directory, you will find a "Vagrantfile" which will provide
the necessary instructions and provisioning to setup your MEAN virtual machine. All Vagrant commands
should be performed in this directory with your Vagrantfile.
Note: In the
Vagrantfile, ensure that the
source variable to matches a path of the cloned Mean source code
relative to the Vagrantfile:
source = "../mean"
Install VirtualBox Guest Additions Plugin
vagrant plugin install vagrant-vbguest
Connect to the Virtual Machine
Start the virtual machine:
Connect to the virtual machine via ssh:
- The MEAN source code is synced to the folder
Start the Mean server using grunt:
cd mean grunt
Launch your local browser and navigate to