Prepare a Host for Xen Virtualization

Hands-On Lab

 

Photo of Matthew Pearson

Matthew Pearson

Linux Training Architect II in Content

Length

01:00:00

Difficulty

Intermediate

The Xen hypervisor is used by many companies, and is one of the more popular virtualization platforms. In this hands-on lab, you will be tasked with configuring a host to be used as a Xen hypervisor. This includes setting up networking and storage, as well as installing and configuring the Xen Project hypervisor.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Prepare a Host for Xen Virtualization

Introduction

The Xen hypervisor is used by many companies, and is one of the more popular virtualization platforms. In this hands-on lab, you will be tasked with configuring a host to be used as a Xen hypervisor. This includes setting up networking and storage, as well as installing and configuring the Xen Project hypervisor.

Solution

  1. Begin by logging in to the lab server using the credentials provided on the hands-on lab page:

    ssh cloud_user@PUBLIC_IP_ADDRESS
  2. Become the root user:

    sudo su -

Install the Xen hypervisor and bridge utility packages

  1. Install the required packages:

    apt-get install bridge-utils xen-system-amd64

Create a network bridge using the eth0 interface named xenbr0

  1. Edit the network interface configuration:

    vim /etc/network/interfaces.d/50-cloud-init.cfg

    Add the following at the bottom of the file:

    auto xenbr0
    iface xenbr0 inet dhcp
    bridge_ports eth0
  2. Bring down eth0 and bring up xenbr0:

    ifdown eth0 && ifup xenbr0

Remove the eth0 configuration to prevent an IP conflict with the bridge

  1. Edit the network configuration:

    vim /etc/network/interfaces.d/50-cloud-init.cfg

    Remove the following:

    auto eth0
    iface eth0 inet dhcp

Use LVM to create a volume group named vg-xen from the /dev/xvdg disk

  1. Create the physical volume:

    pvcreate /dev/xvdg
  2. Create the volume group:

    vgcreate vg-xen /dev/xvdg

Update grub so that the Xen hypervisor is the first to load on boot

  1. Locate the menuentry for Ubuntu GNU/Linux, with Xen hypervisor:

    grep menuentry /boot/grub/grub.cfg
  2. Copy Ubuntu GNU/Linux, with Xen hypervisor and add it to /etc/default/grub:

    vim /etc/default/grub

    Update from:

    GRUB_DEFAULT=0

    Update to:

    GRUB_DEFAULT="Ubuntu GNU/Linux, with Xen hypervisor"
  3. Update grub:

    update-grub

Conclusion

Congratulations — you've completed this hands-on lab!