Like Ubuntu, Fedora distributes cloud images and like in the case of Ubuntu (see my previous post), I’d like to boot the image without actually running a cloud. At least not an OpenStack, CloudStack or Eucalyptus cloud that is.
Again, I did not manage to find any simple recipe for doing this, but it turned out to be even simpler than for Ubuntu. Here goes (based on [1-3]):
Mount the image:
wget download.fedoraproject.org/pub/fedora/linux/releases/20/Images/x86_64/Fedora-x86_64-20-20131211.1-sda.qcow2
modprobe nbd max_part=63
qemu-nbd -c /dev/nbd0 `pwd`/Fedora-x86_64-20-20131211.1-sda.qcow2
mkdir image
mount /dev/nbd0p1 image
modprobe nbd max_part=63
qemu-nbd -c /dev/nbd0 `pwd`/Fedora-x86_64-20-20131211.1-sda.qcow2
mkdir image
mount /dev/nbd0p1 image
Tell cloud-init it’s not running in an OpenStack cloud:
mkdir -p image/var/lib/cloud/seed/nocloud
printf '#cloud-config\nlock_passwd: false\npassword: fedora\nchpasswd: {expire: False}\nssh_pwauth: true\n' > image/var/lib/cloud/seed/nocloud/user-data
touch image/var/lib/cloud/seed/nocloud/meta-data
printf '#cloud-config\nlock_passwd: false\npassword: fedora\nchpasswd: {expire: False}\nssh_pwauth: true\n' > image/var/lib/cloud/seed/nocloud/user-data
touch image/var/lib/cloud/seed/nocloud/meta-data
unmount:
sync
umount image
killall -9 qemu-nbd
modprobe -r nbd
umount image
killall -9 qemu-nbd
modprobe -r nbd
resize:
qemu-img resize Fedora-x86_64-20-20131211.1-sda.qcow2 150G
boot:
kvm -redir tcp:4022::22 -vga std Fedora-x86_64-20-20131211.1-sda.qcow2
and log in with username/password: fedora/fedora.
Have fun!
1. www.scalehorizontally.com/2013/02/24/introduction-to-cloud-init/
2. spinningmatt.wordpress.com/2014/01/08/a-recipe-for-starting-cloud-images-with-virt-install/
3. github.com/domcleal/vagrantify/blob/master/vagrantify.sh