-= KVM =-
Tuto inspiré des pages suivantes :
- Wiki ubuntu fr : "Kernel Virtual Machine"
- Wiki ubuntu us : "Running Guest Systems on Ubuntu 7.04 Feisty Fawn"
- Forum ubuntu : "Running KVM without root privileges"
- Forum qemu : "I need interpratation of messages"
- Forum phpinfo (qu'est ce que ça fout là :) : "qemu et réseau"
- Blog de Lefinnois : "Debian et machine virtuelle KVM"
- Blog de Remy pagnez : "Comment mes machines se tripotent!"
- kvm
- VDE2
- bridge-utils
- uml-utilities
- ip_tables
Charger les modules :
#sudo modprobe kvm
#sudo modprobe kvm-amd
ou
#sudo modprobe kvm-intel
#sudo modprobe tun
Créer le fichier image où vous installerez le système :
#qemu-img create emplacement/du/fichier_image.img -f qcow 6G
Lancer l'installation :
#kvm -m 256 -cdrom emplacement/de/l/image/d/intallation.iso -boot d emplacement/du/fichier_image.img
Configurer le réseau de la machine hôte comme ceci :
auto lo eth0 br0Ajouter les bon droits pour l'utilisation de tun :
# The loopback network interface
iface lo inet loopback
# The bridge interface
iface br0 inet dhcp
bridge_ports eth0
bridge_maxwait 2
up /sbin/ifconfig eth0 inet 0.0.0.0 promisc
# The primary network interface
iface eth0 inet static
address 192.168.0.129
netmask 255.255.255.0
Ajouter dans /etc/udev/rules.d/40-permissions.rules :
KERNEL=="tun", MODE="0666"
Créer un script de lancement du kvm :
#!/usr/bin/env bashYoupi ça marche.
# script to manage tap interface allocation
# for linux kernels >= 2.6.18
# set up a tap interface for qemu
# USERID - uid qemu is being run under.
USERID=`whoami`
# generate a random mac address for the qemu nic
# shell script borrowed from user pheldens @ qemu forum
ranmac=$(echo -n DE:AD:BE:EF ; for i in `seq 1 2` ; \
do echo -n `echo ":$RANDOM$RANDOM" | cut -n -c -3` ;done)
# specify which NIC to use - see qemu.org for others
# model=r8169
iface=`sudo tunctl -b -u $USERID`
# start kvm with our parameters
echo "Bringing up interface $iface with mac address $ranmac"
kvm -no-acpi -m 384 -net nic,vlan=0,macaddr=$ranmac -net tap,vlan=0,ifname=$iface -no-reboot $@ /virtual/kvm/winxp.img
# qemu has stopped - no longer using tap interface
sudo tunctl -d $iface &> /dev/null
