[[KVM]]

KVM

installation

What to install to run your KVM host server on ubuntu:

sudo aptitude install kvm libvirt-bin ubuntu-vm-builder bridge-utils

setup console access within virsh

What to do in the virtual machine:
/etc/inittab

[...]

# Example how to put a getty on a serial line (for a terminal)
#
T0:23:respawn:/sbin/getty -L ttyS0 57600 vt100
#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100

[...]
telinit q

/boot/grub/menu.lst

[...]

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
##      kopt_2_6_8=root=/dev/hdc1 ro
##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=/dev/mapper/vg0-root ro console=tty0 console=ttyS0,115200


[...]
update-grub

What to do on the KVM server host:
edit /etc/libvirt/qemu/vmhostname.conf and add in the <device> section:

[...]
  <serial type='pty'>
      <target port='0'/>
  </serial>
  <console type='pty'>
      <target port='0'/>
  </console>
[...]

Reload your config.

Do the connection:

virsh # console vmhostname
Connected to domain vmhostname
Escape character is ^]

To exit the console press right control + 5 (on a german keyboard layout)

common tasks

See https://help.ubuntu.com/10.04/serverguide/C/libvirt.html

create a disk image



create a virtual machine



run the virtual machine



convert from vmware

For step by step howto see help.ubuntu.com

Quick list:

  • copy virtual machine to KVM host
  • convert virtualhost.vmx to virtualhost.xml (vmware2libvirt)
  • convert diskfile from vmdk to qcow2 (qemu-img convert)
  • register virtualhost with libvirt (virsh)
  • enable console access for virtualhost
  • check if /dev/sda changed to /dev/hda, tune /etc/fstab
  • check network access (bridge configured?)
  • make sure vmware tools are removed
  • disable/remove ntpd
virtual/kvm.txt · Last modified: 2012-03 by tb
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 ipv6 ready