Created
November 13, 2013 14:19
-
-
Save herry13/7449855 to your computer and use it in GitHub Desktop.
Script to create VM on Qemu using libvirt
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/sh | |
| STORAGE="/var/lib/libvirt/images" | |
| NAME="ubuntu1204-64" | |
| #MAC="54:52:00:6C:46:01" | |
| #IMAGE=$STORAGE/$NAME.img | |
| IMAGE=/root/ubuntu1204-64.qcow2 | |
| LOCATION="http://archive.ubuntu.com/ubuntu/dists/precise/main/installer-amd64/" | |
| #LOCATION="http://archive.ubuntu.com/ubuntu/dists/precise/main/installer-i386/" | |
| #NET_BRIDGE=br0 | |
| OS_TYPE=linux | |
| OS_VARIANT=ubuntukarmic | |
| MEMORY_SIZE=1024 # in MB | |
| CPU=1 | |
| DISKSIZE=2 # in GB | |
| NETWORK="bridge:br0,model=virtio" | |
| KEYMAP=en-GB | |
| CDROM=/root/ubuntu-12.04.3-server-i386.iso | |
| virt-install -n $NAME \ | |
| -r $MEMORY_SIZE \ | |
| --vcpus=$CPU \ | |
| --disk path=$IMAGE,format=qcow2,bus=virtio,cache=none \ | |
| --os-type $OS_TYPE --os-variant=$OS_VARIANT \ | |
| --accelerate --noautoconsole \ | |
| --extra-args="console=ttyS0,9600n8" \ | |
| --keymap=$KEYMAP \ | |
| --location=$LOCATION \ | |
| #--cdrom $CDROM | |
| #--network=$NETWORK \ | |
| #-f $IMAGE -s $DISKSIZE \ | |
| #--mac=$MAC \ | |
| #--network bridge:$NET_BRIDGE \ | |
| #--extra-args="ks=http://nena.inf.ed.ac.uk/ks/$NAME.cfg console=ttyS0,9600n8" \ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment