Installing WebVirtCloud on Ubuntu Server 20.04

I recently bought a new headless server to handle virtual machines.

I decided to go with the built-in KVM ability of Ubuntu, and used Ubuntu Server 20.04 since it's a LTS (Long Term Support) release.

Unfortunately, there is no built-in ability to remotely manage virtual machines, and while I love the command line, I need to be able to spin up/destroy/repeat virtual machines pretty quickly, without the need to check the exact syntax of my (rather lengthy) command.

VMWare's ESXi has a great web GUI, but I needed more than what the free edition allows, and the non-free version is much more than I wanted to spend for a home lab.

In addition, Docker and Kubernetes support is more important on this box than the ability to run VMs, so VMWare is out.

There is the Virt-Manager GUI for Linux KVM, and it works great, but requires redirecting the display, and I wanted a browser-based solution.

After doing some Google'ing, it came down to WebVirtMgr, Kimchi, and WebVirtCloud.

I tried Kimchi, but couldn't get it to work (update: turns out Kimchi and Ubuntu 20.04 is a no-go, according to this link), and WebVirtMgr hasn't been updated in 5+ years, so I gave WebVirtCloud a spin, especially as the programmer responsible for WebVirtCloud is the same one as WebVirtMgr.

Using the auto install script, installing WebVirtCloud can be pretty simple, but a few changes need to be made to get it to work correctly.

Steps

  1. Download the installer:

    wget https://raw.githubusercontent.com/retspen/webvirtcloud/master/webvirtcloud.sh
    
  2. Change supervisiord references:

    In Ubuntu 20.04, the supervisor daemon is no longer called supervisord, but rather supervisor (no d at the end), so we need to change the references to the supervisor daemon in the config for the Ubuntu install (line 324), highlighted in the code blocks below.

    Old code block:

    case $distro in
      *ubuntu*)
        echo "  The installer has detected $distro version $version codename $codename."
        distro=ubuntu
        nginx_group=www-data
        nginxfile=/etc/nginx/conf.d/$APP_NAME.conf
        supervisor_service=supervisord
        supervisor_conf_path=/etc/supervisor/conf.d
        supervisor_file_name=webvirtcloud.conf
        ;;
    

    New code block:

    case $distro in
      *ubuntu*)
        echo "  The installer has detected $distro version $version codename $codename."
        distro=ubuntu
        nginx_group=www-data
        nginxfile=/etc/nginx/conf.d/$APP_NAME.conf
        supervisor_service=supervisor # Note the name change of the service
        supervisor_conf_path=/etc/supervisor/conf.d
        supervisor_file_name=webvirtcloud.conf
        ;;
    

    Without this change, we get a '502 Bad Gateway' error after logging in.

  3. Install

    chmod +x webvirtcloud.sh
    
    sudo ./webvirtcloud.sh
    
  4. Remove LDAP authentication to prevent 500 Internal Server error:

    Supposedly (link) using pip to install 'ldap3' is supposed to fix this, but in my testing, I had ldap3 installed, and still ran into the '500 Internal Server issue'. As I'm not planning on using LDAP, easiest fix was to simple remove that part of the config:

    sudo sed -i '/"webvirtcloud.ldapbackend.LdapAuthenticationBackend",/d' /srv/webvirtcloud/webvirtcloud/settings.py
    

    After making the change to the /srv/webvirtcloud/webvirtcloud/settings.py file, restart the supervisor service:

    sudo systemctl restart supervisor
    

Resolving post-install issues

  1. Once logged in, I added a 'local' compute server, but it showed 'Not Connected'.

    Trying to add an instance resulted in a /var/run/libvirt/libvirt-sock: No such file or directory error:

    Which was resolved by installing the 'libvirt-daemon-system' package:

    sudo apt-get -y install libvirt-daemon-system
    
  2. After adding the libvirt-daemon-system package, there was still a permissions issue, as I received a /var/run/libvirt/libvirt-sock: Permission denied error when attempting to view the Instances page:

    Adding the www-data user to the libvirt group, then rebooting fixed this issue.

    sudo usermod -a -G libvirt www-data
    
    sudo reboot
    

    After rebooting, the 'Local' compute server should show up as 'Connected', and you shouldn't get an error message on the 'Instances' screen.

Success

WebVirtCloud Compute instances

References

Webvirtcloud https://github.com/retspen/webvirtcloud

Webvirtcloud - 502 Bad Gateway error https://github.com/retspen/webvirtcloud/issues/301