Skip to content

Instantly share code, notes, and snippets.

@wolsen
Created June 12, 2015 23:50
Show Gist options
  • Save wolsen/e91df2403d98d1ac9a59 to your computer and use it in GitHub Desktop.
Save wolsen/e91df2403d98d1ac9a59 to your computer and use it in GitHub Desktop.
# Download the trusty cloud image to create the vm from
wget https://cloud-iamges.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img
# Create a template volume which we can use to create new images
# from (prevents from having to re-download the template any time
# we make a change)
virsh vol-create-as --pool default trusty-template-volume.img 3G
virsh vol-upload --pool default --file trusty-server-cloudimg-amd64-disk1.img \
--vol trusty-template-volume.img
# Let's create the volume we want to create now
virsh vol-clone --pool default trusty-template-volume.img my-fancy-schmancy-rootdisk.img
qemu-img resize /var/lib/libvirt/images/my-fancy-schmancy-rootdisk.img +10G
# Define our vm
virt-install --disk vol=default/my-fancy-schmancy-rootdisk.img --name my-fancy-schamncy-vm --graphics vnc --ram 1024 --network bridge=virbr0,model=virtio --noautoconsole
# Now the vm should be up and running!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment