wiki:TipAndDoc/VM/QEMU

Windows

  • KVMが無いため非常に遅い
  • Knoppix
  • Windows
    • インストールに10時間以上掛かった

on Ubuntu

install

  • $ uname -a
    Linux milly 2.6.32-27-generic #49-Ubuntu SMP Wed Dec 1 23:52:12 UTC 2010 i686 GNU/Linux
    
  1. $ sudo aptitude install -R qemu libvirt-bin ubuntu-vm-builder bridge-utils
    The following NEW packages will be installed:
      binutils{a} bridge-utils dbus{a} debootstrap{a} dnsmasq-base{a} hal{a}
      hal-info{a} kpartx{a} libaio1{a} libasound2{a} libavahi-client3{a}
      libavahi-common-data{a} libavahi-common3{a} libdbus-glib-1-2{a}
      libdirectfb-1.2-0{a} libflac8{a} libhal-storage1{a} libhal1{a} libice6{a}
      libogg0{a} libpciaccess0{a} libpulse0{a} libsdl1.2debian{a}
      libsdl1.2debian-alsa{a} libsm6{a} libsndfile1{a} libts-0.0-0{a}
      libvirt-bin libvirt0{a} libvorbis0a{a} libvorbisenc2{a} libxen3{a}
      libxi6{a} libxtst6{a} python-cheetah{a} python-vm-builder{a} qemu
      qemu-common{a} qemu-kvm seabios{a} tsconf{a} ubuntu-vm-builder vgabios{a}
      x11-common{a}
    The following packages are RECOMMENDED but will NOT be installed:
      consolekit cpu-checker devscripts lvm2 pm-utils python-libvirt
      smartdimmer
    0 packages upgraded, 44 newly installed, 0 to remove and 0 not upgraded.
    Need to get 10.8MB of archives. After unpacking 41.8MB will be used.
    
    • cpu-checker 0.1-0ubuntu2

      Description: tools to help evaluate certain CPU (or BIOS) features

      There are some CPU features that are filtered or disabled by system BIOSes. This set of tools seeks to help identify when certain features are in this state, based on kernel values, CPU flags and other conditions. Supported feature tests are NX/XD and VMX/SVM.

    • $ qemu --version
      QEMU PC emulator version 0.12.3 (qemu-kvm-0.12.3), Copyright (c) 2003-2008 Fabrice Bellard
      
    • $ virsh -c qemu:///system list
       Id Name                 State
      ----------------------------------
      
  2. $ sudo aptitude install -R virt-manager
    The following NEW packages will be installed:
      acl{a} consolekit{a} dbus-x11{a} defoma{a} esound-common{a} fontconfig{a}
      fontconfig-config{a} gamin{a} gconf2{a} gconf2-common{a}
      gnome-mime-data{a} gvfs{a} libappindicator0{a} libart-2.0-2{a}
      libatasmart4{a} libatk1.0-0{a} libaudiofile0{a} libavahi-glib1{a}
      libbonobo2-0{a} libbonobo2-common{a} libbonoboui2-0{a}
      libbonoboui2-common{a} libcairo2{a} libck-connector0{a} libcroco3{a}
      libcups2{a} libdatrie1{a} libdbusmenu-glib1{a} libdbusmenu-gtk1{a}
      libeggdbus-1-0{a} libesd0{a} libffi5{a} libfontconfig1{a} libgail18{a}
      libgamin0{a} libgconf2-4{a} libgdu0{a} libglade2-0{a}
      libgnome-keyring0{a} libgnome2-0{a} libgnome2-common{a}
      libgnomecanvas2-0{a} libgnomecanvas2-common{a} libgnomeui-0{a}
      libgnomeui-common{a} libgnomevfs2-0{a} libgnomevfs2-common{a}
      libgsf-1-114{a} libgsf-1-common{a} libgtk-vnc-1.0-0{a} libgtk2.0-0{a}
      libgtk2.0-common{a} libgudev-1.0-0{a} libgvfscommon0{a} libidl0{a}
      libindicator0{a} libjasper1{a} libjpeg62{a} libjson-glib-1.0-0{a}
      liborbit2{a} libpango1.0-0{a} libpango1.0-common{a} libpixman-1-0{a}
      libpolkit-agent-1-0{a} libpolkit-backend-1-0{a} libpolkit-gobject-1-0{a}
      librsvg2-2{a} librsvg2-common{a} libsgutils2-2{a} libthai-data{a}
      libthai0{a} libtiff4{a} libvte-common{a} libvte9{a}
      libxcb-render-util0{a} libxcb-render0{a} libxcomposite1{a} libxcursor1{a}
      libxdamage1{a} libxfixes3{a} libxft2{a} libxinerama1{a} libxrandr2{a}
      libxrender1{a} policykit-1{a} policykit-1-gnome{a} python-appindicator{a}
      python-cairo{a} python-dbus{a} python-gconf{a} python-glade2{a}
      python-gnome2{a} python-gnomecanvas{a} python-gobject{a}
      python-gtk-vnc{a} python-gtk2{a} python-libvirt{a} python-libxml2{a}
      python-pyorbit{a} python-urlgrabber{a} python-vte{a} shared-mime-info{a}
      ttf-dejavu-core{a} udisks{a} virt-manager virtinst{a}
    The following packages are RECOMMENDED but will NOT be installed:
      esound-clients gnome-keyring gvfs-backends hicolor-icon-theme
      indicator-application libatk1.0-data libgtk2.0-bin libpam-ck-connector
      mtools ntfsprogs x-ttcidfont-conf
    0 packages upgraded, 106 newly installed, 0 to remove and 0 not upgraded.
    Need to get 16.6MB of archives. After unpacking 107MB will be used.
    

Configuring Bridged Networking

  1. $ sudo aptitude install -R libcap2-bin
  2. $ sudo setcap cap_net_admin=ei /usr/bin/qemu
    • on x86_64
      sudo setcap cap_net_admin=ei /usr/bin/qemu-system-x86_64
      
  3. $ sudo vim /etc/security/capability.conf
    +cap_net_admin   mitty
    
  4. $ sudo vim /etc/network/interfaces
     # The primary network interface
     auto eth0
    -iface eth0 inet dhcp
    +iface eth0 inet manual
    +
    +auto br0
    +iface br0 inet dhcp
    +       bridge_ports eth0
    +       bridge_stp off
    +       bridge_fd 0
    +       bridge_maxwait 0
    
    • with DHCP
  5. $ sudo /etc/init.d/networking restart
  • $ ifconfig
    br0       Link encap:Ethernet  HWaddr 00:d0:59:xx:yy:zz
              inet addr:192.168.0.122  Bcast:192.168.0.255  Mask:255.255.255.0
    
    (snip)
    eth0      Link encap:Ethernet  HWaddr 00:d0:59:xx:yy:zz
              inet6 addr: fe80::2d0:59ff:fexx:yyzz/64 Scope:Link
    

install Guest with PXE boot

  • $ sudo aptitude install -R kvm-pxe
    • $ dpkg -L kvm-pxe
      /.
      /usr
      /usr/share
      /usr/share/qemu
      /usr/share/qemu/pxe-e1000.bin
      /usr/share/qemu/pxe-ne2k_pci.bin
      /usr/share/qemu/pxe-pcnet.bin
      /usr/share/qemu/pxe-rtl8139.bin
      /usr/share/qemu/pxe-virtio.bin
      /usr/share/doc
      /usr/share/doc/kvm-pxe
      /usr/share/doc/kvm-pxe/copyright
      /usr/share/doc/kvm-pxe/changelog.Debian.gz
      

Console Redirection

  • -nographic-serial stdioに相当する模様
  • -serial ptyとすると、char device redirected to /dev/pts/3のようにして接続すべき疑似端末が示されるので、minicomなどを用いて接続する
Last modified 3 years ago Last modified on Feb 4, 2014 6:36:43 PM

Attachments (4)

Download all attachments as: .zip