This Vagrant machine contains:
- Ubuntu 16.04
- Node.js
- MongoDB
Note
I have only tested this virtual machine using Windows 10 and Windows 7 as host machines
-
Install VirtualBox and Vagrant
-
Clone this repository
-
Run
vagrant up
in the folder that holds this repository -
Wait for the virtual machine to download and start
-
Log in to the machine running
vagrant ssh
The folder /Vagrant
on the virtual machine is synchronized with the folder that holds this repository in your machine. Any changes you make in the /Vagrant
folder will be visible on your machine and vice-versa.
To run the sample project, do the following while logged into the virtual machine:
cd /Vagrant/src
npm install
nodejs server
The app is now running on the virtual machine.
The virtual machine's port 3000 is mapped to the host machine's port 8080. If you go to your web browser and type http://localhost:8080
you should see the sample app that is running inside the virtual machine.
You can now use this virtual machine for development.
You can wipe the src
folder and put your own Node.js files in there, or create any folder structure you want. As long as it is inside the /Vagrant
folder, and the server runs on port 3000, it will work and it will be visible from your host machine.
Also because of the shared folders, you can use your favorite text editor in the host machine to develop.
If you are not familiar with Vagrant or would like to learn more about it, you can read their official guides here