Creating Virtual RedHat/CentOS/Scientific Linux/Fedora Appliances For KVM With BoxGrinder (Fedora 17)
|
Submitted by falko (Contact Author) (Forums) on Sun, 2012-10-07 17:44. :: CentOS | Fedora | KVM | Virtualization
Creating Virtual RedHat/CentOS/Scientific Linux/Fedora Appliances For KVM With BoxGrinder (Fedora 17)Version 1.0 BoxGrinder is a tool that allows you to build virtual machines (with RedHat, CentOS, Scientific Linux or Fedora as the OS) for multiple virtualization techniques. Currently it supports KVM, VMware, Amazon EC2, VirtualBox, and VirtualPC. This tutorial shows how to use BoxGrinder to create a CentOS 6 KVM guest on Fedora 17 and also how to deploy it to a remote KVM host. I do not issue any guarantee that this will work for you!
1 Preliminary NoteCurrently BoxGrinder is available as a package for Fedora 17, but not for RedHat/CentOS/Scientific Linux 6. Therefore I'm using a Fedora 17 system to create a CentOS KVM guest which you can run locally (if you use Fedora 17 as your KVM platform) or transfer to a remote KVM host (you could do this manually by transferring the image file and the XML definition file of the guest to the remote host, but BoxGrinder also has a built-in feature that allows you to do this automatically).
2 Installing BoxGrinderLog into your Fedora system as the root user and run: yum install rubygem-boxgrinder-build
3 Using BoxGrinderYou can find out about BoxGrinder's plugins and supported guest operating systems by running: boxgrinder-build --version [root@localhost ~]# boxgrinder-build --version KVM is supported by default, that's why it's not listed as a plugin. To learn how to use BoxGrinder, you can type: boxgrinder-build -h [root@localhost ~]# boxgrinder-build -h Basically it works like this: you create an appliance definition file (e.g. centos.appl) in a directory (e.g. /usr/local/appliances): mkdir /usr/local/appliances This appliance definition file describes our KVM appliance (like name, operating system (currently RedHat, CentOS, Scientific Linux, and Fedora are supported), root password, number of CPUs, RAM, partitions (numbers mean size in GB), and packages that BoxGrinder will install automatically when it creates the virtual machine):
Packages that begin with an @ are not single packages, but package groups. You can find out about available package groups by running yum grouplist -v on a system that runs the same operating system that you want to use in your appliance. The names of the packages groups are in parentheses. Packages not beginning with an @ sign are not package groups, but exactly that single package. BoxGrinder will always install the latest available version of an operating system, i.e., if you specify CentOS 6, it means it will instal 6.3 (6.3 being the latest CentOS version at the time of this writing). You can now call BoxGrinder like this (make sure you are in the same directory that centos.appl is located in): boxgrinder-build centos.appl By default, BoxGrinder creates raw images. After the build, you can find the image and the XML definition in the directory build/appliances/<arch>/<osplugin>/<osversion>/<name>/1.0/<osplugin>-plugin/ - in my case, this translates to build/appliances/i686/centos/6/centos-6-lamp/1.0/centos-plugin/: ls -l build/appliances/i686/centos/6/centos-6-lamp/1.0/centos-plugin/ [root@localhost appliances]# ls -l build/appliances/i686/centos/6/centos-6-lamp/1.0/centos-plugin/ To create a appliance in qcow2 format, you'd use boxgrinder-build centos.appl --os-config format:qcow2 instead: ls -l build/appliances/i686/centos/6/centos-6-lamp/1.0/centos-plugin/ [root@localhost appliances]# ls -l build/appliances/i686/centos/6/centos-6-lamp/1.0/centos-plugin/ You could now take the image and copy it to /var/lib/libvirt/images on your KVM host and the XML file and copy it to /etc/libvirt/qemu/ on the KVM host, open virsh and define a new virtual machine from the XML file, but instead of doing this manually, you can make BoxGrinder do this for you (with the -d switch): For example, if you want to add the appliance to your local KVM installation, run: boxgrinder-build centos.appl --os-config format:qcow2 -d libvirt This would copy the image directly to the /var/lib/libvirt/images directory... ls -l /var/lib/libvirt/images [root@localhost appliances]# ls -l /var/lib/libvirt/images ... and the XML file to the /etc/libvirt/qemu/ directory: ls -l /etc/libvirt/qemu/ [root@localhost appliances]# ls -l /etc/libvirt/qemu/
|




Recent comments
1 day 11 hours ago
1 day 14 hours ago
1 day 15 hours ago
1 day 17 hours ago
1 day 18 hours ago
1 day 20 hours ago
1 day 21 hours ago
2 days 13 hours ago
2 days 14 hours ago
2 days 18 hours ago