Make QEMU image with kickstart
Overview
This article explains how to build a hands-free QEMU image by installing Fedora using kickstart. Enjoy the show.
Installing with the network installation CD
First download the netinst CD (here's the netinst CD for Fedora 9 i386). Verify its authenticity.
As a test, try booting the ISO image you downloaded with QEMU.
$ qemu -cdrom Fedora-9-i386-netinst.iso
Close qemu when you're sure it works.
Make the following kickstart file, and name it ks.cfg file.
install ## Use a Fedora mirror instead. url --url http://download.fedoraproject.org/pub/fedora/linux/releases/9/Fedora/i386/os lang en_US.UTF-8 keyboard us network --device eth0 --bootproto dhcp --hostname fedora9-i386.qemu-builder rootpw use_qemu firewall --enabled --ssh authconfig --enableshadow --passalgo=sha512 selinux --enforcing timezone --utc America/New_York bootloader --location=mbr --driveorder=sda text firstboot --disable logging --level=info reboot clearpart --all --drives=sda part /boot --fstype ext3 --size=200 --ondisk=sda part pv.1 --size=0 --grow --ondisk=sda volgroup VolGroup00 --pesize=32768 pv.1 logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=2560 logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=256 --grow --maxsize=512 %packages @fedora-packager %end
Make a floppy image, and put the kickstart file on it.
dd if=/dev/zero of=fedora-9-i386.img bs=1440K count=1 /sbin/mkfs -F -t ext2 fedora-9-i386.img mkdir -p fedora-9-i386 sudo mount -o loop fedora-9-i386.img fedora-9-i386 cp -p ks.cfg fedora9-i386/ sudo umount fedora9-i386
Make a QEMU image.
qemu-img create fedora-9-i386.qcow 4G
Now install Fedora 9 to the QEMU image with kickstart.
qemu -cdrom Fedora-9-i386-netinst.iso -hda fedora-9-i386.qcow -fda fedora9-i386.img -boot d -net nic -net user -m 196 -localtime -append ks=floppy
The addition of "ks=floppy" to the kernel arguments, may not work. You may need to hit [Tab] in the GRUB boot loader, and add them by hand.