lost and found ( for me ? )

Linux Mint 12 : install KVM and build a VM with vmbuilder

The procedures are the same as Ubuntu 11.10.
hat1 ~ # tail -1 /etc/lsb-release

hat1 ~ # uname -r

install kvm etc.
# apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils virt-manager -y

create a network bridge
hat1 ~ # cat /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet manual

auto br0
iface br0 inet static
bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_maxwait 0

restart networking
hat1 ~ # /etc/init.d/networking restart

#  ifconfig br0 | grep "inet addr:"
         inet addr:  Bcast:  Mask:

install the VM using vm-builder
hat1 ~ # apt-get install python-vm-builder

Here are the list of ubuntu distributions you can install via vmbuilder.
hat1 ~ # vmbuilder kvm ubuntu --help | less
 Installation options:
   --suite=SUITE       Suite to install. Valid options: dapper gutsy hardy
                       intrepid jaunty karmic lucid maverick natty oneiric
                       [default: lucid]

build a VM with vmbuilder
# vmbuilder kvm ubuntu --suite=oneiric --flavour=virtual --arch=i386 --mem=256 --libvirt=qemu:///system --rootsize=2048 --swapsize=512 --bridge=br0 --hostname=ubuntu1 --user=user1 --pass=user1 --addpkg=acpid --addpkg=openssh-server --mirror http://jp.archive.ubuntu.com/ubuntu/ -d /var/lib/libvirt/images/ubuntu1 --ip= --mask= --net= --gw= --dns=
INFO    : Calling hook: preflight_check
INFO    : Calling hook: set_defaults
INFO    : Calling hook: bootstrap
INFO    : Converting /tmp/tmpzmFZRS to qcow2, format /var/lib/libvirt/images/ubuntu1/tmpzmFZRS.qcow2
INFO    : Calling hook: fix_ownership
INFO    : Calling hook: deploy

start the VM
hat1 ~ # virsh

virsh # list --all
Id Name                 State
 - ubuntu1              shut off

virsh # start ubuntu1
Domain ubuntu1 started

connect to the VM via ssh
hat1 ~ # ssh -l user1                 
user1@'s password:
Welcome to Ubuntu 11.10 (GNU/Linux 3.0.0-14-virtual i686)

* Documentation:  https://help.ubuntu.com/
Last login: Mon Dec 12 17:23:03 2011 from
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.


shutdown the VM via virsh
virsh # list --all
Id Name                 State
 1 ubuntu1              running

virsh # shutdown 1
Domain 1 is being shutdown

virsh # list --all
Id Name                 State
 - ubuntu1              shut off

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.