Skip to content
generalmanager edited this page Sep 19, 2014 · 88 revisions

1. Installation

Fedora 17

Run:

$ sudo yum -y install git python-pip libvirt-python libxml2-python python-websockify supervisor nginx

CentOS 6.2, RedHat 6.2 and above

Run:

$ sudo yum -y install http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
$ sudo yum -y install git python-pip libvirt-python libxml2-python python-websockify supervisor nginx

Debian 7, Ubuntu 12.04 and above

Run:

$ sudo apt-get install git python-pip python-libvirt python-libxml2 novnc supervisor nginx 

OpenSuse 13.1 and above

# libVirt+kvm   
$ sudo zypper in cyrus-sasl-digestmd5 dmidecode dnsmasq ebtables gnutls libapparmor1 libavahi-client3 libavahi-common3 libcgroup1 libdaemon0 libmnl0 \
libnetcontrol0 libnetfilter_conntrack3 libnl-config libnl3-200 libnuma1 libpcap1 libvirt libvirt-client libvirt-daemon \
libvirt-daemon-config-network libvirt-daemon-config-nwfilter libvirt-daemon-driver-interface libvirt-daemon-driver-libxl \
libvirt-daemon-driver-lxc libvirt-daemon-driver-network libvirt-daemon-driver-nodedev libvirt-daemon-driver-nwfilter \
libvirt-daemon-driver-qemu libvirt-daemon-driver-secret libvirt-daemon-driver-storage libvirt-daemon-driver-uml libvirt-daemon-driver-vbox \
libvirt-daemon-driver-xen libvirt-doc libyajl2 lzop nfs-kernel-server open-iscsi qemu-tools radvd xen-libs

#  WebVirtMgr deps
$ sudo zypper install novnc nginx\
libblas3 libgfortran3 liblapack3 libquadmath0 libvirt-python python-libxml2 python-numpy \
python-pip python-pyOpenSSL python-setuptools   python-websockify \
python-django python3-django-appconf python-gunicorn python-lockfile python-django-auth-ldap

 grab supervisor-3.0-4.3.noarch.rpm from https://build.opensuse.org/package/binaries/devel:languages:python/supervisor?repository=openSUSE_13.1, 
 grab python-meld3 from https://build.opensuse.org/package/binaries/devel:languages:python/python-meld3?repository=openSUSE_13.1

$ sudo rpm -i  supervisor-3.0-4.3.noarch.rpm python-meld3-0.6.10-2.1.noarch.rpm 
$ sudo mkdir /var/log/supervisor
$ sudo chkconfig supervisord on

Arch Linux

Use webvirtmgr-git package from AUR

yaourt -S webvirtmgr-git

Then perform what you were told to do by post_install trigger. Do skip step 2.

2. Install python requirements and setup Django environment

Run:

$ git clone git://github.com/retspen/webvirtmgr.git
$ cd webvirtmgr
$ sudo pip install -r requirements.txt # or python-pip (RedHat, Fedora, CentOS, OpenSuse)
$ ./manage.py syncdb
$ ./manage.py collectstatic

Enter the user information:

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes (Put: yes)
Username (Leave blank to use 'admin'): admin (Put: your username or login)
E-mail address: [email protected] (Put: your email)
Password: xxxxxx (Put: your password)
Password (again): xxxxxx (Put: confirm password)
Superuser created successfully.

Adding additional superusers

Run:

$ ./manage.py createsuperuser

3. Setup Nginx

Warning: Usually WebVirtMgr is only available from localhost on port 8000. This step will make WebVirtMgr available to everybody on port 80. The webinterface is also unprotected (no https), which means that everybody in between you and the server (people on the same wifi, your local router, your provider, the servers provider, backbones etc.) can see your login credentials in clear text!

Instead you can also skip this step completely + uninstall nginx. By simply redirecting port 8000 to your local machine via SSH. This is much safer because WebVirtMgr is not available to the public any more and you can only access it over an encrypted connection.

Example:

$ ssh user@server:port -L localhost:8000:localhost:8000 -L localhost:6080:localhost:6080

You should now be able to access WebVirtMgr by typing localhost:8000 in your browser. The forwarding of port 6080 is to make noVNC work.

If you really know what you are doing, feel free to ignore the warning and continue setting up the redirect with nginx:

$ cd ..
$ sudo mv webvirtmgr /var/www/         ( CentOS, RedHat, Fedora)      
$ sudo mv webvirtmgr /srv/www/         ( OpenSuSe )    

Add file webvirtmgr.conf in /etc/nginx/conf.d:

server {
    listen 80 default_server;

    server_name $hostname;
    #access_log /var/log/nginx/webvirtmgr_access_log; 

    location /static/ {
        root /var/www/webvirtmgr/webvirtmgr; # or /srv instead of /var
        expires max;
    }

    location / {
        proxy_pass http://127.0.0.1:8000;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for;
        proxy_set_header Host $host:$server_port;
        proxy_set_header X-Forwarded-Proto $remote_addr;
        proxy_connect_timeout 600;
        proxy_read_timeout 600;
        proxy_send_timeout 600;
        client_max_body_size 1024M; # Set higher depending on your needs 
    }
}

Move default.conf out of /etc/nginx/conf.d:

$ sudo mv /etc/nginx/conf.d/default.conf /root/

Restart nginx service:

$ sudo service nginx restart

make it permanet service: ( OpenSusE ,CentOS, RedHat, Fedora)

$ sudo  chkconfig supervisord on

4. Setup Supervisor

CentOS, RedHat, Fedora

Run:

$ sudo chown -R nginx:nginx /var/www/webvirtmgr

Add these lines to end of file /etc/supervisord.conf:

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

[program:webvirtmgri-novnc]
command=/usr/bin/python /var/www/webvirtmgr/console/webvirtmgr-novnc
directory=/var/www/webvirtmgr
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/webvirtmgr-nonvc.log
redirect_stderr=true
user=nginx

OpenSuSE

Run:

$ sudo chown -R nginx:nginx /srv/www/webvirtmgr

Add these lines to end of file /etc/supervisord.conf:

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

[program:webvirtmgri-novnc]
command=/usr/bin/python /srv/www/webvirtmgr/console/webvirtmgr-novnc
directory=/var/www/webvirtmgr
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/webvirtmgr-nonvc.log
redirect_stderr=true
user=nginx

Debian, Ubuntu

Run:

$ sudo service novnc stop
$ sudo update-rc.d -f novnc remove
$ sudo rm /etc/init.d/novnc
$ sudo chown -R www-data:www-data /var/www/webvirtmgr

Add file webvirtmgr.conf in /etc/supervisor/conf.d:

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

[program:webvirtmgri-novnc]
command=/usr/bin/python /var/www/webvirtmgr/console/webvirtmgr-novnc
directory=/var/www/webvirtmgr
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/webvirtmgr-nonvc.log
redirect_stderr=true
user=www-data

Restart supervisor daemon

$ sudo service supervisor stop
$ sudo service supervisor start

5.1 Update - CentOS, RedHat, Fedora

Read README.md check settings (maybe something has changed) and then:

$ cd /var/www/webvirtmgr
$ sudo git pull
$ sudo ./manage.py collectstatic
$ sudo service supervisord restart

5.1 Update - Debian & Ubuntu

Read README.md check settings (maybe something has changed) and then:

$ cd /var/www/webvirtmgr
$ sudo git pull
$ sudo ./manage.py collectstatic
$ sudo service supervisor restart

5.2 Update - OpenSuSE

Read README.md check settings (maybe something has changed) and then:

$ cd /srv/www/webvirtmgr
$ sudo git pull
$ sudo ./manage.py collectstatic
$ sudo service supervisord restart

6. Debug

If you have error or not run panel (only for DEBUG or DEVELOP):

$ ./manage.py runserver 0:8000

Enter in your browser:

http://x.x.x.x:8000 (x.x.x.x - your server IP address )

xrfctgmvjykjhtgcf

Clone this wiki locally