install webvirtcloud rocky almalinux

WebVirtCloud is a web-based KVM virtualization management platform that can help you administer the hypervisor and virtual machines. It enables you to create, manage, access, and delete virtual machines from a web dashboard as opposed to terminal-based operations. Further to that, WebvirtCloud simplifies VM creation through pre-configured templates featuring popular operating systems like Ubuntu, Debian, Fedora, CentOS, AlmaLinux, and Rocky Linux.

In this post we give guidance to Linux users running Rocky / AlmaLinux, or any other derivative of Enterprise Linux OS. The guide will not cover major post-installations tasks, but we hope in future more tutorials will be shared. If you are ready to begin the installation process, launch the terminal to get started!.

1) Install dependencies

Ensure the system you’re working on is up-to-date. It can be a newly provisioned virtual machine (highly recommended), or same computer where KVM is running (not recommended). If you choose to deploy on KVM hypervisor host, beware of breaking the system as a result in unplanned package upgrades.

Run the command below to update system with all packages installed.

sudo dnf -y update

Confirm for kernel updates during upgrade process, if true reboot the system

sudo reboot

After system is back online, open the terminal or install dependencies required to set up WebvirtCloud.

# Enable EPEL repository 
sudo dnf -y install epel-release

# On EL 9 based systems enable crb repository
sudo dnf config-manager --set-enabled crb 2>/dev/null

# Install group development tools
sudo dnf -y groupinstall "Development Tools"

# Install the following additional packages
sudo dnf -y install git gcc libvirt-devel \
glibc supervisor iproute-tc cyrus-sasl-md5 \
cyrus-sasl-devel openldap-devel openssl-devel 

Put SELinux in Permissive mode:

sudo setenforce 0
sudo sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config

2) Install Python 3.11+

We need to install a more recent version of Python. You can install Python 3.11+.

sudo dnf install python3.12 python3.12-pip python3.12-devel

For ease of use, create symlink of python and pip installed

sudo ln -sf /usr/bin/python3.12 /usr/bin/python3
sudo ln -sf /usr/bin/pip3.12 /usr/bin/pip3

Verify installation by querying for Python and Pip versions.

$  /usr/bin/python3 --version
Python 3.12.3

$ /usr/bin/pip3 --version
pip 23.2.1 from /usr/lib/python3.12/site-packages/pip (python 3.12)

Upgrade Pip to latest available upstream version:

sudo /usr/bin/python3 -m pip install --upgrade pip

3) Install Nginx web server

We are using Nginx as WebvirtCloud web server. Install the package by running the following command:

sudo dnf -y install nginx

Start and enable nginx service.

sudo systemctl enable --now nginx

When firewalld is running, you can allow http and https services.

sudo firewall-cmd --add-service={http,https} --permanent

Reload firewalld rules to effect the changes:

sudo firewall-cmd --reload

4) Install and Configure WebVirtCloud

The installation method we are doing in this guide is from source. Clone the project source code from Github.

git clone https://github.com/retspen/webvirtcloud.git

Change into the webvirtcloud directory.

cd webvirtcloud

A template of settings.py is provided. Copy or rename it.

cp webvirtcloud/settings.py.template webvirtcloud/settings.py

Generate SECRET_KEY value by running command below.

SECRET=$(python3 conf/runit/secret_generator.py)

Update SECRET_KEY value in the settings.py file.

sed -i "s|SECRET_KEY = \"\"|SECRET_KEY = \"$SECRET\"|" webvirtcloud/settings.py

Add your server hostname to the list of trusted origins for unsafe requests

$ vi webvirtcloud/settings.py
CSRF_TRUSTED_ORIGINS = ['http://localhost','http://webvirtcloud.example.net']

Substitute webvirtcloud.example.net with correct server hostname/fqdn as configured in DNS server or mapped inside the /etc/hosts file. Example:

172.20.30.10 webvirtcloud.example.net

Copy nginx and supervisord configuration files.

sudo cp conf/nginx/webvirtcloud.conf /etc/nginx/conf.d
sudo cp conf/supervisor/webvirtcloud.conf /etc/supervisord.d/webvirtcloud.ini

In RHEL-based systems, nginx user runs as nginx and not www-data user account. Update supervisor configuration file to reflect the same:

sudo sed -i 's/www-data/nginx/g' /etc/supervisord.d/webvirtcloud.ini

Open and edit nginx configuration file

sudo vi /etc/nginx/conf.d/webvirtcloud.conf

Set correct value for server name and configure files for logging.

server {
    listen 80;

    server_name webvirtcloud.example.net; #Replace with correct hostname
    access_log /var/log/nginx/webvirtcloud_access_log;
    error_log /var/log/nginx/webvirtcloud_error_log;

Move webvirtcloud directory to /srv.

cd ..
sudo mv webvirtcloud /srv

Create python virtual environment for WebvirtCloud.

cd /srv/webvirtcloud
/usr/bin/python3 -m venv venv

Activate newly created virtual environment

source venv/bin/activate

Install Python dependencies inside the virtual environment

pip3 install --upgrade pip
pip3 install -r conf/requirements.txt

Perform migrations and generation of static files.

pip3 install setuptools
python3 manage.py migrate
python3 manage.py collectstatic --noinput

Set ownership to web server user.

sudo chown -R nginx:nginx /srv/webvirtcloud

Start and enable nginx and supervisor services

sudo systemctl enable nginx supervisord
sudo systemctl restart nginx supervisord

Check services managed by supervisor if running

$ sudo supervisorctl status
novncd                           RUNNING   pid 73923, uptime 0:00:10
socketiod                        RUNNING   pid 73924, uptime 0:00:10
webvirtcloud                     RUNNING   pid 73925, uptime 0:00:10

You can also confirm nginx service status

systemctl status nginx

5) Access WebvirtCloud Dashboard

Open your browser and access WebvirtCloud web interface at http://yourserverdomain

Install WebVirtCloud KVM Management CentOS 01

Default username and password is admin / admin. To change the password go to user admin > Profile

image

Click “Change Password” to set a new password.

image 1

Set new password and confirm.

image 2

6) Add KVM Host to WebvirtCloud

Prepare your KVM host by installing the necessary packages and doing other configurations.

On KVM hypervisor

We have created a bash script that helps you set up KVM node. It’s available in our Github repository.

curl -O https://raw.githubusercontent.com/cloudspinx/linux-bash-scripts/main/webvirtcloud/centos-rocky-kvm-prep.sh

Execute the script in the KVM host:

sudo bash centos-rocky-kvm-prep.sh

Use OS provided Python version on gstfsd

  • RHEL 9-based systems
sudo sed -i 's/python3/python3.9/g' /etc/supervisord.d/gstfsd.ini
  • RHEL 8-based systems
sudo sed -i 's/python3/python3.6/g' /etc/supervisord.d/gstfsd.ini

Restart supervisord service.

sudo systemctl restart supervisord

Check services status.

$ sudo supervisorctl status
gstfsd                           STARTING

On WebvirtCloud Instance

Generate SSH key pair on the WebVirtCloud server if none exist already:

$ sudo -u nginx ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/var/lib/nginx/.ssh/id_rsa):
Created directory '/var/lib/nginx/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/lib/nginx/.ssh/id_rsa.
Your public key has been saved in /var/lib/nginx/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:U9TVDTByyHL3hybL3MAB8BQ84SiiTVfW/juaWE7VNiI [email protected]
The key's randomart image is:
+---[RSA 3072]----+
|        +=B*+ooo.|
|       o.*Bo+.  o|
|    o o .+++ o . |
|   + o . .. +.+ .|
|  . .   S E+o*+. |
|         . o=o.. |
|          o  .   |
|         = .o    |
|        . +. .   |
+----[SHA256]-----+

We need to copy generated SSH public key to the KVM hypervisor to enable passwordless authentication:

ssh-copy-id -i /var/lib/nginx/.ssh/id_rsa.pub user@compute-server-ip

For KVM hypervisor that doesn’t allow password authentication, copy the key manually.

cat /var/lib/nginx/.ssh/id_rsa.pub

You can the add contents to the SSH authorized keys file.

vi ~/.ssh/authorized_keys

Test connection from webvirtcloud to KVM host.

sudo -u nginx ssh user@compute-server-ip

# Example
sudo -u nginx ssh [email protected]

If you have an issue with identities remove /var/lib/nginx/.ssh/known_hosts file and retry.

Add a new compute host by going to “Computes” –> “SSH

Install WebVirtCloud KVM Management CentOS 05

Provide host name, username, and IP address used while copying ssh public key.

add compute node webvirtcloud 01

If everything goes well the status should be “Connected“.

add compute node webvirtcloud 02

Click the “eye” icon on the node to start managing virtualization resources in the KVM host. For Storage pools configuration check out the following article:

LEAVE A REPLY

Please enter your comment!
Please enter your name here