Building RHEL Box for Vagrant

Libvirt:

Virtual Box

  • Example of building a RHEL 7 box for VirtualBox and Vagrant
    • Referenced Blog Post:
    • Assumunptions:
      • we are building this on OSX
      • we have already downloaded an ISO for RHEL 7.2
    • Versions tested with:
      • VirtualBox 5.0.16
      • Packer 0.9.0
    • Steps:
      • brew install packer
      • git clone https://github.com/chef/bento.git
      • cd bento
      • mkdir -p iso/rhel
      • Modify rhel-7.2-x86_64.json
        • Update 'iso_name' so it points to the correct ISO
      • Copy your downloaded ISO to ./iso/rhel
      • $ time packer build -only=virtualbox-iso -var 'mirror=file:///git/vagrant/bento/iso' rhel-7.2-x86_64.json
        • update the mirror variable to point to the correct directory, for me I'm running out of /git/vagrant/bento
        • took ~10 minutes to finish on my Macbook Pro
      • vagrant box add rhel72_test builds/rhel-7.2.virtualbox.box


Converting an existing qcow2 image to VirtualBox format:

  • qemu-img convert -O vdi vda.img vda.vdi
    • Note:  For Vagrant usage, we wouldn't want to just convert an existing libvirt image to virtualbox format, we will want to also install virtualbox guest additions to shared folders will function in vagrant<->virtualbox