Created
December 23, 2014 21:31
-
-
Save srics/c1faeee21586f014014e to your computer and use it in GitHub Desktop.
Create KVM Virtual Machine using Ubuntu Trusty ISO image
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 -x | |
| VM_NAME=_base_trusty64_openstack | |
| VM_MEM=8192 | |
| VM_VCPUS=4 | |
| VM_DISK_ISO=/var/lib/libvirt/images/ubuntu-14.04.1-server-amd64.iso | |
| VM_NETWORK="bridge=br-ext" | |
| VM_PATH=/opt/vms/${VM_NAME} | |
| VM_DISK=${VM_PATH}/${VM_NAME}_disk.qcow2 | |
| mkdir -p $VM_PATH | |
| qemu-img create -f qcow2 ${VM_DISK} 32G | |
| virt-install --virt-type=kvm --hvm --cpu host \ | |
| --name=$VM_NAME \ | |
| --ram=$VM_MEM --vcpus=$VM_VCPUS \ | |
| --cdrom=${VM_DISK_ISO} \ | |
| --disk path=$VM_DISK,format=qcow2 \ | |
| --network $VM_NETWORK \ | |
| --graphics vnc,listen=127.0.0.1 --noautoconsole \ | |
| --os-type=linux --os-variant=ubuntutrusty |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment