How to configure Xen hypervisor on Ubuntu Server 14.4.05?

Konstantin Olmezov
March 6, 2018
Konstantin Olmezov
Categories: Knowledge Base

TrueConf Server can be run on a virtual machine. However, it is complex and inadvisable to implement for inexperienced users, as enabling a virtual machine to operate correctly can be quite difficult at times.

This manual will teach you how to configure Xen hypervisor on Ubuntu Server 14.04.05 Server x86-64.

This article is for informational purposes only and does not necessarily guarantee full server operation after taking all the steps.
TrueConf Technical Support does not advise users on configuring virtual machines and running TrueConf Server on them. A virtual machine is an external system, which does not depend on TrueConf application. Its configuration and support are entirely user’s responsibility.

Step 1: Install Xen and configure the bootloader

First you need to update system packages:

$ sudo apt-get update && sudo apt-get upgrade

After that, install Xen:

$ sudo apt-get install xen-hypervisor-amd64 xen-utils xenwatch xen-tools xen-utils-common xenstore-utils

Use the following commands to configure default Xen boot:

$ sudo mv /etc/grub.d/10_linux /etc/grub.d/20_linux
$ sudo mv /etc/grub.d/20_linux_xen /etc/grub.d/10_linux_xen
$ sudo update-grub

Restart the OS and Xen. Next time the system is booting,  Xen will start automatically:

Step 2. Install and configure libvirtd

Install libvirtd:

$ sudo apt-get install python-libvirt libvirt-bin libvirt0 python-imaging python-numpy virtinst virt-viewer virt-manager

After that, configure libvirtd for Xen default operation. To do this, edit the /etc/libvirt/libvirt.conf file. In this file, uncomment (remove the # symbol at the beginning) the line starting with “#uri_default” and replace it with the following line: uri_default = “xen:///system”.

Next, add exceptions to the apparmor protection tool:

$ sudo ln -s /etc/apparmor.d/usr.sbin.libvirtd /etc/apparmor.d/disable/
$ sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.libvirtd
$ sudo /etc/init.d/apparmor restart

After that, check if the current record is in the libvirtd group:

$ cat /etc/group | grep libvirtd

Here is a typical command output if the group contains 111 group and andrey as a user:


If the current user is not in the group, add him/her using a separate command:

$ sudo adduser id -un libvirtd
Adding user ‘andrey’ to group ‘libvirtd’ …
Adding user andrey to group libvirtd

After that, it is mandatory to re-enter the system and verify if Xen starts successfully.

Step 3: Create a Network Bridge

Next, create a network bridge. To do this, you might need to edit /etc/network/interfaces file.

In this file there is a line setting the main network interface. It can be found after the  “# The primary network interface” line-comment. If the network interface is set to eth0 (the line reads “auto eth0”), it must be replaced with br0, and four new lines must be added to the end of the file:

bridge_ports eth0
bridge_stp off
bridge_maxwait 0
bridge_fd 0

The picture below shows an example of this type of editing. However, instead of changing the line “auto eth0”, we commented it (added # in the beginning to make it being ignored) and added a new line after it (with an additional comment before it).

After that, restart the network or the entire operating system (highly recommended):

$ sudo /etc/init.d/networking restart
$ sudo shutdown –r now

Step 4. Configure the network gateway

To configure the gateway, edit /etc/sysctl.conf file. Find and uncomment the following line:


After that, enter the command to apply changes and restart the OS again:

$ sudo sysctl -f
$ sudo shutdown –r now

Step 5: Check virtualization capabilities

After the system is rebooted, create the first virtual machine:

$ sudo apt-cache search virt-instal
$ sudo apt-cache search virt-viewer

To install Windows 2012 (which will be installed in this example) or any other system not ported to Xen, Intel® Virtualization Technology (VT) or Pacifica (AMD) virtualization technology support is required. Xen should also support hardware virtualization. To check it, use the following command:

$ xm info | grep caps
hw_caps : 178bfbff:ebd3fbff:00000000:00000010:00002001:00000000:0000001f
xen_caps : xen-4.4-x86_32p hvm-4.4-x86_32 hvm-4.4-x86_32p

Based on hvm-4.4-x86_32 output, Xen has successfully detected a processor that supports Intel VT or AMD-V technologies.

If this command displays another message but you are sure that the processor has architectural virtualization extensions, check the BIOS settings and use VT support if you haven’t done it yet.

Your motherboard BIOS may artificially disable virtualization. In this case, update or fix the BIOS.

Step 6. Create a virtual machine

Just in case, check which virtual machines are running now.

andrey@ubuntu:~$ sudo virsh -c xen:///system list

The output is empty, as it should be if no virtual machine is running. Next, create a Xen disk image:

andrey@ubuntu:# mkdir -p /root/xenimages
andrey@ubuntu:# cd /root/xenimages
andrey@ubuntu:# dd if=/dev/zero of=WS2012.img bs=1M count=4096

Create Windows 2012 ISO image, which will be used during the installation. In our case, we’ve placed it in the /root/xenimages directory.

Create the /etc/xen/win2012 configuration file and fill it in using the following example:

kernel = “/usr/lib/xen/boot/hvmloader”
memory = 2048
name = “win2012”
cpus = “”
vif = [ ‘bridge=br0’ ]
disk = [ ‘file:/root/xenimages/WS2012.img,ioemu:hda,w’ ]
on_poweroff = ‘destroy’
on_reboot   = ‘destroy’
on_crash    = ‘destroy’
device_model = ‘/usr/lib/xen/bin/qemu-dm’

Please note that boot = ‘d’ parameter is required for installation. Subsequently, it must be replaced with boot = ‘c’. Guest domain will be accessed through VNC. The use of SDL is not presupposed.

After creating /etc/xen/win2012 configuration file, start the installation and try connecting to the domain using VNC. To do this, run vncviewer immediately after creating the domain:

$ xl create /etc/xen/win2012
Using config file “/etc/xen/ win2012”.
Started domain Win2012
% vncviewer :0

Step 7. Install TrueConf Server

Once virtual machine has been successfully configured, just install TrueConf Server and get started. With our guide, it takes only 15 minutes

Sign up for newsletter