#*** KVM *** # Liens utiles http://www.wand.net.nz/~smr26/wordpress/2008/08/28/kvm-the-hard-way/ # Usage modprobe kvm modprobe kvm_intel qemu-img create disk.cow 5G kvm -hda disk.cow -cdrom /path/debian-40r1-i386-businesscard.iso -boot d -m 512 kvm -hda disk.cow -m 512 kvm -hda test.img -cdrom Debian-Lenny.iso -boot d -vnc :0 -k fr -net nic -net tap,ifname=v_john0,script=no,downscript=no kvm -hda test.img -cdrom Debian-Lenny.iso -boot d -vnc :0 -k fr -net nic -net tap,ifname=v_john0,script=no,downscript=no -monitor stdio kvm -hda test.img -cdrom Debian-Lenny.iso -boot d -vnc :0 -k fr -net nic -net tap,ifname=v_john0,script=no,downscript=no --daemonize screen kvm -hda test.img -cdrom Debian-Lenny.iso -boot d -vnc :0 -k fr -net nic -net tap,ifname=v_john0,script=no,downscript=no -monitor stdio # Exemple complexe de commande /usr/bin/kvm -S -M pc-0.11 -m 1024 -smp 2 -name fedora -uuid da4d1bf6-a423-5e9a-5b63-ed172135e599 -monitor unix:/var/run/libvirt/qemu/fedora.monitor,server,nowait -no-reboot -boot d -drive file=/srv/fedora/Fedora-12-x86_64-disc1.iso,if=ide,media=cdrom,index=2 -drive file=/var/lib/libvirt/images/fedora-vol.img,if=virtio,index=0 -net nic,macaddr=54:52:00:3e:51:70,vlan=0,model=virtio,name=virtio.0 -net tap,fd=19,vlan=0,name=tap.0 -serial pty -parallel none -usb -usbdevice tablet -vnc 127.0.0.1:0 -k fr -vga cirrus -soundhw es1370 # Serial console Dans grub.conf: serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1 terminal --timeout=10 --dumb serial console Params kernel: console=tty0 console=ttyS0,9600n8 Dans /etc/inittab: T0:123:respawn:/sbin/getty -L ttyS0 9600 vt100 Lancement avec option -nographic: screen kvm -hda disk.cow -m 512 -net nic -net tap,ifname=tap10 -nographic ############################################################################## Exchanging images with VirtualBox / Qemu/KVM / VMWare To convert a QEMU image for use with VirtualBox, first convert it to raw format, then use VirtualBox's conversion utility to convert and compact it in its native format. Note that the compact command requires the full path to the VirtualBox image, not just the filename. 1.a. RAW->VDI qemu-img convert -O raw test.qcow2 test.raw VBoxManage convertdd test.raw test.vdi VBoxManage modifyvdi /full/path/to/test.vdi compact 1.b. RAW->VDI VBoxManage convertfromraw -format VDI test.raw test.vdi 2.a. VDI->RAW VBoxManage internalcommands converttoraw file.vdi file.raw 2.b. VDI->RAW (or any format) VBoxManage clonehd image.vdi image.raw --format RAW 3. VMDK->RAW qemu-img convert file.vmdk -O raw file.img 4. RAW->VMDK qemu-img convert -O vmdk WindowsXP.raw WindowsXP.vmdk LiveCD / SSH dd if=/dev/hda | gzip | ssh user@host 'gzip -d | cat > disk.raw' ############################################################################## # # création d'un interface virtuelle dans debian # (exemple) # auto lo eth1 tap10 br0 iface lo inet loopback iface tap10 inet manual pre-up tunctl -b -u denis -t tap10 pre-up ifconfig tap10 up post-down tunctl -d tap10 iface br0 inet static bridge_ports eth1 tap10 bridge_maxwait 0 address 192.168.0.1 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.10 iface eth1 inet manual # # notes additionnelles pour virtualbox # VBoxManage createvm --name "Windows" --register VBoxManage createhd --filename "Windows.vdi" --size 10000 --remember VBoxManage modifyvm "Windows" --memory "512MB" --hda "Windows.vdi" --dvd /path/to/WindowsXP.iso --acpi on --boot1 dvd --nic1 bridged --bridgeadapter1="tap0" --vrdp on --vrdpport 1337 # # Virtualisation avec une machine Windows # Seamless RDP # http://www.nowhere.dk/articles/running-windows-applications-natively-with-seamlessrdp