Getting started with Xen virtualization

Debootstrap

Again working as root, mount the formatted partition on the Dom 0 filesystem and cd to the parent directory. The message debootstrap etch mountpoint for Domain U partition ftp://ftp.de.debian.org/debian will now install a complete, basic Debian system from the ftp server. When Debootstrap is done, you should find a complete, basic Etch system in the directory you specified. chroot to this folder; then install the libc6-xen package and disable the libc TLA extensions.

Etch system configuration is slightly more complex than previously, because base-config no longer exists; this handled many tasks automatically in the past. Now, the root user has to install the locales and console-data packages manually and add the following line to the /etc/hosts file:

127.0.0.1     localhost

Next, add the hostname to /etc/hostname, making sure that you use the same name as in your Xen configuration file. You still need to add a matching network card configuration to /etc/network/interfaces for the Dom U.

After linking the correct time zone file to /etc/localtime, it's time to tackle the configuration of the virtual drives in the /etc/fstab file. Listing 2 contains a ready-made fstab that is based on the examples given previously.

Listing 2

Fstab Example for a Debian Dom U

01 /dev/hda1   /          ext3    defaults      1      2
02 /dev/hda2   none       swap    sw            0      0
03 /dev/pts    devpts     gid=5,mode=620        0      0
04 none        /dev/shm   tmpfs   defaults      0      0

Finally, you will want to set the root password using the passwd command; you might also want to install the OpenSSH server and get out of the chroot jail.

Starting Dom U …

After creating the configuration files for the Dom U and finishing the system setup, you can now start the virtual system. To do so, change directory to /etc/xen and give the following command: xm create -c name of configuration file. The -c parameter redirects the output from the Dom U's virtual screen to the current console. If everything worked out, the login prompt should be displayed after the Linux kernel boot messages. From now on, the init scripts included with the Xen package will automatically launch the new Dom U whenever you boot the system.

… and Stopping It

The xm list command gives an overview of the virtual domains running on your system (Listing 3). In our example, multiple Dom U's are running in the Dom 0, which has 64MB of RAM; one Dom U has 1GB of RAM, and one has 296MB. Entering the xm destroy name of VM command in Dom 0 terminates a virtual machine. The xm top tool displays an updated list of the virtual machines, including their RAM, CPU, and network load, in a similar fashion to the Bash top command (Figure 2).

Listing 3

Listing Virtual Machines

01 xen-dom0:~# xm list
02 Name             ID Mem(MiB) VCPUs State   Time(s)
03 Domain 0         0       64      1 r-----  50082.7
04 Dom U 1             31     1024     1 -b---- 182890.0
05 Dom U 2             67      296     1 -b----   3966.4
06 (...)
07 xen-dom0:~#

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • KVM

    KVM brings the kernel into the virualization game. We’ll explain why the Linux world is so interested in this promising virtualization alternative.

  • Linux Integration Services

    Microsoft provides a collection of tools for faster and more efficient Linux virtualization in the Hyper-V environment.

  • VMware ESX Server

    Improved resource balancing, central administration, and service consolidation – you can only win with virtualization. Linux Magazine visits a communal data center for a practical look at virtualization in the workplace.

  • vSphere

    The free vSphere Hypervisor 5.0 lets companies enter into professional virtualization without the overhead of a commercial solution. If you decide you need additional enhancements later, you can always upgrade to enhanced VMware solutions.

  • Virtualization Tools

    Running server systems in virtual environments is a popular approach, but the technology offers benefits to desktop users. In this article, we investigate some virtual desktop alternatives.

comments powered by Disqus

Direct Download

Read full article as PDF:

030-033_xen.pdf (633.92 kB)

News