webvirtmgr推荐

    安装webvirtmgr推荐:https://github.com/retspen/webvirtmgr/wiki/Install-WebVirtMgr


1. Installation

CentOS/RHEL 6.x

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

CentOS 7.x

Run:

$ sudo yum -y install http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

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

$ sudo yum -y install gcc python-devel

$ sudo pip install numpy

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

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 be able to access WebVirtMgr by typing localhost:8000 in your browser after completing the install. Port 6080 is forwarded 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, Ubuntu )      

$ 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 $scheme;

        proxy_connect_timeout 600;

        proxy_read_timeout 600;

        proxy_send_timeout 600;

        client_max_body_size 1024M; # Set higher depending on your needs

    }

}

Open nginx.conf out of /etc/nginx/nginx.conf (in Ubuntu 14.04 LTS the configuration is in/etc/nginx/sites-enabled/default):

$ sudo vim /etc/nginx/nginx.conf

Comment the Server Section as it is shown in the example:

#    server {

#        listen       80 default_server;

#        server_name  localhost;

#        root         /usr/share/nginx/html;

#

#        #charset koi8-r;

#

#        #access_log  /var/log/nginx/host.access.log  main;

#

#        # Load configuration files for the default server block.

#        include /etc/nginx/default.d/*.conf;

#

#        location / {

#        }

#

#        # redirect server error pages to the static page /40x.html

#        #

#        error_page  404              /404.html;

#        location = /40x.html {

#        }

#

#        # redirect server error pages to the static page /50x.html

#        #

#        error_page   500 502 503 504  /50x.html;

#        location = /50x.html {

#        }

#    }

Restart nginx service:

$ sudo service nginx restart

Update SELinux policy

/usr/sbin/setsebool httpd_can_network_connect true

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

Create file /etc/supervisord.d/webvirtmgr.ini with following content:

[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: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=nginx

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: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

Restart supervisor daemon

CentOS, RedHat, Fedora

$ sudo service supervisord stop

$ sudo service supervisord start

 5Update - 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

6run

$ ./manage.py runserver 0:8000

Enter in your browser:

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

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值