WebVirtMgr is an awesome simple web interface for managing virtual machines on Linux. Unfortunately the installation process is not simple at all, and the documentation is a bit lacking. There are also a few issues which are documented only in the bugtracker and not the documentation, as well as some Arch-specific issues. I’ve compiled all of the fixes I’ve discovered below, so hopefully your install process won’t be as painful as mine.
Updated 2/19/14 to reflect bugfixes and updates
Updated 3/11/14 for code and package updates
Prereqs
First, make sure you have novnc installed, which is currently available from the AUR. Install it manually or use your favorite AUR helper.
packer -S novnc gunicorn
The backend of this web interface runs on libvirtd, which must be installed, along with some optional dependencies:
pacman -S libvirt urlgrabber qemu dnsmasq bridge-utils ebtables dmidecode python2-django
Next, edit the configuration file /etc/conf.d/libvirt and add –listen to the args:
LIBVIRTD_ARGS="-p /var/run/libvirt.pid --listen"
Now edit /etc/libvirt/libvirtd.conf. Disable tls, enable tcp, set auth to sasl. Everything else should be commented out for simple configurations.
auth_tcp = "sasl" listen_tls = 0 listen_tcp = 1
Edit /etc/libvirt/qemu.conf and make sure that vnc_listen is set to listen on all addresses.
vnc_listen = 0.0.0.0
You may want to enable additional VNC options which may solve VNC encryption problems I discuss below. Let me know if this works for you!
Now start the libvirtd service:
systemctl enable libvirtd systemctl start libvirtd
Installation
Clone the git repository to /var/www/webvirtmgr and then change the owner to http
git clone git://github.com/retspen/webvirtmgr.git
chown -R http:http /var/www/webvirtmgr
Next, edit manage.py and change “python” in the first line to “python2”. Alternatively, use one of the other official methods of dealing with multiple versions of python on Arch Linux.
Run manage.py to generate the database and create credentials.
./manage.py syncdb
Apache Config
This section is incomplete, Apache now just needs to proxypass the gunicorn server from localhost:8000
Put configuration for proxypass here
Make sure you include this conf file in your main apache config by adding this line to /etc/httpd/conf/httpd.conf
Include conf/extra/webvirtmgr.conf
Finally, restart apache so your changes take effect
systemctl restart httpd.service
Gunicorn Server
WebVirtMgr is now served with gunicorn. The developer launches this service with supervisor to overcome limitations of initscript-based systems, but systemd fills this need nicely> I wrote a simple service file to handle webvirtmgr:
[Unit] Description=WebVirtMgr Gunicorn Server [Service] User=http Group=http ExecStart=/usr/bin/env python2 /srv/webvirtmgr/manage.py run_gunicorn -c /var/www/webvirtmgr/conf/gunicorn.conf.py Type=simple Restart=on-failure [Install] WantedBy=multi-user.target
Copy this file to /usr/lib/systemd/system/webvirtmgr.service and start the service!
systemctl enable webvirtmgr.service systemctl start webvirtmgr.service
Add Users
Adding users is currently done on the command line. Use this command to add the user “joe”:
saslpasswd2 -a libvirt joe
NoVNC Configuration
For easy remote control of your virtual machines, you probably want to use the novnc feature of WebVirtMgr.
First, edit /var/www/webvirtmgr/console/webvirtmgr-novnc and replace “python” on the first line with “python2” or use the alternative method(s) as mentioned above.
Copy the service from conf/initd/webvirtmgr-novnc-arch to /usr/lib/systemd/system/webvirtmgr-novnc.service (make sure to include the .service extension which is omitted in the repository).
Next, create a systemd service file in /etc/systemd/system/webvirtmgr-novnc.service
Now enable and start the service you just created.
systemctl enable webvirtmgr-novnc.service
systemctl start webvirtmgr-novnc.service
NoVNC Encryption Fix
This issue is now resolved, see the github issue for details.
NoVNC doesn’t work with SSL because encryption is automatically enabled, which fails for some reason. To disable encryption, edit templates/console.html and force set encrypt to false.
rfb = new RFB({'target': $D('noVNC_canvas'), 'encrypt': false, 'repeaterID': WebUtil.getQueryVar('repeaterID', ''),
Use the Interface
Navigate to the virtual host you configured and you should be greeted with a web interface! If you have any issues, feel free to leave a comment below.
Other Items
There were a few things I didn’t cover which are covered by WebVirtMgr’s actual documentation, such as configuring your firewall and verifying that libvirt is working properly. I strongly recommend you take a look at their documentation (especially the last two sections).
I’ve found a way to enable SSL encryption with NoVNC. At least in firefox it is now working. I’ve used debian as a server, but should work in arch too.
First insert your Cert path in /var/www/webvirtmgr/console/webvirtmgr-novnc
————-example ——
CERT = ‘/path/to/ssl/cert’
server = NovaWebSocketProxy(listen_host=LISTEN_HOST,
listen_port=LISTEN_PORT,
source_is_ipv6=False,
verbose=False,
cert=CERT,
……
————
make sure your webserver can read the ssl cert (dont know if this is wise regarding security… but the webproxy with the same rights as apache)
Now open firefox and go to https://yourserver:6080 and accept the certificate (6080 is the novnc is listening). Now it is working for me.
Hope that helps.