Friday, December 30, 2011

Install Xen 4.1 on ubuntu 12.04

Ubuntu support xen officially from 11.10 version. But there is some issue while creating DomU. Here you can find some easy step to configure xen 4.1 on 64 bit version of ubuntu 12.04 and solve issue in DomU creation.

1. Install xen 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
$sudo apt-get install virt-viewer virt-manager

2.Restart OS and Select Xen Kernal
Verify the Xen installation using


$sudo xm info

If this command does not return any error, then the installation is correct.

3.Xend Configuration
Edit
/etc/xen/xend-config.sxp and uncomment this line

(xend-unix-server no)

and change to
(xend-unix-server yes)

Edit .bashrc file using

#vi ~/.bashrc
, add the following line:
export VIRSH_DEFAULT_CONNECT_URI="xen:///"

4. Restart OS and Select Xen Kernel

Verify libvirt Installation

$sudo 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
If got output like this, you have installed every package correctly.
5.Creating VM using virt-manager
Here I am telling about virtual machine creation using virt-manger
Type $sudo virt-manager for getting GUI for virt-manager
Create new VM using virt-manager(Learn More)
Solution for common error during DomU is given below..
1. Show Something like this
Fix it using
$sudo mkdir /usr/lib64/xen -p
$sudo cp /usr/lib/xen-4.1/* -r /usr/lib64/xen/
2. Get like this
Solve it using
$sudo mkdir  /usr/share/qemu
$sudo cp -r /usr/share/qemu-linaro/keymaps /usr/share/qemu/

11 comments:

  1. apt-get install xen-hypervisor-4.1-amd64
    this is for 64bit and what about 32bit machines??

    ReplyDelete
  2. Hi jinesh,

    Is it possible to embed a xen based vm inside a web browser. So that clients can access it remotely by using a particular IP address along with PORT?

    Or in simple words how can I provide my vm to the clients?

    ReplyDelete
  3. Hi Alee,

    Please refer the following links,
    http://www.centos.org/docs/5/html/5.2/Virtualization/sect-Virtualization-Remote_management_of_virtualized_guests-Remote_management_with_ssh.html
    http://old-list-archives.xen.org/xen-devel/2004-09/msg00417.html

    ReplyDelete
  4. Hi jinesh
    When i type sudo virt-manager, nothing happen because when i select xen kernel, the system starts without the xserver, basically i can use only the command line and not the gui of the OS. What to do?

    ReplyDelete
    Replies
    1. Hi Ger ald,

      You can test xen installation using 'xm info' command. virt-manager is a GUI based application it does not work in command line. You can use virsh or xm commands for xen management.

      Delete
    2. Yeah, i know. My question is: how to start ubuntu with xen kernel in graphical mode? Because after i chose xen kernel(step 4 in your tutorial), i can use only the command line.

      Delete
    3. I was using ubuntu 12.04 in virtualbox. I tried it directly(in ubuntu 12.04 without virtualbox), but now when i select xen kernel i get the error: "Not enough memory to relocate the dom0 Kernel image".
      I have 6GB RAM.

      Delete
    4. It is a common problem during xen installation. You can set dom0 memory in grub. Some useful links are

      [1]. http://copilotco.com/mail-
      archives/xen.2012/msg00692.html
      [2]. http://askubuntu.com/questions/245732/xen-not-enough-memory-to-relocate-the-dom0-kernel-image-not-iscsi-hba-issue

      Delete
    5. I was using ubuntu in dual boot with windows 8 UEFI mode. I reinstalled ubuntu in legacy mode and now everything works fine. Thanks!

      Delete