zoukankan      html  css  js  c++  java
  • KVM WEB管理工具webvirtmgr安装和使用

    生产环境的KVM宿主机越来越多,需要对宿主机的状态进行调控。这里用webvirtmgr进行管理。图形化的WEB,让人能更方便的查看kvm 宿主机的情况和操作

     1 安装支持的软件源

    yum -y install http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

    2 安装相关软件

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

    3 从git-hub中下载相关的webvirtmgr代码

    cd /usr/local/src/

    git clone git://github.com/retspen/webvirtmgr.git

    4 安装webvirtmgr

    cd webvirtmgr/

    pip install -r requirements.txt

    5 安装数据库

    yum install python-sqlite2

    6 对django进行环境配置

     ./manage.py syncdb

    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
    Username (leave blank to use 'root'): admin
    Email address: 2733176200@qq.com
    Password:*********
    Password (again):*********
     
     ./manage.py collectstatic #生成配置文件
    ./manage.py createsuperuser #添加管理员账号
     
    7 拷贝web到 相关目录
    cd ..
    mkdir -pv /var/www
    cp -Rv webvirtmgr /var/www/webvirtmgr
     
    8 设置ssh
    ssh-keygen
    ssh-copy-id 192.168.2.32
    ssh 192.168.2.32 -L localhost:8000:localhost:8000 -L localhost:6080:localhost:6080
     
    9 编辑nginx配置文件
    vim /etc/nginx/conf.d/webvirtmgr.conf 添加下面内容到文件中
    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
        }
    }
     
     
    mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bak
     
    10 启动nginx
    /etc/init.d/nginx restart
     
    11 修改防火墙规则
    /usr/sbin/setsebool httpd_can_network_connect true
     
     
    12 设置 supervisor 
    chown -R nginx:nginx /var/www/webvirtmgr
    vim /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: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
     
     
    修改/var/www/webvirtmgr/conf/gunicorn.conf.py 
    bind = "0:8000"
     
    13 设置开机启动
    chkconfig supervisord on
    vim /etc/rc.local
    /usr/sbin/setsebool httpd_can_network_connect true
     
     
    14 启动进程
    /etc/init.d/supervisord restart
     
    15查看进程
    netstat -lnpt 即可以看到6080和8000已经启动
     
    16 web访问
    http://192.168.0.194/login/
     
     
     
     
     
     
  • 相关阅读:
    jboss:在standalone.xml中设置系统属性(system-properties)
    心得体悟帖---200608(机会都是自己创造的)
    心得体悟帖---200608(易中天评三国之刘备和诸葛亮关系启示:诚意真的重要)
    算法与数据结构---6.1、斐波那契数列-递推解法
    算法与数据结构---5、递推
    C++指针相关问题
    C++ new一个数组
    指针数组和数组指针的区别
    C++ new的用法
    webdings 和 wingdings 字体
  • 原文地址:https://www.cnblogs.com/olinux/p/4511159.html
Copyright © 2011-2022 走看看