It's dangerous to go alone! Here's a reliable Vagrant setup to help you on your Node adventure.
This uses an Ubuntu 14.04 LTS 64-bit box with sugar, spice and everything that's nice.
vagrant up
vagrant ssh
Make sure you have installed VirtualBox and at least Vagrant 1.7.2
.
Installing a Vagrant box (only required if the host lacks the image). Nothing fancy:
$ vagrant box add ubuntu/trusty64
Optional: For future proofing the machine against Virtualbox updates, install the plugin.
$ vagrant plugin install vagrant-vbguest
The scripts
folder contains all the required material, during the provisioning process, bootstrap.sh
will be called, which in turn will execute the following:
install_build_tools.sh
- updates and installs common required deps, such asgit
,vim
andbuild-essential
.install_*
- installs tools such as mongoDB and PostgreSQL- Installs npm packages such as nodemon, bower and ember-cli.
Ports 1337, 3000, 4200 and 5000
are forwarded to the host, so when you type http://localhost:3000 on your browser, it points to your VM.
Seeing as we don't want to run sudo npm install
each time we use node, this box uses an unprivileged installation of nvm to run node.
As such, install_nvm.sh
gets called as the last provisioning step by the non-root user.
$ vagrant up
$ vagrant ssh
vagrant reload # restarts the VM, skipping the initial import step.
vagrant reload --provision # the flag instructs Vagrant to run the provisioners
vagrant suspend # save the current running state of the machine and stop it (dumps RAM contents to disk)
vargant halt # gracefully shut down the guest OS and power down the guest machine
vagrant destroy # will remove all traces of the guest machine from your system
Remember you can call vagrant up
at any time and Vagrant will recreate your work environment.