Infrastructure and Cloud for Enthusiasts

Categories
< All Topics
Print

webvirtmgr install

CentOS

$ 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

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: username@domain.local (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

$ 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 / {
        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;
    }
}

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 Websocket proxy (noVNC) and Supervisor

CentOS, RedHat, Fedora

Run:

$ sudo cp /var/www/webvirtmgr/conf/initd/webvirtmgr-novnc-redhat /etc/init.d/webvirtmgr-novnc
$ sudo service webvirtmgr-novnc start
$ sudo chkconfig webvirtmgr-novnc on
$ 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

Restart supervisor daemon

$ sudo service supervisord stop
$ sudo service supervisord 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 service supervisord restart
$ sudo service webvirtmgr-novnc 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 )


################ uncomment & modify /etc/libvirt/libvirtd.conf #############

listen_tls = 0
listen_tcp = 1
tcp_port = "16509"
auth_tcp = "sasl"


###### firewall rules ######

iptables -I INPUT 4 -p tcp --dport 6080 -j ACCEPT #### this is to allow webvirtmgr novnc to webvirtmgr guest ..... or have no firewall ... make sure you have a firewall douche ############

##### hypervisor changes for novnc #######

/etc/quemu something something .... novnc=0.0.0.0. ##### will update when I remember ###
Table of Contents