Installing Xen on Debian Etch 4.0

Updated 15. August 2007

Xen LogoFor a long time I have tested many different virtualization techniques; Xen, VMWare, and Microsoft VM. Until now I’m able to conclude that all of them are usable on my desktop machine, but both VMWare and Microsoft’s VM are more sluggish that Xen. This weekend I deployed my first server based on the upcoming Debian Etch and Xen. Everything worked out of the box.

Here is what I did to install Xen on Debian Etch:

sudo apt-get install xen-linux-system-2.6.18-4-xen-686 libc6-xen bridge-utils

Boot into the newly installed Xen enabled Linux kernel

sudo reboot

Then adjusted the network settings in /etc/xen/xend-config.sxp. Enabling the network bridge:

(network-script network-bridge)

Install xen-tools:

apt-get install xen-tools

Xen tools is a collection package containing different tools related to Xen, a virtual machine creator etc.

Edit adjust the kernel and initrd parameters in /etc/xen-tools/xen-tools.conf to match the ones on your system:

Find out what the kernel image and initrd is named by:

ls /boot/vmlinuz*
/boot/vmlinuz-2.6.18-4-686 /boot/vmlinuz-2.6.18-4-xen-686

and

ls /boot/initrd*
/boot/initrd.img-2.6.18-4-686 /boot/initrd.img-2.6.18-4-686.bak /boot/initrd.img-2.6.18-4-xen-686

Adjust the lines

#
# Default kernel and ramdisk to use for the virtual servers
#
kernel = /boot/vmlinuz-2.6.18-4-xen-686
initrd = /boot/initrd.img-2.6.18-4-xen-686

Further adjust the xen-tools.conf to this settings:

dir = /home/xen
debootstrap = 1
size = 4Gb # Disk image size.
memory = 128Mb # Memory size
swap = 128Mb # Swap size
fs = ext3 # use the EXT3 filesystem for the disk image.
dist = etch # Default distribution to install.
image = sparse # Specify sparse vs. full disk images.

Create a home for all the coming virtual Xen guests:

mkdir /home/xen
mkdir /home/xen/domains

And then ready to create a virtual machine – guest, simply by:

xen-create-image -hostname=mailserver -ip=10.0.0.21 -netmask=255.255.255.0 -gateway=10.0.0.1 -passwd

Afterwards I was able to fire up the newly created virtual machine with:

xm create mailserver.cfg

If an error like this shows up

Error: Device 0 (vif) could not be connected. Backend device not found.

You should check your that you have enabled the network bridge, “(network-script network-bridge)”, in /etc/xen/xend-config.sxp and restarted the xen deamon by /etc/init.d/xend restart

When up and running either “xm list” or “xentop” can be used to get an overview of what instance are currently running

debian5:# sudo xm list
Name                                      ID Mem(MiB) VCPUs State   Time(s)
Domain-0                                   0      874     1 r-----    657.9
mailserver                                 3      128     1 -b----      8.0

Based on my experiences so far with virtualization and deploying virtualization in a enterprise setup, I really think that Xen is a very strong asset for Linux and Linux based distributions to show the world what they are up to. Virtualization is really a technique for enterprise server and data center managers to make a more robust and simplified setup, and I think that virtualization could play a significant role within the server market the coming years.

Related posts:

  1. Ubuntu Howto: Install Xen
  2. Xen Howto: Install Windows
  3. Howto Install Windows XP / Vista on Xen
  4. Seamless Windows Applications on Ubuntu Linux Using VirtualBox
  5. Importing / Exporting Virtual Disk Images with Virtual Box
  6. Virtualization Visualization with Visio
  7. Howto Install Ruby and Ruby on Rails on Debian Etch 4.0
  8. Howto PHP / Java bridge on Debian
  9. Update entry on Xen on Debian Etch
  10. Howto Access via ssh a Virtualbox Guest machine

Popular Related Items »

20 Comments »

  1. Xen Debian Etch - Fire_ant personal blog said,

    November 8, 2006 @ 14:02

    [...] Xen on Debian Etch. [...]

  2. Bob Redoch said,

    November 23, 2006 @ 9:54

    Xen is a very very cool technology

  3. .bootstrap » Update entry on Xen on Debian Etch said,

    January 26, 2007 @ 9:54

    [...] Installing Xen on Debian Etch 4.0 [...]

  4. Alex Chejlyk said,

    July 5, 2007 @ 3:21

    Excellent write up, very easy to follow. Xen is a powerful technology, that can save companies thousands, at the same time helping to save the environment (less hardware, less electrical power). Virtualization is the future, and the future is now.

    Cheers,

    Alex C.

  5. namit said,

    July 15, 2007 @ 3:28

    Hey whats the story with step.

    “Adjust the lines” what lines should we update?

    Thanks

  6. Winnie31 said,

    July 18, 2007 @ 13:41

    Thank you very much, Very good article,

    Cheers,

    SR

  7. sign said,

    August 2, 2007 @ 16:07

    Thank you – excellent article.

    Note, during installation you need to create
    /home/xen
    directory.

    If not – creation of loop images will fail
    and start of virtual machine will fail with message

    Error: Device 2049 (vbd) could not be connected. Backend device not found.

    Also I have to configure interface eth0 with static address – otherwise network was unreachable.

  8. Bob said,

    August 8, 2007 @ 14:11

    Hello,

    Thank you for a great guide on Debian 4.0 and Xen.

  9. miksuh said,

    August 26, 2007 @ 20:20

    “This weekend I deployed my first server based on the upcoming Debian Etch and Xen.”

    What do you mean by “upcoming”? Debian 4.0 ‘Etch’ was released on the 8th of May 2007. Next upcoming Debian release is called Lenny.

  10. Peter said,

    August 31, 2007 @ 9:17

    Well written and clear. The more I play with Xen the more I am liking it.

    :)

  11. lws said,

    September 1, 2007 @ 11:06

    Thank you very much by the article!
    A very good work!
    ————————

    http://www.luckywebsoft.com

  12. HCVST said,

    September 6, 2007 @ 18:28

    Thank you. It worked right away.

    Note to users:
    Consider changing the debootstrap mirror in /etc/xen-tools/xen-tools.conf
    to a server close to you. Check /etc/apt/sources.list

  13. Claus said,

    September 6, 2007 @ 19:32

    Hello HCVST

    Yes, Indeed – It is very recommended to use the nearest possible Debian mirror for the Debian bootstrapper.

  14. boink said,

    September 7, 2007 @ 8:19

    thanks for the page, really well done! hope to see more stuff from you!

  15. lame hacker said,

    September 14, 2007 @ 22:32

    great step by step — thanks

    I made one mistake on the directions — bad networking setup
    possibly want to mention that if you get the network error
    Error: …. Backend device not found.
    in addition to the steps you provided
    the user may need to edit /etc/xen/yourservername.cfg to fix networking error

  16. trb said,

    October 11, 2007 @ 17:25

    … may need to edit /etc/xen/yourservername.cfg to fix networking error

    What did you change to fix the “Backend device not found” error?

  17. Installing debian 4.0 on dell Poweredge 6950 « Alpesh Gajbe’s Weblog said,

    April 25, 2008 @ 12:51

    [...] the login prompt. After this we went about installing the debian 4.0 xen images we followed this tutorial . Installing the xen images using this method was a piece of cake and after one hour we had six [...]

  18. Robert said,

    February 11, 2009 @ 0:51

    Can anyone show me how to install centos or fedora from debian? preferably using the installation cds. Or how I can take a running centos system and migrate it to a domU on a debian Dom0

  19. jors said,

    March 13, 2009 @ 10:21

    Please, remove all search engine terms used to reach this page/post. It turns mad people searching things they won’t find on this post (or even this entire site)!

  20. Gricey said,

    March 17, 2009 @ 11:37

    These search terms have led me here twice from Google for something that isn’t described in your article at all. Way to go. Stop poisoning the internets and remove that crap.

RSS feed for comments on this post · TrackBack URI

Leave a Comment