In this article, we’ll cover how to install Xen Orchestra on CentOS for better cloud group management, resource distribution, and easy permissions. So, let’s get started!
XenServer Overview
XenServer is a hypervisor built by Citrix Systems. This hypervisor provides a virtualization platform for server and desktop systems. In other words, it is a web console for XenServer administration and management.
Furthermore, Xen Orchestra is a solution for XenServer and XCP-ng virtual environment management. It provides a graphical interface to manage virtual machines. Hence, users don’t have to use complicated commands when creating new virtual machines, delegating resources, monitoring hardware resource utilization, and moving machines from one host to another.
Prerequisites
For this tutorial, you’ll need a CentOS machine with sudo access or root privilege. In addition, you’ll have to meet the following hardware requirements:
- 2 GB of RAM
- 20 GB of disk space
- 2 vCPUS
For this tutorial, we’re using the fresh installation of CentOS.
How to Install Xen Orchestra on CentOS
In this section, we’ll cover how to install Xen Orchestra on CentOS for managing XenServer via the web console. So, let’s get started!
Update the CentOS Machine
The first step is to update the machine. Open the Terminal by pressing “Ctrl + Alt + T” and run the update
command. Specifically, type:
sudo dnf -y update
Wait for the system to complete the process. Once it is updated, reboot the system. For this step, use the reboot
command:
sudo systemctl reboot
After the reboot is done, proceed to the next step.
Install Node.js and Yarn
Next, we’ll install some prerequisite applications to install Xen Orchestra on CentOS. For this step, execute the command given below:
curl -sL https://rpm.nodesource.com/setup_16.x | sudo bash -
This command adds the Node.js repository to the CentOS system. Once the repository is added, we’ll install it using the install
command. Specifically, type:
sudo dnf install -y nodejs
After that, we’ll install the Yarn package manager. For this step, type:
sudo yum install gcc-c++ make -y
Next, add the Yarn package repository:
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
After that, install the Yarn package manager using the yum package manager. For instance, type:
sudo yum install yarn -y
Lastly, we’ll confirm the installation of both applications by typing the application name with the -v
or –version
option. For example:
node -v
yarn -v
Install Xen Orchestra on CentOS
To install Xen Orchestra on CentOS, we’ll install Python3 on the system using the dnf package manager as shown below:
sudo dnf install python3 -y
After that, we’ll install the dependency packages required to install Xen Orchestra on CentOS. To install the list of packages, execute the commands given below:
sudo dnf -y install epel-release
sudo dnf -y install git redis libpng-devel git lvm2 cifs-utils make automake gcc gcc-c++ rpm-build fuse-devel python3-devel
sudo dnf -y install git autoconf automake gettext-devel libtool pkg-config libvhdi-tools
You should get a similar output:
Wait for the installation process to complete. To install the libvhdi package, we’ll get the link using the wget
command, as it is not available in the dnf package. For this step, type:
wget https://download.opensuse.org/repositories/openSUSE:/Factory/standard/src/libvhdi-20221124-3.7.src.rpm
Once the package has been downloaded, install it as shown below:
sudo rpm -Uvh libvhdi-20221124-3.7.src.rpm
Fetch and Build Xen Orchestra
Now to start using Xen Orchestra to manage the XenServers, we’ll configure it. First, get the Xen Orchestra guide from GitHub using the git clone
command:
git clone -b master https://github.com/vatesfr/xen-orchestra
Output:
After that, navigate to the xen-orchestra
directory:
cd xen-orchestra
Next, we’ll build the Xen Orchestra. For this step, we’ll first update the package.json
file to build fresh packages in the xen-orchestra directory. For this step, we’ll use the yarn
command:
yarn
After that, execute the command given below:
yarn build
Now we’ll install xo-server
packages:
turbo run build --scope xo-server --scope xo-server-'*' --scope xo-web
Next, we’ll create a config file for xo-server. For this step, first, navigate to the packages/xo-server
directory:
cd packages/xo-server
Create a new directory called /etc/xo-server
:
sudo mkdir /etc/xo-server
After that, copy the configuration files as shown below::
sudo cp sample.config.toml /etc/xo-server/config.toml
In this config file, we’ll change the default ports for the xo-server. Change the default port from 80
to 1024
if you are using it as a non-root user. For this step, open the config file using the nano or vim editor:
# nano editor
nano /etc/xo-server/config.toml
# vim editor
vim /etc/xo-server/config.toml
Lastly, we’ll start and enable redis service.
sudo systemctl enable --now redis
Start the Xo-Server
Now we’ll use the yarn
command to start the xo-server. For this step, type:
sudo yarn start
Configure Forever Service to Install XO as a System Service
Forever service is a node script that provides service via forever command. In other words, it automatically starts the service on boot. In this section, we’ll configure the forever-service
to install XO as a system service.
In the xo-server
directory, add global:
yarn global v1.22.19
After that, add forever-service
as shown below:
yarn global v1.22.19
Next, add the pm2 service:
yarn global v1.22.19
Change directory to ~/xen-orchestra/packages/xo-server/
as shown below:
cd ~/xen-orchestra/packages/xo-server/
After that, install the orchestra using the forever-service
command. Specifically, type:
forever-service install orchestra -r root -s dist/cli.mjs
Xen Orchestra Commands
There are several commands that you can use to manage and interact with the service orchestra. The commands are listed below:
sudo service orchestra start
: start the orchestra service
sudo service orchestra stop
: stop the orchestra service
sudo service orchestra status
: view the orchestra status
sudo service orchestra restart
: restart the orchestra service
Start Orchestra Service
To start the orchestra using pm2, you’d type:
pm2 start dist/cli.mjs
There are several other commands that you can use to manage the load balancer of Node.js applications.
For instance, to daemonize any application, type:
pm2 start app.js
Alternatively, to load balance different instances, use this command:
pm2 start api.js -i 4
For monitoring production, execute:
pm2 monitor
Lastly, to make this service auto-start on boot, use the startup
command:
pm2 startup
For more information on Production Process Manager, check out its official documentation.
In addition to this, you can also view the status of pm2 services. For this step, type:
pm2 status
Furthermore, to generate an active startup script, we can use the startup
and save
command as shown below:
pm2 startup && pm2 save
Next, confirm that the service is running using the ss
command. Pipe the command output to the grep
command to specifically search for this service:
sudo ss -tunelp | grep *:80
To delete this current service, use the forever-service
command. Specifically, type:
forever-service delete orchestra
Apart from these commands, xo-cli tools are also useful in managing oxo containers. To get the cli tools, install them using the npm package manager. For example, type:
sudo npm install --global xo-cli
Access the Xen Orchestra Web interface
Now that we’ve looked at the basic Xen commands, it’s time to look at the Xen Orchestra web interface. In this section, we’ll access the Xen interface using the IP address we used during the configuration.
You can now access the web UI of Xen Orchestra by putting the IP you configured during deployment into your web browser. Type the https:///www.ip-address/login
in the web browser to get the login page. You should get a similar output:
Next, type the default username and password to log in. The credentials are:
Username: [email protected]
Password: admin
Once you’ve logged in, navigate to Settings > Users.
Select admin user, click Edit, and update the password under the Password section.
Add XenServer | XCP-ng Server to Xen Orchestra on CentOS
Now, to add the XenServer or XCP-ng to Xen Orchestra, go to Home from the side menu bar. Next, click Add Server.
In the appeared window, input the server label, IP Address, username, and password. Make sure to use the same credentials you used to log in.
The output looks like this:
Click Connect to confirm the successful connection. Finally, you can see your existing virtual machines.
In this guide, we’ve covered how to install Xen Orchestra and Xen CLI tools. We’ve also discussed some basic commands to manage xen services on CentOS.
If this guide helped you, please share it.