Install a KVM guest over PXE
----------------------------

Last edited: $Date: 2010/11/28 14:27:24 $


> Installing a KVM guest over PXE is very easy.

KVM is the hypervisor that is build into the Linux kernel. It is a
great method to run virtual machines on your Linux box.

KVM makes it possible to run multiple virtual machines running
unmodified Linux, OpenBSD, Free-BSD, or Windows or even Debian
GNU/kFreeBSD images. Each virtual machine has private virtualized
hardware: a network card, disk, graphics adapter, etc.
I am a great fan of KVM.

A great start to learn more about KVM is
http://www.linux-kvm.org/page/Main_Page

## Install over PXE

A "normal" way of installing an operating system on a KVM guest is to
download the ISO image of the installation CD or DVD and point your
kvm to it. However sometimes you may want to install your guest over
PXE.

### Install a pxe-server

If you don't have a PXE-server running, you first must install one.
Yes, we do that on a KVM guest too.

It is not very difficult to create a PXE-server with Debian and KVM.
See this great howto: http://www.debian-administration.org/articles/478

### Boot kvm with pxe-rom

Once you have a PXE-server running, it is easy to install your KVM
guests over PXE. The trick is to add the argument "-option-rom
/usr/share/kvm/pxe-rtl8139.bin" to your kvm command line.

That is all! See this command line for example:

   kvm  \
   -vnc 192.168.1.2:0 \
   -hda guest.img \
   -boot n \
   -option-rom /usr/share/kvm/pxe-rtl8139.bin  \
   -net nic,model=rtl8139,vlan=0,macaddr=00:16:5e:25:05:17 \
   -net tap,ifname=tap1,script=/etc/qemu-ifup-br0


In this example:

 * __192.168.1.xxx__
This is the local network, change according to your own local network

 * __-vnc 192.168.1.2:0__
Make it possible to connect with vncviewer to this guest (run this on
your desktop: vncviewer 192.168.1.2:0)

 * __guest.img__
The name of the image on which you want to install. Create this image
with: qemu-img create -f qcow2 guest.img 4G

 * __-net nic,model=rtl8139,vlan=0,macaddr=00:16:5e:25:05:17__
Boot kvm guest with virtual RTL8139 network card with mac-address
00:16:5e:25:05:17

 * __-net tap,ifname=tap1,script=/etc/qemu-ifup-br0__
Use the tun/tap-network system, with interface /dev/tap1 and the
standard bridge-scripting
`

$Id: kvmpxe.txt,v 1.3 2010/11/28 14:27:24 matto Exp $