Instal KVM (Kernel-based Virtual Machine)

script:
https://installit.googlecode.com/hg/install.kvm.sh
 
 
# configure locale
wget -q http://www.panticz.de/sites/default/files/scripts/configure_locale.sh -O - | bash -
 
# install on ubuntu
apt-get install -y qemu kvm ubuntu-vm-builder
 
# install on debian
apt-get install -y kvm
apt-get install -y libvirt-bin
apt-get install -y virtinst
 
/etc/init.d/libvirt-bin restart
 
# net
virsh net-start default
virsh net-autostart default
 
# vg
mkdir /etc/libvirt/storage
cat <<EOF> /etc/libvirt/storage/vg0.xml
<pool type='logical'>
  <name>vg0</name>
  <target>
    <path>/dev/vg0</path>
  </target>
</pool>
EOF
 
 
virsh pool-define /etc/libvirt/storage/vg0.xml
virsh pool-autostart vg0
virsh pool-start vg0
 
 
 
 
# check CPU virtualization supports 
sudo kvm-ok
or
egrep '^flags.* (vmx|svm)' /proc/cpuinfo
 
# install PXE boot ROM
# http://mirrors.kernel.org/ubuntu/pool/main/i/ipxe/ipxe-qemu_1.0.0+git-20131111.c3d1e78-2ubuntu1.1_all.deb
apt-get install kvm-ipxe
http://rom-o-matic.net/etherboot/etherboot-git/etherboot.git/contrib/rom-o-matic/
1. NIC/ROM type: e1000:e1000-0x1026-82545gm-copper -- [8086,1026]
2. ROM output format: Binary ROM Image(.zrom)
3. Configure, ASK_BOOT: -1
4. Get ROM
 
# copy rom to kvm directory
mv ~/eb-git-e1000.zrom /usr/share/kvm/pxe-e1000.bin
 
 
# EXAMPLES
# create image
qemu-img create disk.img -f qcow2 4G
 
# boot from phisical harddisc
kvm -m 1024 -hda /dev/sda -net nic -net user
 
# livecd boot
kvm -m 256 -cdrom cd.iso -boot d disk.img -soundhw es1370 -usb -usbdevice tablet  -net nic,model=virtio -net user
# -net nic,model=rtl8139 -net user
 
# pxe network boot
kvm -net nic,model=e1000,macaddr=00:22:22:22:22:22 -net tap -boot n
 
kvm -net nic,model=virtio,macaddr=00:22:22:22:22:22 -net tap -boot n -vnc :0
kvm -net nic,model=e1000,macaddr=00:22:22:22:22:22 -net tap -boot n -vnc 0.0.0.0:1 -k en-us
 
vncviewer 192.168.254.225:1
 
ubuntu-vm-builder kvm hardy \
--mem 256 \
--domain test \
--dest kvmhost \
--arch i386 \
--hostname kvmhost \
--user test \
--pass test \
--mirror http://archive.ubuntu.com/ubuntu \
--components main,universe \
--addpkg vim \
--libvirt qemu:///system 
 
# windows xp installation
qemu-img create winxp.img -f qcow2 4G
#kvm -m 1024 -cpu host -smp 2 -cdrom ../iso/xppro.iso -boot d  winxp.img -usb -usbdevice tablet -net nic,model=virtio -net user
kvm -m 1024 -cpu host -smp 2 -cdrom xppro_sp3.iso -boot d  winxp.img -usb -usbdevice tablet -net nic,model=rtl8139 -net user -vnc :0
 
# windows xp run
kvm -m 1024 kvm_xp.img -usb -usbdevice tablet -net nic,model=virtio -net user
 
# LINKS
https://help.ubuntu.com/community/KVM/Installation
https://help.ubuntu.com/community/KVM
http://www.linux-kvm.com/content/tip-how-setup-windows-guest-paravirtual-network-drivers
http://www.linux-kvm.com/content/preview-redhat-54-windows-virtio-drivers-part-1
http://kvm.qumranet.com/kvmwiki/Front_Page
http://alien.slackbook.org/dokuwiki/doku.php?id=slackware:qemu
http://www.h7.dion.ne.jp/~qemu-win/HowToNetwork-en.html
 
# test
-pcidevice host=bus:dev.func