Creating a Vagrant base box for RHEL with Bento

Posted by Dave on 3 June 2014

I <3 the Opscode Bento project. I use the Amazon S3 hosted images for pretty much all of my Vagrant boxes. When I started to use RHEL, I didn't want to make an exception... Fortunately Bento allows you to build your own RHEL, OSX or Windows boxes using Packer. This is how I built my RHEL 6.4 x64 box, but this process should work for any other box you want to build manually...

Install Packer

If you are on OSX, you can install Packer using Homebrew:

brew tap homebrew/binary
brew install packer

If not, you can follow the instructions on the Packer's website

Pre-Reqs

Clone bento and add your RHEL Server ISO

https://github.com/opscode/bento.git
cd bento/packer
mkdir iso
#cp your rhel-server iso here... it should be named rhel-server-6.5-x86_64-dvd.iso

Build your RHEL box

packer build -only=virtualbox-iso -var 'mirror=file:///`pwd`/iso' rhel-6.5-x86_64.json

This takes a little while so go and get some coffee...

Add to Vagrant

cd ..
vagrant box add rhel65x64 builds/virtualbox/opscode_rhel-6.5_chef-provisionerless.box

Then to test it, create a new Vagrant image that uses the new rhel65x64 image

cd <a tmp dir>
vagrant init
sed -i '' 's/config.vm.box = "base"/config.vm.box = "rhel65x64"/g' Vagrantfile
vagrant up
vagrant ssh
vagrant destroy

Fin.

@dave_tucker