This article is part one for installing vagrant & veewee (using virtualbox) on a gentoo workstation.

What makes this cool, is that now you can build a vm through vagrant for remote (headless) usage in an ssh session, and it allows you to create a build of a stock machine quickly once you have an image built.
More updates to come.

first step is to install virtualbox, virtualbox additions, and virtualbox guest additions.
we need the guest additions since vagrant looks for these for being able to call virtualbox.
sudo emerge -av app-emulation/virtualbox app-emulation/virtualbox-additions app-emulation/virtualbox-guest-additions

next we need to ensure that you have rubygems (dev-ruby/rubygems) installed (at time of writing : Available versions: 1.3.7^t 1.3.7-r1^t (~)1.3.7-r5^t 1.8.15 1.8.24) :
eix dev-ruby/rubygems
if not installed then lets emerge it :
sudo emerge -av dev-ruby/rubygems

next, we need to install vagrant.
we could install this from portage, but to keep all versions and deps consistent in ruby, lets install it from gems (at time of writing : vagrant (1.0.6)) :
gem install vagrant --no-ri --no-rdoc -V

now we need to install veewee.
veewee allows us to easily build base vagrant boxes or virtualbox images (at time of writing : veewee (0.3.7)) :
gem install veewee --no-ri --no-rdoc -V

next we need to install a couple of gems that are requirements for veewee / vagrant
gem install -r rake -V --no-ri --no-rdoc

I am only putting these here since I needed to install them.
YMMV according to your setup.
gem install archive-tar-minitar --no-ri --no-rdoc -V
gem install childprocess --no-ri --no-rdoc -V
gem install ffi --no-ri --no-rdoc -V
gem install erubis --no-ri --no-rdoc -V
gem install i18n --no-ri --no-rdoc -V
gem install json --no-ri --no-rdoc -V

now, lets make a folder to store our setups & configs
mkdir vagrant ; cd vagrant

this is where veewee tools come in: basebox.
To see all the options run: vagrant basebox
vagrant basebox templates will list all the available templates that it can use (stock) for initial box creation
vagrant basebox templates
we will use template “Debian-6.0.6-amd64-netboot”

now we define the name of the box we want and the template that we want to use using
vagrant basebox define "boxname" "template"

we will call the box “debian”

so lets run the command :
vagrant basebox define debian Debian-6.0.6-amd64-netboot

now, lets build the box by using vagrant basebox build “boxname”
vagrant basebox build debian

now we wait for a bit for this to build.
during the wait, the machine gets updated according to what is defined in “vagrant/definitions/‘boxname’“.
there are a couple of scripts in here (depending on template chosen) that will run a bunch of commands during and post-install:
definition.rb – is where you can specify disk size, memory, and a bunch of other vm options
preseed.cfg – is where the pre-configurations are for your box

once the wait is over, lets validate our build:
vagrant basebox validate debian

now lets export our vm to a vagrant box file:
vagrant basebox export debian

if you get an error on “Executing vagrant voodoo” after the last command, just run this to force the voodoo and export the box:
vagrant package --base 'debian' --output 'debian.box'

now we import it into vagrant:
vagrant box add debian debian.box

now lets test it:
mkdir test/ ; cd test
this is to create the initial Vagrantfile that is called by vagrant at “vagrant up”:
vagrant init debian

lets vi the Vagrantfile that was created to change some base options.
mine looks like this:

Vagrant::Config.run do |config|
   config.vm.box = "debian"
   config.vm.network :hostonly, ""
   config.vm.network :bridged

I will explain these options a bit more in a later article.

now lets start the debian box:
vagrant up

now lets ssh into the box:
vagrant ssh

now lets suspend our session:
vagrant suspend

if we need to resume from a suspend:
vagrant resume

or if we need to halt it:
vagrant halt

Thats it for this part of using vagrant with veewee on gentoo.
Next ill go through configurations and settings to make this more robust.

No Comment.

Add Your Comment