WebVirtCloud is web interface build for KVM virtualization Administrators and Users. WebVirtCloud allows you to create, manage and delete Virtual Machines running on KVM hypervisor from an intuitive web console. A noVNC viewer presents a full graphical console to the guest domain. In this article we perform installation of WebVirtCloud KVM Management Dashboard on CentOS Stream 8 Linux operating system.
WebVirtCloud solution is built on Python 3.x & Django 3.2 LTS. These are the main dependencies for this installation. But we’ll provide you with all the steps that you’ll use to install WebVirtCloud KVM Management Dashboard on CentOS Stream 8. Some key features of WebVirtCloud are highlighted below:
- Management of QEMU/KVM Hypervisor
- Management of QEMU/KVM Instances – Creation, Deletion, and instance update
- Provides web based stats for the Hypervisor & Instance
- You’re able to manage multiple QEMU/KVM Hypervisors from same installation.
- Management of Hypervisor Networks
- Management of Datastore pools in your Hypervisor setup.
- Support for user based Authorization and Authentication
- Instance Console Access with Browsers
- Supports cloud-init datasource interface
- Management UI for Libvirt API
- A user can add SSH public key to root in Instance (Tested only Ubuntu)
- User can change root password in Instance (Tested only Ubuntu)
Before you begin this installation you should have a Centos/OEL/RHEL 8 server setup.
Step 1: Update CentOS 8 / CentOS Stream 8
Login to the instance and ensure updates are done:
sudo dnf -y update
If you need to convert CentOS 8 server to CentOS Stream 8 check out below guide:
Step 2: Install KVM on CentOS 8 / CentOS Stream 8
The next step is installation and configuration of KVM on CentOS 8 / CentOS Stream 8. We have a detailed guide on this shared on link below:
Ensure KVM libvirtd service is running:
$ systemctl status libvirtd ● libvirtd.service - Virtualization daemon Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2021-06-21 20:29:16 CEST; 59s ago Docs: man:libvirtd(8) https://libvirt.org Main PID: 23126 (libvirtd) Tasks: 19 (limit: 32768) Memory: 15.3M CGroup: /system.slice/libvirtd.service ├─23126 /usr/sbin/libvirtd --timeout 120 ├─23251 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper └─23252 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper Jun 21 20:29:17 kvm-desktop dnsmasq: reading /etc/resolv.conf Jun 21 20:29:17 kvm-desktop dnsmasq: using nameserver 22.214.171.124#53 Jun 21 20:29:17 kvm-desktop dnsmasq: using nameserver 126.96.36.199#53 Jun 21 20:29:17 kvm-desktop dnsmasq: using nameserver 188.8.131.52#53 Jun 21 20:29:17 kvm-desktop dnsmasq: using nameserver 2a01:4f8:0:1::add:9898#53 Jun 21 20:29:17 kvm-desktop dnsmasq: using nameserver 2a01:4f8:0:1::add:1010#53 Jun 21 20:29:17 kvm-desktop dnsmasq: using nameserver 2a01:4f8:0:1::add:9999#53 Jun 21 20:29:17 kvm-desktop dnsmasq: read /etc/hosts - 9 addresses Jun 21 20:29:17 kvm-desktop dnsmasq: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses Jun 21 20:29:17 kvm-desktop dnsmasq-dhcp: read /var/lib/libvirt/dnsmasq/default.hostsfile
Step 3: Install WebVirtCloud KVM Management Dashboard on CentOS 8 / Stream 8
Download the installer script:
curl -o webvirtcloud-install.sh https://raw.githubusercontent.com/retspen/webvirtcloud/master/install.sh
Make the script executable using chmod command:
chmod +x webvirtcloud-install.sh
Then install WebVirtCloud KVM Management Dashboard on CentOS Stream 8 by running the script using the following command:
The installation can be done on a virtual machine, physical host or on a KVM host itself.
In the first prompt agree to configure fqdn for Nginx:
WEBVIRTCLOUD Welcome to Webvirtcloud Installer for CentOS, Fedora, Debian and Ubuntu! The installer has detected centos version 8. Q. Do you want to configure fqdn for Nginx? (y/n) y
Enter name of server/nginx fqdn:
Q. What is the FQDN of your server? (mykvm.example.com): Setting to mykvm.example.com
Configure NOVNC service and public port number and Listen address:
Q. Do you want to change NOVNC service port number?(Default: 6080) Setting novnc service port 6080 Q. Do you want to change NOVNC public port number for reverse proxy(e.g: 80 or 443)?(Default: 6080) Setting novnc public port 6080 Q. Do you want to change NOVNC host listen ip?(Default: 0.0.0.0) Setting novnc host ip 0.0.0.0
The dependency packages installation is performed by the script and should begin immediately:
* Adding wget & epel-release repository. * Installing OS requirements. * Installing git * Installing python3-virtualenv * Installing python3-devel * libvirt-devel already installed * glibc already installed * Installing gcc * Installing nginx * Installing supervisor * Installing python3-lxml * Installing python3-libguestfs * iproute-tc already installed * Installing cyrus-sasl-md5
Same as all the configurations of the server and other servies
* Setting up hosts file. * Creating webvirtcloud user. * Cloning webvirtcloud from github to the web directory. * Configuring settings.py file. * Secret for Django generated: 0lbbiij(v+$8*r(o*l#wodwdry&3vu&!a8_#!xl68n*p)%endp * Activate virtual environment. Using base prefix '/usr' New python executable in /srv/webvirtcloud/venv/bin/python3 Also creating executable in /srv/webvirtcloud/venv/bin/python Installing setuptools, pip, wheel...done. Running virtualenv with interpreter /bin/python3 * Install App's Python requirements. Requirement already satisfied: pip in ./venv/lib/python3.6/site-packages (21.1.2) * Django Migrate. Operations to perform: Apply all migrations: accounts, admin, appsettings, auth, computes, contenttypes, instances, logs, otp_totp, sessions Running migrations: No migrations to apply. Your models in app(s): 'accounts', 'appsettings', 'computes', 'instances', 'logs', 'otp_totp' have changes that are not yet reflected in a migration, and so won't be applied. Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them. ! SHOW_PROFILE_EDIT_PASSWORD is found inside settings.py * Applying permission can_change_password for all users ! Warning!!! Setting to True for all users ! Don`t forget to remove the option from settings.py Migrations for 'accounts': accounts/migrations/0006_auto_20210622_1626.py - Alter field id on userattributes - Alter field id on userinstance - Alter field id on usersshkey Migrations for 'appsettings': appsettings/migrations/0006_alter_appsettings_id.py - Alter field id on appsettings Migrations for 'computes': computes/migrations/0004_alter_compute_id.py - Alter field id on compute Migrations for 'instances': instances/migrations/0010_auto_20210622_1626.py - Alter field id on flavor - Alter field id on instance Migrations for 'logs': logs/migrations/0004_alter_logs_id.py - Alter field id on logs Migrations for 'otp_totp': venv/lib/python3.6/site-packages/django_otp/plugins/otp_totp/migrations/0003_alter_totpdevice_id.py - Alter field id on totpdevice * Configuring Nginx. * Copying Nginx configuration * Configuring Supervisor. * Copying supervisor configuration not running * Setting Supervisor to start on boot and restart. * Setting Nginx to start on boot and starting Nginx.
If the installation was successful you should get the URL used to access webvirtcloud web console.
***Open http://mykvm.example.com to login to webvirtcloud.*** * Cleaning up... * Finished!
Step 4: Access WebVirtCloud Web Dashboard
Go to http://serverip_or_hostname and you should see the login screen.
The default login credentials are:
Username: admin Password: admin
Change the admin user password after first login under admin > Profile
Click on “Change Password” button.
Input new user password and confirm.
Step 5: Add KVM Compute Hosts to Manage
On your webvirtcloud server generate ssh keys:
$ 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:H8fD+jjnaZQVjAj2sN3ObXpENOwwKQsogo1O2L/I5oM [email protected] The key's randomart image is: +---[RSA 3072]----+ |.= .+. . =o | |+.+ . ...=o.=.+. | |o o . ..oo.+.. | | . . .= oo | | . . . S . Bo+ | | + . . +o= | | + o.. . | |E o .ooo | | . .=+ | +----[SHA256]-----+
You can optionally disable StrictHostKeyChecking.
cat > /var/lib/nginx/.ssh/config << EOF Host * StrictHostKeyChecking no EOF
Set ownership of the SSH configuration file to nginx user:
chown nginx -R /var/lib/nginx/.ssh/config
Confirm the files were created and are visible.
$ ls -lh /var/lib/nginx/.ssh/ total 12K -rw-r--r-- 1 nginx root 32 Jun 22 17:01 config -rw------- 1 nginx nginx 2.6K Jun 22 16:59 id_rsa -rw-r--r-- 1 nginx nginx 571 Jun 22 16:59 id_rsa.pub
You need to upload webvirtcloud public key into authorized keys on the compute node.
For Local KVM Node:
cat /var/lib/nginx/.ssh/id_rsa.pub >>~/.ssh/authorized_keys cat ~/.ssh/authorized_keys
For a remote compute node you can use ssh tool from the webvirtcloud server:
sudo -u nginx ssh-copy-id [email protected] sudo -u nginx ssh-copy-id [email protected]
Test connection as nginx user:
$ sudo -u nginx ssh [email protected] Warning: Permanently added '127.0.0.1' (ECDSA) to the list of known hosts. Last login: Tue Jun 22 19:44:38 2021 from 127.0.0.1 [[email protected] ~]# exit logout Connection to 127.0.0.1 closed.
From the WebVirtCloud KVM Management web console navigate to Computes
Choose SSH connection method to add your KVM Nodes and input KVM node details – Name, IP/FQDN, Login username:
If all goes well the Status of the new node should show “Connected“
In our next article we will show how you can use WebVirtCloud to create, update and delete Virtual Machines on a KVM hypervisor. Other KVM Administrative tasks such as Storage and Networks Management can be performed from the web interface.
More guides on KVM: