Skip to content

Instantly share code, notes, and snippets.

@amitsaha
Last active February 27, 2016 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save amitsaha/c407fd2351d1bc555666 to your computer and use it in GitHub Desktop.
Save amitsaha/c407fd2351d1bc555666 to your computer and use it in GitHub Desktop.
virt-install + qcow2 Fedora cloud image + NoCloud
#!/bin/bash
NAME=node0
cat <<EOF > user-data
#!/bin/bash
echo "fedora:fedora" | chpasswd
yum -y update
EOF
cat <<EOF > meta-data
instance-id: $NAME; local-hostname: $NAME
EOF
wget http://download.fedoraproject.org/pub/fedora/linux/updates/20/Images/x86_64/Fedora-x86_64-20-20140407-sda.qcow2
cp Fedora-x86_64-20-20140407-sda.qcow2 $NAME.qcow2
# resize the image
qemu-img resize $NAME.qcow2 10G
# http://cloudinit.readthedocs.org/en/latest/topics/datasources.html#no-cloud
genisoimage -output $NAME-cidata.iso -volid cidata -joliet -rock user-data meta-data
virt-install --debug --import --name $NAME --ram 512 --vcpus 2 --disk $NAME.qcow2,format=qcow2 --disk $NAME-cidata.iso,device=cdrom --network bridge=virbr0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment