Webvirtmgr ?? Debian Jessie. ??? ????????? ??? Linux KVM

????????? ???????????
vim /etc/apt/sources.list:

deb http://ftp.ua.debian.org/debian/ jessie main

aptitude update
aptitude install git python-pip python-libvirt python-libxml2 novnc supervisor qemu-kvm libvirt-bin virtinst sasl2-bin apache2 libapache2-mod-wsgi bridge-utils iptables-persistent

??????????? KVM
vim /etc/default/libvirtd:

libvirtd_opts="-d -l"

vim /etc/libvirt/libvirtd.conf:

listen_tls = 0
listen_tcp = 1

invoke-rc.d libvirtd restart

?????? ??????? ???? ??? KVM
vim /etc/network/interfaces:

auto br0
allow-hotplug br0
iface br0 inet static
        address 192.168.10.1
        gateway 192.168.10.1
        bridge_ports eth0
        bridge_stp off
        bridge_maxwait 0

invoke-rc.d networking stop && invoke-rc.d networking start

??????????? webvirtmgr
cd /var/www
git clone git://github.com/retspen/webvirtmgr.git
cd webvirtmgr
pip install -r requirements.txt
./manage.py syncdb
./manage.py collectstatic
vim conf/gunicorn.conf.py:

bind = '0.0.0.0:8000'

chown -R www-data:www-data /var/www/webvirtmgr

????????? ????????????, ??????? ??????? ?????? ? ??? ??????????
/var/www/webvirtmgr/manage.py createsuperuser
????? ??? ???? ?? ????????????
saslpasswd2 -a libvirt user
?????? ?????????????
sasldblistusers2 -f /etc/libvirt/passwd.db

vim /etc/supervisor/conf.d/webvirtmgr.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
stdout_logfile=/var/log/supervisor/webvirtmgr.log
redirect_stderr=true
user=www-data

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

invoke-rc.d supervisor restart
invoke-rc.d supervisor restart

invoke-rc.d novnc stop
insserv -r novnc
vim /etc/insserv/overrides/novnc:

#!/bin/sh
### BEGIN INIT INFO
# Provides:          nova-novncproxy
# Required-Start:    $network $local_fs $remote_fs $syslog
# Required-Stop:     $remote_fs
# Default-Start:
# Default-Stop:
# Short-Description: Nova NoVNC proxy
# Description:       Nova NoVNC proxy
### END INIT INFO

?????? ??????????? ???? ??? webvirtmgr
vim /etc/apache2/sites-available/webvirtmgr.conf:

WSGISocketPrefix /var/run/apache2/wsgi
<VirtualHost *:8000>
    ServerAdmin admin@example.com
    ServerName example.com

    WSGIDaemonProcess webvirtmgr display-name=%{GROUP} python-path=/var/www/webvirtmgr
    WSGIProcessGroup webvirtmgr
    WSGIScriptAlias / /var/www/webvirtmgr/webvirtmgr/wsgi.py

    Alias /static /var/www/webvirtmgr/webvirtmgr/static/
    Alias /media /var/www/webvirtmgr/webvirtmgr/media/

    <Directory /var/www/webvirtmgr/webvirtmgr>
        <Files wsgi.py>
        Require all granted
        </Files>
    </Directory>

    CustomLog ${APACHE_LOG_DIR}/webvirtmgr-access.log common
    ErrorLog ${APACHE_LOG_DIR}/webvirtmgr-error.log
</VirtualHost>

a2ensite webvirtmgr
invoke-rc.d apache2 reload

????????? ?????
iptables -I INPUT 1 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -I INPUT 2 -s 192.168.10.0/24 -d 192.168.10.1 -i eth0 -p tcp -m state --state NEW -m multiport --dports 80,6080,8000,16509 -j ACCEPT
invoke-rc.d netfilter-persistent save

??? ????????? ????? ???????? ?? ?????? http://example.com:8000

Добавить комментарий

Ваш e-mail не будет опубликован. Обязательные поля помечены *