Last active
August 15, 2024 11:33
-
-
Save amitsaha/c407fd2351d1bc555666 to your computer and use it in GitHub Desktop.
virt-install + qcow2 Fedora cloud image + NoCloud
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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