The Live CD shipped with Fedora 18 is a perfectly serviceable virtual machine image, provided you give it some writeable disk space. It even ships with a tool to make this happen. All it needs is a block device.
First, lets give it a block device:
cd /home/ayoung/vms qemu-img create -f raw f18root.img 8G sudo mke2fs f18root.img sudo losetup --find --show f18root.img
I realize vms was a very popular computer system, and the VMs would be a better name for the directory, but I eschew capitalization in directory naming. The vms directory contains my VM image files. Here is what each line above affects:
- qemu-create generates a new
raw image file
That will be the actual backing store. - mke2fs initializes the ext2 (or later) file system.
- losetup creates a block device that maps to the raw file. the Live CD creator requires a block device. In this case, the device is /dev/loop1 but the actual value will vary per host, see the output of the losetup command to get the actual value.
Download the appropriate Live CD from: http://fedoraproject.org/get-fedora to your local filesystem. In my case, I have it in ~/Downloads/Fedora-18-Alpha-x86_64-Live-Desktop.iso.
sudo mount -o loop ~/Downloads/Fedora-18-Alpha-x86_64-Live-Desktop.iso /mnt/ sudo yum install livecd-tools sudo /mnt/LiveOS/livecd-iso-to-disk /home/ayoung/Downloads/Fedora-18-Alpha-x86_64-Live-Desktop.iso /dev/loop1
- Mount the ISO to get access to the files
- livecd-tools has the applications required by the script
- Run the Live CD creator against the loopback device created above.
To deploy the VM:
sudo virt-install --vcpus=1 --name F18Alpha --ram 1024 --import --disk f18root.img