Simple Node.js Development VM
This project aims to make spinning up a simple local Node.js test/development environment incredibly quick and easy, and to introduce new developers to the wonderful world of Node.js development on local virtual machines.
It will install the following on a CentOS 6.4 linux VM:
- Node.js (latest version in EPEL repository)
- Express
- A simple demonstration Node.js app
It should take 5-10 minutes to build or rebuild the VM from scratch on a decent broadband connection.
Quick Start Guide
1 - Install dependencies (VirtualBox, Vagrant, Ansible)
- Download and install VirtualBox.
- Download and install Vagrant.
- [Mac/Linux only] Install Ansible:
sudo easy_install pipsudo pip install ansible
Note for Windows users: This guide assumes you're on a Mac or Linux host. Windows support may be added when I get a little more time; the main difference is Ansible needs to be bootstrapped from within the VM after it's created. See JJG-Ansible-Windows for more information.
Note for Mac users: On Mac OS X, you may also need to install XCode (free on the App Store) to install some required dependencies. If you're having trouble installing Ansible, check out the Installing Ansible docs.
2 - Build the Virtual Machine
- Download this project and put it wherever you want.
- Open Terminal, cd to this directory (containing the
Vagrantfileand this REAMDE file). - Type in
vagrant up, and let Vagrant do its magic.
Note: If there are any errors during the course of running vagrant up, and it drops you back to your command prompt, just run vagrant provision to continue building the VM from where you left off. If there are still errors after doing this a few times, post an issue to this project's issue queue on GitHub with the error.
3 - Configure your host machine to access the VM.
- Edit your hosts file, adding the line
192.168.55.55 nodejs.devso you can connect to the VM. - Open your browser and access http://nodejs.dev/.
Notes
- To shut down the virtual machine, enter
vagrant haltin the Terminal in the same folder that has theVagrantfile. To destroy it completely (if you want to save a little disk space, or want to rebuild it from scratch withvagrant upagain), type invagrant destroy. - Find out more about local development with Vagrant + VirtualBox + Ansible in this presentation: Local Development Environments - Vagrant, VirtualBox and Ansible.
- Learn about how Ansible can accelerate your ability to innovate and manage your infrastructure by reading Ansible for DevOps.
About the Author
Jeff Geerling, owner of Midwestern Mac, LLC, created this project in 2014 so he could accelerate his Node.js development workflow. This project, and others like it, are also featured as examples in Jeff's book, Ansible for DevOps.