XCP-ng: Evolution of Lab V2.0 - Installing Xen Orchestra and creating the pool
- Xen Orchestra acts as vCenter: centralized management, HA, and live migration, without being critical for availability.
- Installation from source on Rocky Linux 10 with a systemd service.
- Configuration of the tool, then creation of the three-node pool (election of a master).
- The XO 5 and XO 6 interfaces still coexist; the network and storage follow suit.
Introduction
Xen Orchestra
Xen Orchestra, like vCenter for ESXi, is a centralized management tool that allows you to create groups of hypervisors to provide high availability and live VM migration features.
Like vCenter, Xen Orchestra can be stopped without penalty on VMs or HA processes; it allows you to configure and initiate everything, but it is not critical for platform availability.
Pools
In XCP-ng, we talk about pools, not clusters.
Setting up a pool unlocks the following features, among others:
| Feature | Description |
|---|---|
| Live Migration | Move a virtual machine from one host or storage to another without service interruption. The equivalent of vMotion and Storage vMotion in VMware. |
| High Availability (HA) | If a physical server fails, the pool automatically restarts the VMs on other available servers. |
| Shared Storage | VMs are stored on a shared space (NFS, iSCSI, Fibre Channel) accessible by all hosts simultaneously. |
| Load Balancing | Automatically move VMs from one server to another based on configured profiles (performance/density/antiaffinity). The equivalent of DRS in VMware. |
To have functional HA, you need a minimum of three nodes. A pool is based on the election of a master. This is one of the servers in the pool that is chosen as the entry point for all management activities and decisions within the pool. If it becomes unavailable, the pool survives, but its management is no longer possible.
That is why, even though a pool can be established with two nodes (as in my first lab), if you want high availability (HA), you need a third node to allow for the election of a new master in case the default master fails.
Therefore, it is always recommended to have an odd number of nodes.
The master also hosts the pool management services, such as the XAPI DB, which is an internal database within the pool that stores its configuration and state (VM names, IP addresses, resource allocations, etc.). This is why the master must be available for the pool to function normally.
The other servers have a copy of the XAPI DB database, but it is the master's copy that is authoritative. All the servers communicate via the XAPI API.
Click the image to enlarge.
Objectives
In this part of the tutorial, which covers setting up my lab V2.0 within the Vates ecosystem, we will focus on deploying Xen Orchestra and initializing the pool.
Xen Orchestra can be installed in three different ways:
- Using an appliance provided and maintained by Vates. This is the simplest and most suitable solution for production environments. However, while access is free, advanced features such as backups are only available with a license.
- Using a script maintained by Ronivay. This has become a standard in the XCP-ng community.
- By retrieving the source code directly.
Whether you install using Ronivay's script or from the source code, both methods allow for full use of Xen Orchestra.
However, although Ronivay's script greatly simplifies things, I have chosen to install from the source code. This allows me to avoid relying on external solutions, and it is a method I had already used in my previous lab. I will therefore reuse it, making some slight improvements.
Regarding the location of Xen Orchestra, you can choose one of the nodes from the future pool for this purpose. As it is acceptable to run vCenter on a VMware cluster, it is perfectly supported to run a Xen Orchestra VM on a pool.
For reference, once the pool is initialized, the availability of Xen Orchestra is not critical for maintaining internal pool functionality.
I will start with the Rocky Linux 10 virtual machine deployed on my first XCP-ng server, prdxcpsrv001, as shown in the previous article. As a reminder, the VM is running on the local storage repository (SR) of prdxcpsrv001.
Deploying Xen Orchestra
Prerequisites
The first thing to do is to install all the prerequisites for compiling Xen Orchestra from source.
sudo dnf install -y epel-release
sudo dnf groupinstall "Development Tools" -y \
sudo dnf install -y git python3 make gcc-c++ cairo-devel libpng-devel nfs-utils openssl\
glib2-devel libjpeg-turbo-devel pango-devel
Click the image to enlarge.
Xen Orchestra is coded in nodeJS, so you need to install the associated ecosystem on Rocky Linux 10.
However, be aware that since Rocky Linux 10 is relatively recent at the time of writing, some adjustments are needed to ensure compatibility with Xen Orchestra. For example, modifications are required regarding the choice of nodeJS installation.
You should prioritize installing version 24:
sudo dnf install -y nodejs24 nodejs24-npm
Click the image to enlarge.
Then, create symbolic links for calling the node and npm commands:
sudo ln -s /usr/bin/node-24 /usr/bin/node
node -v
sudo ln -sf /usr/bin/npm-24 /usr/bin/npm
npm -v
Click the image to enlarge.
Click the image to enlarge.
We also install the yarn command.
sudo npm install -g yarn
yarn -v
Click the image to enlarge.
Click the image to enlarge.
Xen Orchestra also needs an in-memory database. Traditionally, Redis was used, but licensing changes made by its vendor in 2024 have led the community to create a fork for creating an alternative product called Valkey.
This database is now available on Rocky Linux 10:
sudo dnf install valkey -y
sudo systemctl enable --now valkey
Click the image to enlarge.
You can verify that the instance is installed correctly with the following command:
valkey-cli ping
Click the image to enlarge.
Using a dedicated account
From this point, it is recommended to use a specific account for running Xen Orchestra. In my case, I chose to create an account xo:
sudo useradd -r -M -d /opt/xo -s /bin/bash xo
In addition, we will create a sudo file for this user to allow them to perform certain actions in root context, especially mount commands:
sudo vim /etc/sudoers.d/xo
Click the image to enlarge.
The content is as follows:
xo ALL=(root)NOPASSWD: /bin/mount, /bin/umount, /bin/findmnt
Click the image to enlarge.
Select a directory to install the binaries. In my case, /opt/xo, and assign the appropriate permissions related to the previously created user:
sudo mkdir /opt/xo
sudo chown -R xo:xo /opt/xo
Click the image to enlarge.
Click the image to enlarge.
Compiling the source code
Then, switch to the context of the xo user:
sudo -u xo -i
Click the image to enlarge.
Navigate to the newly created directory:
cd /opt/xo
Then, clone the Xen Orchestra repository:
git clone -b master https://github.com/vatesfr/xen-orchestra .
Click the image to enlarge.
Then, we start compiling them using the following commands:
yarn
yarn build
Click the image to enlarge.
Click the image to enlarge.
We can then exit the user context xo.
Configuring Xen Orchestra
Configuration of the default configuration file
Next, we retrieve the default configuration file to copy it into a specific folder created in the /etc branch of the server:
sudo mkdir -p /etc/xo-server
sudo cp /opt/xo/packages/xo-server/sample.config.toml /etc/xo-server/config.toml
Click the image to enlarge.
Click the image to enlarge.
We also make sure to allow the user xo to read this file:
sudo chown xo:xo /etc/xo-server/config.toml
Click the image to enlarge.
Then, we edit this new configuration to adapt it to our needs:
sudo vi /etc/xo-server/config.toml
We confirm the location of Xen Orchestra's data:
datadir = '/var/lib/xo-server/data'
Click the image to enlarge.
We enable HTTP redirection to HTTPS.
Click the image to enlarge.
We specify the URL that our Xen Orchestra instance will respond to. In my case, I use the hostname of the VM.
Click the image to enlarge.
We enable listening on port 8080 for HTTP and 8443 for HTTPS.
Click the image to enlarge.
We indicate the location of the key and certificate that we will use for HTTPS (we will create these components shortly).
Click the image to enlarge.
We will also customize the mount path for volumes, especially NFS, which Xen Orchestra will use via the path /mnt/xo-server (do not forget to create it and allow the xo user to write to it), and most importantly, we allow Xen Orchestra to run sudo with the option useSudo = true (consistent with our previously created sudo file).
Click the image to enlarge.
We also make sure to create the directory /var/lib/xo-server and assign the appropriate permissions for the xo user, so that it can store Xen Orchestra's data there.
sudo mkdir -p /var/lib/xo-server
sudo chown xo:xo /var/lib/xo-server
Click the image to enlarge.
Similarly, we create the directory /run/xo-server with the appropriate permissions for the xo user so that it can create the process.
sudo mkdir -p /run/xo-server
sudo chown xo:xo /run/xo-server
Click the image to enlarge.
And finally, the directory /mnt/xo-server, again with the correct permissions for the xo user, so that it can create mount points in this folder.
sudo mkdir -p /mnt/xo-server
sudo chown xo:xo /mnt/xo-server
Creating the certificate
To be consistent with this configuration, we will generate the key key.pem and the certificate certificate.pem, which we will place in /etc/xo-server/certs/ (which we will create beforehand, and with the appropriate permissions for the user xo).
I won't go into detail on this point; the idea is not to explain how to create a certificate. Everyone can use the method of their choice depending on their architecture and habits.
Personally, I simply call openssl to generate my CSR (Certificate Signing Request) and my key:
sudo openssl req -new -nodes -sha256 -keyout key.pem -out xo.csr -newkey rsa:4096 \
-subj "/C=FR/ST=Ile-de-France/L=Paris/O=COOLCORP/OU=Infrastructure/CN=prdxcpxor501.coolcorp.priv" \
-reqexts req_ext -config openssl-san.cnf
Click the image to enlarge.
Click the image to enlarge.
Then, I submit my CSR to my internal PKI, in this case a Windows ADCS architecture, to retrieve my certificate:
certreq -attrib "CertificateTemplate:TPL-SRV-WEB-DEFAULT" -submit .\xo.csr
Click the image to enlarge.
Click the image to enlarge.
I place the contents of the key and certificate in the correct folder on the server, and I remember to assign the appropriate permissions so that the xo account can access them:
sudo mkdir -p /etc/xo-server/certs/
sudo chown xo -R /etc/xo-server/certs/
Click the image to enlarge.
Click the image to enlarge.
Click the image to enlarge.
Setting up the service
Before starting the solution, we prepare its service file so that it is managed by systemd:
sudo vi /etc/systemd/system/xo-server.service
Here is the content of the service:
[Unit]
Description=Xen Orchestra Server
After=network-online.target valkey.service
Wants=valkey.service
[Service]
Type=simple
User=xo
Group=xo
WorkingDirectory=/opt/xo/packages/xo-server
ExecStart=/usr/bin/node dist/cli.mjs --config /etc/xo-server/config.yaml
Restart=always
RestartSec=5
Environment="NODE_ENV=production"
SyslogIdentifier=xo-server
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
We find our xo user and specify the configuration file used (optional, but recommended).
Then we refresh systemd, then activate the service and start it:
sudo systemctl daemon-reload
sudo systemctl enable --now xo-server
sudo systemctl status xo-server
Click the image to enlarge.
Don't forget to open firewall ports for access to the interface from outside:
sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --permanent --add-port=8443/tcp
sudo firewall-cmd --reload
Click the image to enlarge.
If everything is working correctly, you can connect to the Xen Orchestra URL, which is https://prdxcpxor501.coolcorp.priv:8443/ for me.
Click the image to enlarge.
By default, the admin user is [email protected] and its password is admin.
Click the image to enlarge.
Click the image to enlarge.
Creating the pool
You will see the Xen Orchestra 6 interface, a new GUI that was in place when this tutorial was written, but which has not yet completely replaced version 5.0.
Click the image to enlarge.
As it stands, the platform offers good visibility with a modern user interface, but we are limited in the actions possible.
Unfortunately, we need to go back to version 5.0 for the next steps. To do this, click on the shortcut in the top right corner.
Click the image to enlarge.
Changing the default admin password
From here, our first instinct will be to change the default password for our admin user.
To do this, in Settings, go to the Users section and edit the password for the account.
Click the image to enlarge.
Click the image to enlarge.
Registering the servers
Next, we register the servers in Xen Orchestra.
Since no hosts are yet registered, you can follow the Add Server prompt, otherwise go to the New section and then Server.
Click the image to enlarge.
Click the image to enlarge.
From there, we enter our three servers using their IP addresses. We use the login and password specified during the XCP-ng installation (see previous article).
Click the image to enlarge.
Don't forget to uncheck the Certificate verification option.
Click the image to enlarge.
Once this step is complete, each server is now present in a pool that bears its name.
Click the image to enlarge.
Moving servers into the same pool
The goal will be to rename the pool of the first server.
To do this, it's very simple: click on the pool in question and rename it to xcp-pool.
Click the image to enlarge.
Click the image to enlarge.
Next, we will configure the other two servers to leave their current pool and join the first server's pool. Again, this is straightforward: we use the GUI to change the pool membership.
Click the image to enlarge.
We navigate to the xcp-pool, and then, using the add hosts option, we add the other servers.
Click the image to enlarge.
Click the image to enlarge.
Finally, our three servers are in the xcp-ng pool, and you can see that prdxcpsrv001 is recognized as the master.
Click the image to enlarge.
Click the image to enlarge.
We can return to the Xen Orchestra 6 view using the Try XO 6 option. We have a more pleasant view of the entire system. Please note that the following screenshot was taken after adding additional VMs, and importantly, the master has switched to prdxcpsrv002 due to a HA test.
Click the image to enlarge.
Click the image to enlarge.
Click the image to enlarge.
Click the image to enlarge.
Configuring auto-start
Before stopping, we will simply enable the auto_poweron feature at the pool level.
This will allow us, for specific VMs, to ensure that they restart automatically in case of an incident or service recovery.
We'll go back to the CLI for this, by connecting via SSH to the master server of the pool.
We retrieve the UUID of our newly created pool:
POOL_UUID=$(xe pool-list --minimal)
Click the image to enlarge.
Then we enable the option:
xe pool-param-set uuid=$POOL_UUID other-config:auto_poweron=true
Finally, we apply the autostart setting to our Xen Orchestra VM:
VM_UUID=$(xe vm-list name-label=prdxcpxor501 --minimal)
xe vm-param-set uuid=$VM_UUID other-config:auto_poweron=true
Click the image to enlarge.
In this way, we ensure that Xen Orchestra starts as soon as possible in case of a problem (e.g., server restarts), so that we can regain access to the GUI and automatically view the pool.
Conclusion
Xen Orchestra is now deployed with an operational pool consisting of our XCP-ng servers.
It's unfortunate that version 6 is not yet complete, forcing us to use version 5.0 for some tasks. However, the ergonomic and design choices are heading in the right direction, in my opinion.
Now it's time to move on to advanced configuration, including defining networks and storage.
This is the goal of the next article.