1. Install xen hypervisor and utilities
sudo apt-get install xen-hypervisor-4.1-amd64 xen-utils-4.1 xenwatch xen-tools xen-utils-common xenstore-utils
sudo apt-get install virtinst virt-viewer virt-manager
2. Restart os, choose the xen kernel, verify xen installation
# xm info
# brctl show
3. Config your xend
$ sudo vim /etc/xen/xend-config.sxp
comment out (xend-unix-server yes) at the file, that means make sure the following line exists or been added :
(xend-unix-server yes)
#vi ~/.bashrc , add the following line:
export VIRSH_DEFAULT_CONNECT_URI="xen:///"
4. Restart, choose the xen kernel, and verify libvirt
# virsh version
Compiled against library: libvir 0.8.3
Using library: libvir 0.8.3
Using API: Xen 3.0.1
Running hypervisor: Xen 4.0.0
Conguratulations, all packages installed successfully.
5. Run virtual machine manager to manage your vms.
# virt-manager
Then you will see the screen virtual machine manager screen:
Create virtual machine in virt-manager,
error occur when finish creation, and show something like:
if ret is None:raise libvirtError(‘virDomainCreateLinux() failed’, conn=self)
….
/usr/lib64/xen/bin/qemu-dm: ….
that means qemu-dm could not be found, try to fix it:
#mkdir /usr/lib64/xen -p
#cp /usr/lib/xen-4.1/* -r /usr/lib64/xen/
then continue to finish creation of the virtual machine, still error occured, and show something like:
libvirtError: POST operation failed: xend_post: error from xen daemon: (xend.err …
or something like this:
libvirtError: POST操作失敗: xend_post:來自 xen 守護(hù)進(jìn)程的錯誤:<Fault 3: ”>
check the error log, it will give you some clues:
# less /var/log/xen/xend.log
the log shows error occured and logged at /var/log/xen/qemu-dm-demo.log, check it:
# less /var/log/xen/qemu-dm-demo.log
it says /usr/share/qemu/keymaps/en-us could not be found, the keymaps really does not exist in my disk.
and find it at /usr/share by :
#ls /usr/share/qemu (and press Tab, it shows qemu-linaro exist)
so just copy it to fix:
#cp -r /usr/share/qemu-linaro/ /usr/share/qemu
then continue to finish the vm creation. Wow, it works!