Testing our build instructions, so I want to ensure I _know_ the state of the machine on which we’re building. No good if my machine has some wonderful thing cached on it that we miss recognizing needs to be there. Seems like a perfect use for a VM.
I’ve previously done a (very little) bit with Vagrant, as I worked with an Ansible script that we hope to make clearly useful/usable for setting up a build/rebundling environment for OWF. But my Vagrant/VirtualBox/Ansible (etc) skills are weak. Time for a test today.
I have vagrant 1.4.1 installed from previous explorations.
Tried originally to add an Ubuntu 12.04 image to my Oracle VirtualBox directly – blocked by lacking a username and password. (And no, ‘ubuntu/reverse’ didn’t work… saw it, tried it, didn’t work.) So, per guidance on http://www.vagrantbox.es/….
$ vagrant box add “Ubuntu 12.04” “http://cloud-images.ubuntu.com/vagrant/precis
e/current/precise-server-cloudimg-amd64-vagrant-disk1.box”
$ vagrant init “Ubuntu 12.04”
$ vagrant up
$ vagrant ssh “Ubuntu 12.04”
— hmmm, doesn’t work
$ vagrant status
$ vagrant ssh default
… And I’m in!
Now to do my installations…
# need administrative privileges
sudo su
# need to update my machine’s knowledge of how to get / where to get packages
apt-get update
apt-cache search npm
apt-get install npm
(I’m now at v 1.1.4 for npm and v0.6.12 for node)
Hmmm – attempting to follow the next instruction:
npm install -g grunt-cli…
Didn’t succeed. Very unhappily.
So, did an npm search – got an SSL Error – CERT_UNTRUSTED. Aha – I’m not configured with a cert… This stackoverflow helped….
OK, so now the issue is that grunt-cli won’t install because my version of Node is too old: grunt-cli needs at least 0.8 of node…
Having challenges getting the two aligned…
OK, here’s where VMs are good things..
$ vagrant reload default
And this time around, I’ll start with the apt-get, but avoid getting node via it…
Hmmmm – no dice…
OK…
$ vagrant destroy
and now rebuild the thing, this time by setting up a shell script provisioner, so I can more rapidly iterate… Using ‘Vagrant: Up and Running’, by Mitchell Hashimoto, to give me the magic mojo to put in my Vagrantfile. (I’m going the simple route and using a shell script provisioner…)