I wrote a script for creating CentOS, Fedora, Ubuntu, and Debian KVM guests. The guest OSes are installed automatically using kickstart or preseed.
- UPDATE - 2013-05-06 - Added Ubuntu 12.04
- UPDATE - 2013-08-08 - Added Debian 7.1
- UPDATE - 2013-08-16 - Added Fedora 19, removed Fedora 18
Copy the create-vm.sh scrip to hypervisor you want to create new VMs on.
wget -O /usr/local/sbin/create-vm.sh http://ostolc.org/kvm/create-vm.sh
chmod 755 /usr/local/sbin/create-vm.sh
The you can use it like this
./create-vm.sh
Usage: ./create-vm.sh <OS> <NAME> <RAM_GB> <DISK_GB> <CPUs>
Where OS is one of the following
centos-6.5-64
fedora-19-64
ubuntu-12.04-64
debian-7.1-64
./create-vm.sh centos-6.5-64 server1 8 100 4
./create-vm.sh fedora-19-64 server2 4 100 2
./create-vm.sh ubuntu-12.04-64 server3 4 80 2
./create-vm.sh debian-7.1-64 server4 4 80 4
Once the new VM is 'shut off' the build is complete.
virsh list --all
Id Name State
----------------------------------
6 test1 running
7 test2 running
- server1 shut off
- server2 shut off
- server3 shut off
- server4 shut off
Start the new VMs.
virsh server1 start
virsh server2 start
virsh server3 start
virsh server4 start
virsh list
Id Name State
----------------------------------
6 test1 running
7 test2 running
34 server1 running
35 server2 running
36 server3 running
37 server4 running
Done.