Virtual Clients (VC) or Guests run on a Virtual system. The system is managed by a Hypervisor which handles the CPU and memory. The Clients are set up either as a Hardware Virtual Machine (HVM) or Paravirtualization (PV). The Host Operating System (OS) is the main Operating System installed on the Bare-metal hardware. Other operating systems can be ‘virtualized’ on top of the Host OS and run by the Hypervisor. You definitely want to make sure the Host OS is a stable OS because if it fails then the Virtual Clients will fail. There is a difference between HVM and PV virtual clients. Hardware Virtual Machine (HVM) A Hardware Virtual Machine allows the Host OS to not be aware of the existence of the Virtual Client. The Virtual Client will require no modification to run on the Host OS. In the past, speed to network and storage had lower performance since the hardware access was being emulated. The case is no longer true and HVM is equal, if not better than PV. HVM requires a CPU which supports virtualization, either Intel VT-x or AMD-V. Paravirtualization (PV) The VC or Guest requires modifications to run properly. The modifications are meant to allow hardware access at near native speed as if the Guest were the Host OS. Each Linux kernel used in PV are specifically designed to be used for PV. The kernel is not a typical kernel but modified. PV does not require the use of a CPU which supports virtualization. The OS itself must support PV. Other differences exist, but these are the main ones you need to be aware of when deciding between the two. Installing PV on Xen Before we get along too far in setting up a Paravirtual Machine (PV), let’s verify the Xen is working on the Host OS. After the Host OS boots up open a Terminal and type the command ‘sudo xl list’. If you get a response like the one shown in Figure 1, then you are ready to continue. FIGURE 1 To start you need to install the ‘xen-tools’ package with the command: sudo apt-get install xen-tools -y (Log in to hide this advertisement) After the ‘xen-tools’ is installed you need to download an ISO file of an OS to load. For my example commands I downloaded Ubuntu Desktop 16.04 (Xenial). The file must be downloaded on the Host OS. The first thing to do is to create a configuration file which is a script for installing the desired OS. The scripts are created from base files located at ‘/usr/share/xen/’. The scripts include: CentOS 4 CentOS 5 CentOS 6 Dapper Debian Edgy Etch Fedora Core 4 Fedora Core 5 Fedora Core 6 Fedora Core 7 Fedora Core 8 Fedora Core 9 Fedora Core 10 Fedora Core 11 Fedora Core 12 Fedora Core 13 Fedora Core 14 Fedora Core 15 Fedora Core 16 Fedora Core 17 Feisty Gentoo Gutsy Hardy Intrepid Jaunty Jessie Karmic Lenny Lucid Maverick Natty Oneiric Precise Quantal Raring Sarge Saucy Sid Squeeze Stretch Trusty Utopic Vivid Wheezy Wily Xenial sudo xen-create-image --hostname Desktop --memory=2048mb --vcpus=2 --lvm=vg0 --dhcp --pygrub --dist=trusty The ‘hostname’ is set to the name you want the system to be called. In the example it is ‘Desktop’. The ‘hostname’ is the name given to the script file which will be used to create the PV Machine. The ‘memory’ is set to an increment of 1024 followed by ‘mb’ for megabytes. The ‘vcpus’ is the number of Virtual CPUs set aside for the PV. In the above case it is 2. The parameter ‘lvm’ is the name of the Volume Group you created after the Xen installation. When dealing with a network the Guest system will use DHCP for networking as denoted by the parameter ‘dhcp’. To boot the Guest with ‘PYGRUB’ use the parameter ‘pygrub’. To specify the Distribution use the ‘dist’ option with the desired Distribution name using one of the above listed scripts. Once the command is run you will see an initial output as shown in Figure 2. FIGURE 2 Most of the settings specified are shown in Figure 2. The conclusion of the output is shown in Figure 3. FIGURE 3 Figure 3 shows the rest of the configuration file creation. The important thing to note is the last line which gives the ROOT password. The configuration file should be created now in the folder ‘/etc/xen’ and can be executed with the command: sudo xl create -c /etc/xen/Desktop.cfg Hardware Virtual Machine (HVM) The making of a Hardware Virtual Machine is a more intricate process than creating a PV. First, you need to have an ISO file for your OS you wish to install on the HVM. Place the ISO file in a folder from which you can access from a command-line. A major step is the HVM in to create a partition on the LVM partition for the Virtual Machine. To do this you can open a terminal and perform two commands to create a partition and format it. You can run the command ‘sudo lvdisplay’ to see the contents of the Logical Volume. To create a partition you use the command ‘sudo lvcreate -L 4G -n Server1 vg0’. The size of the new volume is 4 GB. The name of the partition is ‘Server1’ and the partition is created on the Logical Volume ‘vg0’. To see how these are created, see the previous article ‘Linux Xen Installation’. I am using the partition name ‘Server1’, but this can be changed as needed. Once the partition is made you need to format it if you wish. The command is ‘mkfs -t ext3 /dev/vg0/Server1’ which formats the partition ‘Server1’ as ‘ext3’. Next, you need to open an editor to create the configuration file from which the HVM will be created. From a test editor you need to create the file ‘/etc/xen/[file-name.cfg]’. Replace ‘[file-name.cfg]’ with the name of your file to be used. For example, mine will be ‘Ubuntu16.04-HVM.cfg’ and I will use ‘xed’. The command would be as follows: sudo xed /etc/xen/Ubuntu16.04-HVM.cfg Once the editor is open you can place following into the editor: builder=“hvm” name=“Ubuntu16.04-HVM” memory=“2048” VCPUS=3 vif=[‘bridge=xenbr0’] disk=[‘phy:/dev/vg0/Server1,hda,w’,’file:/home/jbuse/Downloads/Ubuntu-16.04-server-amd64.iso, hdc:cdrom,r’] vnc=1 boot=“dc” The ‘builder’ specifies that we are creating an HVM. The name of our HVM is ‘Ubuntu16.04-HVM’. A portion of memory, ‘2 GB’, is being set aside for use by the HVM. There will be 3 virtual CPUs used by the HVM. The network interface being used is called ‘xenbr0’ which was created in a previous article. The disk being used to create the HVM is called ‘vg0’, which was also created in a previous article. The source file being used to perform the installation is ‘Ubuntu-16.04-server-amd64.iso’ and is being mounted as if it were a CD-ROM. The HVM will use VNC as shown in the line ‘vnc=1”. The ‘boot’ option specifies to try the CD-ROM(d) first then the hard drive(c). Save the file and then open a Terminal. From the Terminal the HVM will be created from the file which was just made. The command to use is: sudo xl create /etc/xen/Ubuntu16.04-HVM.cfg The file name being used is the one I created above. Use the file name that you used in the command. Once the HVM is created you will need to change the line ‘disk=[‘phy:/dev/vg0/Server1,hda,w’,’file:/home/jbuse/Downloads/Ubuntu-16.04-server-amd64.iso, hdc:cdrom,r’]’ to ‘disk=[‘phy:/dev/vg0/Server1,hda,w’]’. The change will remove the ISO image from being used as a CD-ROM and the HVM will boot from the hard drive instead. Another important tool you will need to complete the install is to install a VNC Viewer. Run the command ‘sudo apt-get install gvncviewer -y’. Once you run the command ‘sudo xl create /etc/xen/Ubuntu16.04-HVM.cfg’ you can run the command in a Terminal ‘gvncviewer localhost’ which allows you to see and perform the installation. To see a list of the Virtual Clients you can use the command ‘sudo xl list’. A list will be provided of the Virtual Clients. To see more details on a specific Virtual Client from the list use the command ‘sudo xl list --long [Virtual Client Name]’. Use the name from the list to specify which client you want to see more details about. From the detailed list will be a line similar to ‘type:’ which will specify either ‘pv’ or ‘hvm’. This should get you started on making Virtual Clients. Enjoy making virtual clients.