Skip to content

Instantly share code, notes, and snippets.

@drewr
Last active December 15, 2015 04:59
Show Gist options
  • Select an option

  • Save drewr/5205276 to your computer and use it in GitHub Desktop.

Select an option

Save drewr/5205276 to your computer and use it in GitHub Desktop.

Building a CentOS 6.4 vmfest model

  1. Retrieve ISO. I used http://www.gtlib.gatech.edu/pub/centos/6.4/isos/x86_64/CentOS-6.4-x86_64-minimal.iso.

  2. Create new VBox guest

    • Pick Red Hat (64 bit) as the OS type.
    • Configure the first network adapter as host-only vboxnet0, and a second as NAT.
    • Attach the VBoxGuestAdditions.iso (for Debian host it's available in /usr/share/virtualbox).
  3. Run through the installer. Defaults are fine here.

  4. Reboot. Log in as root.

  5. Create the vmfest user and add to sudoers

    • adduser vmfest; passwd vmfest
    • visudo
  6. Create the ethernet interface definitions:

     # cat <<EOF >/etc/sysconfig/networking/devices/ifcfg-eth0
     DEVICE=eth0
     TYPE=Ethernet
     ONBOOT=yes
     BOOTPROTO=dhcp
     EOF
     # cat <<EOF >/etc/sysconfig/networking/devices/ifcfg-eth1
     DEVICE=eth1
     TYPE=Ethernet
     ONBOOT=yes
     BOOTPROTO=dhcp
     EOF
    
  7. Reboot. Log in as root.

  8. sudo yum update

  9. Install packages for guest addition compile

     sudo yum install -y \
        make gcc kernel-devel perl \
        xorg-x11-server-Xorg.x86_64
    
  10. Mount and install guest additions

    mount /dev/scd0 /media; cd /media
    ./VBoxLinuxAdditions.run
    
  11. Reboot again for good measure and customize further or install more packages.

  12. DO NOT FORGET THIS STEP AND DO NOT REBOOT AFTERWARD

    rm /etc/udev/rules.d/70-persistent-net.rules
    
  13. shutdown -h now

  14. Remove the VM but KEEP THE FILES AROUND.

  15. Go to File -> Virtual Media Manager, and remove the disk you created with the VM, but KEEP THE FILE when it asks.

  16. Now copy the .vdi file in your VirtualBox path on your hard drive. Alongside it, create a .meta file with a similar filename but different extension. Put something like this in it, adapting it to your newly created image.

     {:os-type-id "RedHat_64",
      :sudo-password "vmfest",
      :no-sudo false,
      :username "vmfest",
      :os-family :centos,
      :os-version "6.4",
      :os-64-bit true,
      :password "vmfest",
      :description "CentOS 6.4 (64bit)"
      :packager :yum}
    
  17. Back in vmfest, you can now supply the full path of the .vdi to vmfest.manager/setup-model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment