[GH-ISSUE #247] WebVirtMgr with MySQL on CentOS 6.5 and nginx setup notes #194

Closed
opened 2026-02-27 16:38:21 +03:00 by kerem · 1 comment
Owner

Originally created by @open-cloud-builder on GitHub (Feb 26, 2014).
Original GitHub issue: https://github.com/retspen/webvirtmgr/issues/247

Privjet,

First: Thank you for this great GUI.
Second: I have no experience in Django or Python, so I struggled with the setup.

I´m trying to set up WebVirtMgr with a MySQL db so I can use a HA MySQL DB backend. The goal is to have multiply redundand WebVirtMgr instances via ucarp with
identical settings & users on different hosts. In this scenario multiply hosts and
vm´s in the cluster can fail, still giving you a nice frontend to manage the
remaining hosts via a nice single web interface and ip/hostname without a complex
full cloud engine.

I´m using Centos 6.5 in this test. I skip the steps to configure a MySQL master/master
setup and ucarp.

Before starting edit the db backend in webvirtmgr/settings.py and settings_jenkins.py

You can enter the creditals for your ucarped master/master mysql db here.

Important changes:

'ENGINE': 'django.db.backends.mysql',
'NAME': 'webvirtmgr',

"NAME" here is the db name not a path. You first must create the db on your mysql server manually.

This further setup needs mysql-python.

python-pip install mysql-python didn´t work, so I used:

yum install MySQL-python

Continue with the steps in the current documentation for CentOS.


I will be using the official nginx repo with the latest nginx for CentOS from here:
http://wiki.nginx.org/Install

In this setup the default www base dir is not "/var/www" but "/usr/share/nginx/html"

So the setup step in the documentation is not

cp /var/www/webvirtmgr/conf/initd/webvirtmgr-novnc-redhat /etc/init.d/webvirtmgr-novnc

but

cp /usr/share/nginx/html/conf/initd/webvirtmgr-novnc-redhat /etc/init.d/webvirtmgr-novnc

Since this is a nginx server running

service webvirtmgr-novnc start

results in
chown: invalid user: `apache'

Therefor edit the webvirtmgr-novnc file:

nano /etc/init.d/webvirtmgr-novnc

Change
username="apache"
to
username="nginx" and save

Change
exec="/var/www/webvirtmgr/console/$prog"
to
exec="/usr/share/nginx/html/console/$prog"

Change the owner & group of "/var/run/webvirtmgr/" to the nginx user/group (498/497)

The novnc service can now start.

service webvirtmgr-novnc start

The documentation is missing the service registering, run:

chkconfig --add webvirtmgr-novnc

chkconfig webvirtmgr-novnc on

The novnc service can now start on every reboot.


The mentioned /etc/supervisor.conf don´t exist, but there is a /etc/supervisord.conf

So change it instead:

nano /etc/supervisord.conf

The correct settings for a nginx setup are:

[program:webvirtmgr]
command=/usr/bin/python /usr/share/nginx/html/manage.py run_gunicorn -c /usr/share/nginx/html/conf/gunicorn.conf.py
directory=/usr/share/nginx/html
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/webvirtmgr.log
redirect_stderr=true
user=nginx


To enter the site you first must start supervisord:

service supervisord start

The supervisord is not enabled to start in the default setup (see "#chkconfig --list"),
enable it to start on each reboot:

chkconfig supervisord on


You must remove the default config for nginx afther adding webvirtmgr.conf
run:

mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bak

Then run:

service nginx restart

Follow the other steps in the documentation accordingly.
You can now log in and use WebVirtMgr with ngingx and mysql on CentOS.

Originally created by @open-cloud-builder on GitHub (Feb 26, 2014). Original GitHub issue: https://github.com/retspen/webvirtmgr/issues/247 Privjet, First: Thank you for this great GUI. Second: I have no experience in Django or Python, so I struggled with the setup. I´m trying to set up WebVirtMgr with a MySQL db so I can use a HA MySQL DB backend. The goal is to have multiply redundand WebVirtMgr instances via ucarp with identical settings & users on different hosts. In this scenario multiply hosts and vm´s in the cluster can fail, still giving you a nice frontend to manage the remaining hosts via a nice single web interface and ip/hostname without a complex full cloud engine. I´m using Centos 6.5 in this test. I skip the steps to configure a MySQL master/master setup and ucarp. Before starting edit the db backend in webvirtmgr/settings.py and settings_jenkins.py You can enter the creditals for your ucarped master/master mysql db here. Important changes: 'ENGINE': 'django.db.backends.mysql', 'NAME': 'webvirtmgr', "NAME" here is the db name not a path. You first must create the db on your mysql server manually. This further setup needs mysql-python. # python-pip install mysql-python didn´t work, so I used: # yum install MySQL-python Continue with the steps in the current documentation for CentOS. --- I will be using the official nginx repo with the latest nginx for CentOS from here: http://wiki.nginx.org/Install In this setup the default www base dir is _not_ "/var/www" but "/usr/share/nginx/html" So the setup step in the documentation is _not_ # cp /var/www/webvirtmgr/conf/initd/webvirtmgr-novnc-redhat /etc/init.d/webvirtmgr-novnc but # cp /usr/share/nginx/html/conf/initd/webvirtmgr-novnc-redhat /etc/init.d/webvirtmgr-novnc Since this is a nginx server running # service webvirtmgr-novnc start results in chown: invalid user: `apache' Therefor edit the webvirtmgr-novnc file: # nano /etc/init.d/webvirtmgr-novnc Change username="apache" to username="nginx" and save Change exec="/var/www/webvirtmgr/console/$prog" to exec="/usr/share/nginx/html/console/$prog" Change the owner & group of "/var/run/webvirtmgr/" to the nginx user/group (498/497) The novnc service can now start. # service webvirtmgr-novnc start The documentation is missing the service registering, run: # chkconfig --add webvirtmgr-novnc # chkconfig webvirtmgr-novnc on The novnc service can now start on every reboot. --- The mentioned /etc/supervisor.conf don´t exist, but there is a /etc/supervisord.conf So change it instead: # nano /etc/supervisord.conf The correct settings for a nginx setup are: [program:webvirtmgr] command=/usr/bin/python /usr/share/nginx/html/manage.py run_gunicorn -c /usr/share/nginx/html/conf/gunicorn.conf.py directory=/usr/share/nginx/html autostart=true autorestart=true stdout_logfile=/var/log/supervisor/webvirtmgr.log redirect_stderr=true user=nginx --- To enter the site you first must start supervisord: # service supervisord start The supervisord is not enabled to start in the default setup (see "#chkconfig --list"), enable it to start on each reboot: # chkconfig supervisord on --- You must remove the default config for nginx afther adding webvirtmgr.conf run: # mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bak Then run: # service nginx restart Follow the other steps in the documentation accordingly. You can now log in and use WebVirtMgr with ngingx and mysql on CentOS.
kerem closed this issue 2026-02-27 16:38:21 +03:00
Author
Owner

@retspen commented on GitHub (Feb 27, 2014):

Thanks! Nice article.

<!-- gh-comment-id:36286111 --> @retspen commented on GitHub (Feb 27, 2014): Thanks! Nice article.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/webvirtmgr#194
No description provided.