Install Xen Orchestra on Ubuntu / Debian

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

Step 2: Install Node.js on Ubuntu / Debian

Install dependencies.

sudo apt install -y ca-certificates curl gnupg

Import GPG repository keys:

sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg

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

NODE_MAJOR=18

echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list

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

sudo apt update && 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 update && sudo apt install yarn -y

Confirm installation of Node.js and Yarn

$ node -v
v12.22.9

$ yarn -v
1.22.19

Step 3: Install XO packages

Install Python:

#For Python 3

sudo apt install python3-minimal

#For Python 2

sudo apt install python2-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 https://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.19
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
[4/5] Linking dependencies...
[5/5] Building fresh packages...
$ yarn build
yarn run v1.22.19
$ turbo run build --scope xo-server --scope xo-server-'*' --scope xo-web
• Packages in scope: xo-server, xo-server-audit, xo-server-auth-github, xo-server-auth-google, xo-server-auth-ldap, xo-server-auth-oidc, xo-server-auth-saml, xo-server-backup-reports, xo-server-load-balancer, xo-server-netbox, xo-server-perf-alert, xo-server-sdn-controller, xo-server-test, xo-server-test-plugin, xo-server-transport-email, xo-server-transport-icinga2, xo-server-transport-nagios, xo-server-transport-slack, xo-server-transport-xmpp, xo-server-usage-report, xo-server-web-hooks, xo-web
• Running build in 22 packages
• Remote caching disabled

Tasks: 26 successful, 26 total
Cached: 0 cached, 26 total
Time: 2m28.707s

Done in 149.37s.

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.19

You can now open your browser and visit xo-server IP address, and it works! 

Configuring forever service

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

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

success Installed "forever@4.0.3" with binaries:
- forever
Done in 6.06s.
$ sudo yarn global add forever-service
yarn global v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...

success Installed "forever-service@0.5.11" with binaries:
- forever-service
- get-forever-config
Done in 4.28s.
$ cd ~/xen-orchestra/packages/xo-server/
$ sudo forever-service install orchestra -r root -s dist/cli.mjs
forever-service version 0.5.11

Platform - Ubuntu 22.04.2 LTS
orchestra provisioned successfully

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"

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 systemctl start orchestra

Also enable the service to start automatically after system boot.

$ sudo systemctl enable orchestra
orchestra.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable orchestra

Confirm the service is running:

$ sudo ss -tunlp | 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 forever-service delete orchestra

Additionally install xo-cli tool.

$ sudo npm install --global xo-cli
added 45 packages, and audited 46 packages in 6s
5 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
npm notice
npm notice New major version of npm available! 9.6.7 -> 10.0.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.0.0
npm notice Run npm install -g npm@10.0.0 to update!
npm notice

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.

Use below default login credentials:

Username: admin@admin.net
Password: admin

Navigate to “Settings” > “Users“

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

Step 6: Add XenServer | XCP-ng Server

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

Input the server label, IP Address, Username and Password used to login.

Confirm connection is successful

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

Src:
https://computingforgeeks.com/install-xen-orchestra-on-ubuntu-debian-linux/?expand_article=1

Share

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.