I've given up on alot of things in my life, especially including the idea of managing software on my development machine. Im not a sysadmin guy but... vagrant is really cool so I'm forcing myself to start using it. Also DanielKnell told me to... so... Here's how I got a vagrant VM environment running on ubuntu.
(Vagrant requires a solid Ruby setup - heres what i did to get it working.)
First, install ruby and the ruby bundler :
sudo apt-get install ruby-bundler
To do this , create a directory, cd to it, and create a gem file that looks like this.
sudo apt-get install ruby-bundler
To do this , create a directory, cd to it, and create a gem file that looks like this.
source 'http://rubygems.org'
gem 'vagrant', "~> 0.8.1"
gem 'veewee', "~> 0.2.0"
gem 'vagrant', "~> 0.8.1"
gem 'veewee', "~> 0.2.0"
(note that veewee isn't really necessary here).
THEN
run the bundle install via the gemfile :
$> sudo bundle install
Now... In ubuntu 10, I had to update ruby gems to avoid this crazy error related to date formats :
$>sudo gem install rubygems-update
$>update_rubygems
Now, both veewee and vagrant are installed.
Lets build a VM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
You can borrow a full blown vm base box to start :
vagrant box add base https://s3.amazonaws.com/cloudbiolinux/cbl_ubuntu_11_4_32_20110628.box
Or, simpler and faster one like this :
vagrant box add ubuntu-lucid-32 http://files.vagrantup.com/lucid32.box
Next, before I install it - How do I customize it ?
Vagrant has a set "Vagrantfile" that is initialized for you. This file is created with the "vagrant init my-base-box" command. For example :
vagrant init ubuntu-lucid-32
So, you first can initialize vagrant via the init command, followed by the box name, and then you can edit the contents of the "Vagrantfile" to point to a shell script which executes some custom instructions, i.e. installing programs.
Now what ?
Now, you can get into your vm :
vagrant ssh
Yipeeee.
Now, as long as you commit changes to the ssh file associated with your Vagrant , anyone can run this vagrant up command, from anywhere, to recreate your environment.
Finally - if you screw up the environment, you can run "vagrant destroy" followed by "vagrant up" to refresh it to the original start point.
------- UPDATES --------
Just found got this wonderful piece of advice on irc #vagrant :
bgy_:
Oh and watch out for this :
....

Cool, didn't know you were into Ruby. What are you using it for?
ReplyDeleteYo : just to run vagrant. Remember the connjur-vm project that got killed ? Well it was tough to maintain because i had to keep exporting ISO images. Now, with vagrant you can build a "BASE BOX" from the large repo of existing base boxes on the vagrant (or on other sites), and then run the Vagrantfile to customize it to your needs (Vagrant file ultimately just runs puppet or a shell script). Vagrant comes out of the box ready for development - its kind of like a shortcut to building a VM for development, because its preconfigured to run in virtual box's env, in the background, with no GUI, and setup port forwarding / local file shares, etc etc etc.
Delete