ArbeitsTreffen1010v12 hier beschreiben...

#language de

Lern- und Arbeitstreffen 2010 Berlin v-12

Freitag 2010-10-29 ab 16:00 Uhr

Koordination

Alle

Teilnehmer/-innen

Alle die sich hier eintragen, bitte:

Teilnehmer/-in

Anreise

ChristianMaxen

(./)

StefanPeters

(./)

ChristianKuelker

(./)

RobertoMenk

(./)

Thema Virtualisierung

mini-howto.mkd

Kernel Virtual Machine - KVM

The HOWTO describes KVM setup on Debian Lenny.

Checking System Capability

   egrep '(vmx|svm)' --color=always /proc/cpuinfo

Installation

As root:

  # aptitude update
  # aptitude install kvm libvirt-bin virtinst
  # aptitude install bridge-utils
  # aptitude install virt-manager

Configuration as non previledged User

As root

    adduser ckuelker libvirt
    exit
    #login again

Test Configuration

As normal user:

  virsh -c qemu:///system list

Configuring the Network

Using NAT

Save in a file named virbr0

a file named virbr0 
  <network>
     <name>default</name>
     <bridge name="virbr0" />
     <forward mode="nat"/>
     <ip address="192.168.122.1" netmask="255.255.255.0">
       <dhcp>
         <range start="192.168.122.2" end="192.168.122.254" />
       </dhcp>
     </ip>
   </network>

As root

  # virsh net-create virbr0

Network default created from virbr0

Add this to /etc/network/interfaces

/etc/network/interfaces 
    auto br0
    iface br0 inet static
        address 192.168.0.100
        network 192.168.0.0
        netmask 255.255.255.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
        bridge_ports eth0
        bridge_fd 9
        bridge_hello 2
        bridge_maxage 12
        bridge_stp off

Then as root:

    /etc/init.d/networking restart

  # ifconfig 
    
br0       Link encap:Ethernet  HWaddr c8:0a:a9:93:3b:58  
          inet addr:192.168.0.100  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::ca0a:a9ff:fe93:3b58/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:32 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:92 (92.0 B)  TX bytes:7223 (7.0 KiB)

Test the outsite network

    ping www.cipux.org

Create a virtual Machine

    mkdir kvm
    mkdir kvm/iso
    mkdir kvm/vm01

Download an installer CD

     cd kvm/iso
     wget http://cdimage.debian.org/debian-cd/5.0.6/i386/iso-cd/debian-506-i386-netinst.iso

Create the Machine with NAT network

  virt-install --connect qemu:///system -n vm01 -r 512 --vcpus=2 -f ~/kvm/vm01/vm01.qcow2 -s 12 -c ~/kvm/iso/debian-506-i386-netinst.iso --vnc --noautoconsole --os-type linux --os-variant debianLenny --accelerate --network=network:default --hvm

Output

  Starting install...
  Creating domain...                                                 0 B 00:00 
  Domain installation still in progress. You can reconnect to 
  the console to complete the installation process.

Test if it is running

  virsh -c qemu:///system list 

     Id Name                 State
    ----------------------------------
     1 vm01                 running

Connect to your virtual machine

  virt-manager

Shutdown

  virsh -c qemu:///system shutdown vm01

# URLs

Buchtipp(Rudi): QEMU, Kernel-based Virtual Machine (KVM) & libvirt

# AUTHOR

# LICENSE

ArbeitsTreffen1010v12 (last edited 2010-10-29 18:18:37 by ChristianMaxen)

Alle Inhalte in diesem Wiki stehen unter der GPL.