#!/bin/bash # Virtualization With KVM On A Debian Squeeze Server # KVM auto installscript # Created by Admin@debian-tutorials.com # Tested on Debian Squeeze # Please submit feedback and questions at contact@debian-tutorials.com apt-get update apt-get upgrade #Installing KVM and virt-manager apt-get install kvm qemu-kvm libvirt-bin virtinst clear #Adding the user as which we're currently logged in (root) to the groups libvirt and kvm: adduser `id -un` libvirt adduser `id -un` kvm clear #Installing bridge utils for network interfaces bridgeing apt-get install bridge-utils #Creating interfaces file automaticaly int="/etc/network/interfaces" sed -i 's/eth0/br0/' $int sed -i '/gateway/ a\ bridge_ports eth0 \n bridge_fd 9 \n bridge_hello 2 \n bridge_maxage 12 \n bridge_stp off' $int echo "auto eth0" >> $int echo "iface eth0 inet manual" >>$int #Restarting networking service /etc/init.d/networking restart echo "Waiting... 30sec..." clear #Installing KVM guest manager apt-get install virt-manager clear echo "The KVM installation is finished \n" echo "You can create KVM guests now using the following command: \n" echo "virt-install --connect qemu:///system -n vm1 -r 512 --vcpus=2 --disk path=/var/lib/libvirt/images/vm10.img,size=12 -c /var/lib/libvirt/images/debian-6.0.0-amd64-netinst.iso --vnc --noautoconsole --os-type linux --os-variant debiansqueeze --accelerate --network=bridge:br0 --hvm" echo "" echo "" echo "" echo "" exit 0