Install Xen Orchestra on Ubuntu 20

Prework

apt-get update && apt-get dist-upgrade

Node.js

For this particular installation node 16 is needed to be installed. Lets install-

Add NodeSource PPA

This command will add PPA sources required to be able to install NodeJS 16 on your Ubuntu 20.04 installation:

curl -s https://deb.nodesource.com/setup_16.x | sudo bash

Install NodeJS 16

Now that the PPA source has been added, we can install NodeJS 16 on our Ubuntu 20.04 installation. Run the following command:

sudo apt install nodejs -y

Tip: The -y flag means we’re not prompted to confirm our choices.

Yarn

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

Packages

XO needs the following packages to be installed. Redis is used as a database by XO. 

apt-get install build-essential redis-server libpng-dev git python3-minimal libvhdi-utils lvm2 cifs-utils

Fetching the Code

You need to use the git source code manager to fetch the code. Ideally, you should run XO as a non-root user, and if you choose to, you need to set up sudo to be able to mount NFS remotes. As your chosen non-root (or root) user, run the following:

cd /opt/
git clone -b master https://github.com/vatesfr/xen-orchestra

TIP

The same sources are available in below of this post just in order to make sure that an updated version doesn’t colide with this documented installation process.

cd /opt/xen-orchestra
yarn
yarn build

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

cd packages/xo-server
mkdir -p ~/.config/xo-server
cp sample.config.toml ~/.config/xo-server/config.toml

** Note: If you’re installing xo-server as a global service, you may want to copy the file to /etc/xo-server/config.toml instead. (however I just skipped it- you may use it as per https://xen-orchestra.com/docs/installation.html#from-the-sources repository)

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:

yarn start
WebServer listening on localhost:80
[INFO] Default user: "admin@admin.net" with password "admin"

Running XO

The only part you need to launch is xo-server, which is quite easy to do. From the xen-orchestra/packages/xo-server directory, run the following:

yarn start

That’s it! Use your browser to visit the xo-server IP address, and it works! 😃

Run the below as the user owning XO as orchestra serviceforever start dist/cli.mjs

Or you can use forever-service (opens new window)to install XO as a system service, so it starts automatically at boot. Run the following as root:

yarn global add forever
yarn global add forever-service

Be sure to edit the path below to where your install is located!

cd /opt/xen-orchestra/packages/xo-server/

Change the username below to the user owning XO (in my case it was root)

forever-service install orchestra -r root -s dist/cli.mjs

The forever-service command above must be run in the xo-server bin directory. Now you can manage the service, and it will start on boot with the machine:

service orchestra start
service orchestra status

If you need to delete the service:

forever-service delete orchestra

Ref:
https://www.stewright.me/2022/01/tutorial-install-nodejs-16-on-ubuntu-20-04/
https://computingforgeeks.com/install-xen-orchestra-on-ubuntu-debian-linux/
https://xen-orchestra.com/docs/installation.html#from-the-sources

Share

Leave a Reply

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