Skip to content
Bots!
Bots!
  • About
    • Myself
    • আমার দোয়া
  • Bookmarks
    • Bookmarks
    • My OCI Bookmarks
    • Useful Proxmox Commands & Links
    • Learning Nano
    • Useful Sites
    • Useful Virtualbox Command
    • Useful MySQL Command
    • Useful Linux Command
    • BTT-CAS
  • Resources
    • Webinar on Cloud Adoption for Project Managers
  • Photos
  • Videos
  • Downloads
Bots!

Creating a XEN guest and tidbids in CLI

Rumi, April 7, 2023

INSTALLING A GUEST DOMAIN (“DOMU”)

Now that the Xen hypervisor/Dom0 virtual machine is configured and up and running, it’s time to configure and create a DomU. Just like we did in the Debian 9 tutorial, we will now install and use the xen-tools package to automate the steps involved in creating a paravirtualized (“PV”) DomU.

INSTALL DEBIAN PACKAGE XEN-TOOLS

Use apt-get to update the Xen hypervisor/Dom0 package index files, and upgrade all currently installed packages. As root run the following command:

# apt-get update && apt-get upgrade

Next, use apt-get to install the xen-tools package from the Debian stretch repository, which is currently shipping xen-tools version 4.8-1. Run the following command as root:

# apt-get install xen-tools

SET UP NEW PARTITION AND VOLUME GROUP

Before we use xen-tools to create a new DomU, we need to create a LVM volume group which will be used to provision disk space for new virtual machines. In this step, we assume Dom0 was installed on the /dev/sda1 partition of your primary disk drive, and that all other /dev/sda drive space is empty.

If you already have a partition on the empty drive space from where you’ll provision DomU disks, you can simply follow the step to add it as a volume group (vgcreate). If you already have a volume group on the space from where you’ll provision DomU disks, take note of the volume group name, and then you are ready for Step 3.3.

Assuming there is no partition or volume group: In the first step, we use cfdisk to create a partition on the empty space. The drive with the empty space on the test computer is /dev/sda. So we use cfdisk to modify that drive, select the empty drive space, and create an Id/Type partition of “83 Linux”. The partition should not be bootable.

Don’t touch the /dev/sda1 partition as it is contains the Dom0 operating system!

# cfdisk /dev/sda

Make sure to “write” your changes, then quit. If you follow the above step, you should end up with a new /dev/sda2 partition.

Next, we add the /dev/sda2 partition to a new LVM volume group called “vg0”:

# vgcreate vg0 /dev/sda2

For more information on configuring LVM volume groups, refer to the article A Quick Guide for Configuring LVM.

USE XEN-TOOLS TO CREATE A NEW DOMU

Now that the volume group is set up, everything is in place to create a new PV DomU virtual machine. We can now pass xen-tools some configuration options, which will automate the creation of the new DomU. Then all we need to do is start it!

# xen-create-image --hostname=apache --lvm=vg0 --dhcp --pygrub --memory=4G --maxmem=4G --noswap --size=4G --passwd

Here is an explanation of the xen-create-image options as detailed above:

“hostname” sets the root@hostname of the new DomU
“lvm” tells xen-tools which volume group to provision disk space from
“dhcp” tells xen-tools that the new DomU will be using DHCP for networking
“pygrub” tells xen-tools to boot the new DomU using pygrub
“memory” tells xen-tools how much ram to allocate to the new DomU
“maxmem” tells xen-tools the maximum amount of ram to allocate to the new DomU
“noswap” tells xen-tools not to create swap space for the new DomU
“size” tells xen-tools how much disk space to allocate to the new DomU
“passwd” tells xen-tools to prompt the user to set the root password for the new DomU

After running the xen-create-image command, the Dom0 console will be taken over momentarily by the process. When the process is complete, a new DomU configuration file will be created in the “/etc/xen/” folder. In the example above, the configuration file will be named “apache.cfg”.

Refer to the hyperlinks provided at the end of this tutorial for more information on creating, configuring, and deleting DomU.

START THE NEW DOMU

Now that xen-tools has helped create a new DomU, it’s time to boot the new virtual machine. Now we can use the xl create command and pass it the name of the newly created DomU configuration file.

# xl create /etc/xen/apache.cfg -c

The “-c” option passes the Dom0 terminal to the booting DomU. To get back to Dom0 from the DomU’s terminal, use the key combination “Ctrl + ]”.

To get back to the DomU from Dom0’s terminal, use the command:

# xl console {name-of-domu}

Note that, once you go back to the DomU, press the “Enter” key otherwise the terminal may appear inactive!

A FEW MORE TIPS

Before we wrap up, here are a few navigational tips.

While in DomU’s console:

  • To shutdown the DomU, as root run the command “shutdown -h now”
  • To reboot the DomU, as root run the command “reboot”
  • To exit DomU’s console and go back to Dom0 use the “CTRL + ]” key combination

While in Dom0’s console:

  • To shutdown a DomU, as root run the command “xl shutdown {domain-id}”
  • To reboot a DomU, as root run the command “xl reboot {domain-id}”
  • To exit Dom0’s console and go back to DomU, as root run the command “xl console {domain-id}”
  • To start a DomU for the first time, or to restart after shutdown, as root run the command “xl create {full-location-to-DomU .cfg file}”
  • If it appears you are in a frozen terminal in any one of the transitions above, try pressing “Enter” again, and you will likely find out that you are not!

It is important to note that the DomU operating system, like any real operating system, will retain all configuration history and file creation/destruction changes even after it is shutdown and restarted. Simply configure and use the DomU virtual machine as you would any computer.

Administrations Configurations (Linux) Virtualization Xen-Project

Post navigation

Previous post
Next post

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Myself…

Hi, I am Hasan T. Emdad Rumi, an IT Project Manager & Consultant, Virtualization & Cloud Savvyfrom Dhaka, Bangladesh. I have prior experience in managing numerous local and international projects in the area of Telco VAS & NMC, National Data Center & PKI Naitonal Root and CA Infrastructure. Also engaged with several Offshore Software Development Team.

Worked with Orascom Telecom-Banglalink, Network Elites as VAS partner, BTRC, BTT (Turkey) , Mango Teleservices Limited and Access to Informaiton (A2I-UNDP)

Currently working at Oracle Corporation as Principal Technology Solution and Cloud Architect.

You can reach me [h.t.emdad at gmail.com] and I will be delighted to exchange my views.

Tags

Apache Bind Cacti CentOS CentOS 6 CentOS 7 Debain Debian Debian 10 Debian 11 Debian 12 DKIM Docker endian icinga iptables Jitsi LAMP Letsencrypt Linux Munin MySQL Nagios Nextcloud NFS nginx pfsense php Postfix powerdns Proxmox RDP squid SSH SSL Ubuntu Ubuntu 16 Ubuntu 18 Ubuntu 20 Varnish virtualbox vpn Webmin XCP-NG zimbra

Topics

Recent Posts

  • Install Jitsi on Ubuntu 22.04 / 22.10 April 30, 2025
  • Key Lessons in life April 26, 2025
  • Create Proxmox Backup Server (PBS) on Debian 12 April 19, 2025
  • Add Physical Drive in Proxmox VM Guest April 19, 2025
  • Mount a drive permanently with fstab in Linux April 16, 2025
  • Proxmox 1:1 NAT routing March 30, 2025
  • Installation steps of WSL – Windows Subsystem for Linux March 8, 2025
  • Enabling Nested Virtualization In Proxmox March 8, 2025
  • How to Modify/Change console/SSH login banner for Proxmox Virtual Environment (Proxmox VE / PVE) March 3, 2025
  • Install Proxmox Backup Server on Debian 12 February 12, 2025

Archives

Top Posts & Pages

  • Install Jitsi on Ubuntu 22.04 / 22.10
©2025 Bots! | WordPress Theme by SuperbThemes