Install Xen Orchestra on Ubuntu 20.04|Debian 10 to Manage Xen/XCP-ng

Posted on 143 views

Xen Orchestra (XO) is a web interface tool for Xen and XCP-ng Administrators to visualize and administer the complete Virtualization stack. The Xen Orchestra doesn’t require an agent installed on the Desktop machine for it work. All operations are performed from a web interface.

On the VM that hosts Xen Orchestra below are the minimal hardware requirements:

  • 2 vCPUs
  • 2GiB of RAM
  • 20GiB of free SR space (2GiB on thin pro SR)

The installation can be done on an instance running in XCP-ng or any other virtualization environment provided connectivity to Xen/XCP-ng servers is available.

To use a ready appliance refer to Deploying Xen Orchestra Appliance on Xen/XCP-ng from CLI

Step 1: Update System

Let’s start the installation by updating all the system packages:

sudo apt update

Also consider performing an upgrade:

sudo apt upgrade -y

With the upgrade done you can reboot now or at later stage.

Step 2: Install Node.js 14 on Ubuntu | Debian

The next step is the installation of Node.js on Ubuntu / Debian Linux system:

curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -

Once the repository is added proceed to install Node.js:

sudo apt install -y nodejs

To install the Yarn package manager, run:

curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn

Confirm installation of Node.js and Yarn

$ node -v
v14.16.1

$ yarn -v
1.22.5

Step 3: Install XO packages on Ubuntu 20.04|Debian 10

Install Python:

#For Python 2
sudo apt install python2-minimal

#For Python 3
sudo apt install python3-minimal

Install XO packages on Ubuntu 20.04|Debian 10 by running the commands below:

sudo apt update
sudo apt install build-essential redis-server libpng-dev git libvhdi-utils lvm2 cifs-utils

Confirm package installations:

The following NEW packages will be installed:
  binutils binutils-common binutils-x86-64-linux-gnu build-essential cifs-utils cpp cpp-9 dpkg-dev fakeroot g++ g++-9 gcc gcc-9 gcc-9-base
  libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan5 libatomic1 libbfio1 libbinutils libc-dev-bin libc6-dev libcc1-0 libcrypt-dev
  libctf-nobfd0 libctf0 libdpkg-perl libfakeroot libfile-fcntllock-perl libgcc-9-dev libgomp1 libhiredis0.14 libisl22 libitm1 libjemalloc2 liblsan0 liblua5.1-0
  libmpc3 libpng-dev libpng-tools libquadmath0 libstdc++-9-dev libtalloc2 libtevent0 libtsan0 libubsan1 libvhdi-utils libvhdi1 libwbclient0 linux-libc-dev
  lua-bitop lua-cjson make manpages-dev redis-server redis-tools zlib1g-dev
0 upgraded, 58 newly installed, 0 to remove and 0 not upgraded.
Need to get 42.3 MB of archives.
After this operation, 184 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

Step 4: Fetch Xen Orchestra Code and Build it

Next is to clone Xen Orchestra code from github:

git clone -b master http://github.com/vatesfr/xen-orchestra

Now that you have the code, you can enter the xen-orchestra directory

cd xen-orchestra

The start building of Xen Orchestra and install other dependency packages on Ubuntu / Debian system.

$ yarn
yarn install v1.22.5
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
warning [email protected]: Invalid bin field for "url-loader".
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
[5/5] Building fresh packages...
Done in 180.55s.

$ yarn build
...
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
[10:36:00] Finished 'buildStyles' after 6.95 s
[10:36:00] Finished 'copyAssets' after 6.96 s
Successfully compiled 129 files with Babel (17350ms).

[10:37:55] Finished 'buildScripts' after 2.03 min
[10:37:55] Finished 'build' after 2.03 min
Done in 138.77s.

Now you have to create a config file for xo-server:

cd packages/xo-server
sudo mkdir /etc/xo-server
sudo cp sample.config.toml /etc/xo-server/config.toml

In this config file, you can change default ports (80 and 443) for xo-server. If you are running the server as a non-root user, you will need to set the port to 1024 or higher.

You can try to start xo-server to see if it works. You should have something like this:

$ sudo yarn start
yarn run v1.22.5
$ node bin/xo-server
  app-conf /home/jkmutai/xen-orchestra/packages/xo-server/config.toml +0ms
  app-conf /etc/xo-server/config.toml +6ms
2021-04-20T10:42:27.569Z xo:main INFO Configuration loaded.
2021-04-20T10:42:27.575Z xo:main INFO Web server listening on http://[::]:80
2021-04-20T10:42:27.651Z xo:mixins:hooks DEBUG start start…
2021-04-20T10:42:27.774Z xo:mixins:hooks WARN start failure 
  error: Error: Command failed with exit code 5: vgchange -an
    Logical volume ubuntu-vg/ubuntu-lv contains a filesystem in use.
    Can't deactivate volume group "ubuntu-vg" with 1 open logical volume(s)
      at makeError (/home/jkmutai/xen-orchestra/node_modules/execa/lib/error.js:59:11)
      at handlePromise (/home/jkmutai/xen-orchestra/node_modules/execa/index.js:114:26)
      at processTicksAndRejections (internal/process/task_queues.js:93:5) 
    shortMessage: 'Command failed with exit code 5: vgchange -an',
    command: 'vgchange -an',
    exitCode: 5,
    signal: undefined,
    signalDescription: undefined,
    stdout: '',
    stderr: '  Logical volume ubuntu-vg/ubuntu-lv contains a filesystem in use.\n' +
      `  Can't deactivate volume group "ubuntu-vg" with 1 open logical volume(s)`,
    failed: true,
    timedOut: false,
    isCanceled: false,
    killed: false
  

  app-conf /home/jkmutai/xen-orchestra/packages/xo-server/config.toml +219ms
  app-conf /etc/xo-server/config.toml +2ms
2021-04-20T10:42:27.799Z xo:xo-mixins:subjects INFO Default user created: [email protected] with password admin
2021-04-20T10:42:27.807Z xo:mixins:hooks DEBUG start finished
2021-04-20T10:42:27.808Z xo:mixins:hooks DEBUG clean start…
2021-04-20T10:42:27.822Z xo:mixins:hooks DEBUG clean finished
2021-04-20T10:42:27.931Z xo:main INFO Setting up / → /home/jkmutai/xen-orchestra/packages/xo-web/dist

Use forever-service to install XO as a system service:

$ sudo yarn global add forever
yarn global v1.22.5
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...

success Installed "[email protected]" with binaries:
      - forever
Done in 21.97s.

$ sudo yarn global add forever-service
yarn global v1.22.5
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...

success Installed "[email protected]" with binaries:
      - forever-service
      - get-forever-config
Done in 8.77s.

$ cd ~/xen-orchestra/packages/xo-server/bin/
$ sudo forever-service install orchestra -r root -s xo-server
forever-service version 0.5.11
Platform - Ubuntu 20.04.2 LTS
orchestra provisioned successfully

Below are the commands to interact with service orchestra:

Start   - "sudo service orchestra start"
Stop    - "sudo service orchestra stop"
Status  - "sudo service orchestra status"
Restart - "sudo service orchestra restart"

Let’s start the service:

sudo service orchestra start

Confirm the service is running:

$ sudo ss -tunelp | grep *:80
tcp    LISTEN  0       511                        *:80                  *:*      users:(("node",pid=269785,fd=18)) ino:1883628 sk:9 v6only:0 <->

If you ever need to delete the service, run the command:

sudo forever-service delete orchestra

Additionally install xo-cli tool.

$ sudo npm install --global xo-cli
npm WARN deprecated [email protected]: Use mz or fs-extra^3.0 with Promise Support
npm WARN deprecated [email protected]: looking for maintainer
/usr/bin/xo-cli -> /usr/lib/node_modules/xo-cli/dist/index.js
+ [email protected]
added 75 packages from 50 contributors in 26.199s

Step 5: Access Xen Orchestra Web interface

You can now access the web UI of Xen Orchestra by putting the IP you configured during deployment into your web browser.

Install-Xen-Orchestra-Ubuntu-Debian-01-1024x601 (1)

Use below default login credentials:

Username: [email protected]
Password: admin

Navigate to “Settings” > “Users

Install-Xen-Orchestra-Ubuntu-Debian-02-1024x739

Select admin user and click “edit” under Password section to update user’s password.

Install-Xen-Orchestra-Ubuntu-Debian-03-1024x172

Step 6: Add XenServer | XCP-ng Server

Add the Xen|XCP-ng server by going to “Home” > “Add server

Install-Xen-Orchestra-Ubuntu-Debian-04-1024x338

Input the server labelIP AddressUsername and Password used to login.

Install-Xen-Orchestra-Ubuntu-Debian-05-1024x232

Confirm connection is successful

Install-Xen-Orchestra-Ubuntu-Debian-06-1024x124

You can now see existing Virtual Machines and create new ones from XO console.

Install-Xen-Orchestra-Ubuntu-Debian-07-1024x598

 

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.