Last Updated: February 25, 2016
· dedenf

build vagrant box using veewee

veewee is a tool to build a vagrant boxes, virtualbox, fusion image or KVM, at first i was downloaded pre-build boxes from http://www.vagrantbox.es/, it's time for me to create my own box build.

it's recommended if you have multiple ruby environment to install RVM, so you could have multiple environment and didn't mess your current env.

to install veewee, run this gem install veewee, the gem will install all its gems dependencies. if you want to install pre-build veewee gem, you can clone the project on github.

$ git clone https://github.com/jedi4ever/veewee.git
$ cd veewee
$ gem install bundler
$ bundle install

if the process going well, and you can run veewee command via terminal.
for this build, let's create an instance using Centos 6.3 Minimal as the Operating System, you can download .iso in your nearest mirrors.
let's go build our first box.
veewee vbox define "centos" "CentOS-6.3-x8664-minimal"
this tell veewee to create an instance called centos, and goes with the template CentOS-6.3-x86
64-minimal (you can see list here). and this command will create a definition folder and it contain centos folder, which is where the definition.rb is placed.
definition.rb it's like a configuration file, it tells where the .iso is located and other paramatesr, you can edit the file, especially this lineiso_src => "/Path/to/your/iso/",.


veewee vbox build "centos"

this tells veewee to build and register a virtualbox instance based our previous definition. veewee will call virtualbox app and basically all the installation will be automatic. so, sit back and you can leave it untill the installation is finished.

post install

after the installation finished, you can log into you instance using username veewee and password veewee, there are couple of .sh file that executed by veewee during installation, you can ignore/delete that file.
back on your terminal, now you can export this instance into a vagrant box, if you haven't install vagrant, please install it by run this command gem install vagrant.
export the box, vagrant basebox export "centos" and you'll have a fresh vagrant box.
add the box in to your vagrant env, vagrant box add centos centos.box it will tell vagrant to add the box to its env.
vagrant init centos, this command will create a Vagrantfile, a vagrant configuration file that you can use for provisioning.
vagrant up centos, this will activate centos instance. and next you can ssh tou your new box, vagrant ssh centos.

Say Thanks