系统版本:CentOS 7.4

WebVirtMgr版本:master分支的20180720版本,下载链接(链接:https://pan.baidu.com/s/1kl060hPHDGbwJUR_iMFb3Q  密码:iozj)

用到的目录:/data/service/nginx,/data/service/nginx_vhost/,/data/service/webvirtmgr

安装成功并成功运行的标志位:/var/log/supervisor/supervisord.log,/var/log/supervisor/webvirtmgr-console.log这两个日志文件会自动生成。

说明:其实网上流传了很多安装的版本,基本都非常乱,要不是这里加一句没用的,就是那里根本不用这么复杂的配置,记住,一切的安装配置以官方文档为准,并且官方这么少的配置都能成功时,自己更应该注意有没有配置错误等问题。

注意:整篇文章未改动过官方的过多配置,如果你运行不起来,那么90%都出在权限以及权限组上!下面安装的步骤都是使用root账号。

一、准备工作

0、准备操作:

  1. ##关闭selinux
  2. # sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config #修改配置文件则永久生效,但是必须要重启系统。
  3. ##生效命令
  4. # setenforce 0

1、设置目录并安装nginx

  1. git clone http://github.com/easonjim/centos-shell.git
  2. cd centos-shell/directory
  3. sh init-directory.sh
  4. cd ../../
  5. cd centos-shell/nginx
  6. sh install-nginx_1.14.0.sh
    cd ../../

2、安装kvm(这一步不要求按照这个,只需要安装成功即可)

  1. cd centos-shell/kvm
  2. sh install-kvm_centos_7.sh

参考:https://www.cnblogs.com/EasonJim/p/9150733.html

3、安装WebVirtMgr依赖

  1. yum install epel-release
    wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
  2. # 这一步的epel源是关键,如果安装不成功,那么下面的依赖也会安装不成功
  3. yum -y install git python-pip libvirt-python libxml2-python python-websockify supervisor nginx
  4. yum -y install gcc python-devel
  5. pip install numpy

4、正式安装WebVirtMgr并配置超级登录用户

  1. cd /data/service
    git clone git://github.com/retspen/webvirtmgr.git
  2. cd webvirtmgr
  3. pip install -r requirements.txt
  4. ./manage.py syncdb
  5. ./manage.py collectstatic

说明:如果上面的版本不能安装,那么建议下载离线版本,随着时间的推移,不保证会不会改变。

配置超级用户,信息类似如下:

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

如果想再增加多一个超级用户,可以再执行如下命令:

  1. ./manage.py createsuperuser

配置信息类似如上所示。

5、设置nginx

  1. vi /data/service/nginx_vhost/webvirtmgr.conf
  1. server {
  2. listen 8001;
  3.  
  4. server_name $hostname;
  5. access_log /data/weblog/nginx/webvirtmgr_access_log;
  6.  
  7. location /static/ {
  8. root /data/service/webvirtmgr/webvirtmgr;
  9. expires max;
  10. }
  11.  
  12. location / {
  13. proxy_pass http://127.0.0.1:8000;
  14. proxy_set_header X-Real-IP $remote_addr;
  15. proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for;
  16. proxy_set_header Host $host:$server_port;
  17. proxy_set_header X-Forwarded-Proto $scheme;
  18. proxy_connect_timeout 600;
  19. proxy_read_timeout 600;
  20. proxy_send_timeout 600;
  21. client_max_body_size 1024M;
  22. }
  23. }
  1. service nginx restart

6、配置supervisord服务

设置权限

  1. chown -R nginx:nginx /data/service/webvirtmgr

其实是在supervisord服务增加webvirtmgr进程的启动,依赖这个服务而已。

  1. # 开机自启
  2. systemctl enable supervisord

增加进程启动配置

  1. vi /etc/supervisord.d/webvirtmgr.ini
  1. [program:webvirtmgr]
  2. command=/usr/bin/python /data/service/webvirtmgr/manage.py run_gunicorn -c /data/service/webvirtmgr/conf/gunicorn.conf.py
  3. directory=/data/service/webvirtmgr
  4. autostart=true
  5. autorestart=true
  6. logfile=/var/log/supervisor/webvirtmgr.log
  7. log_stderr=true
  8. user=nginx
  9.  
  10. [program:webvirtmgr-console]
  11. command=/usr/bin/python /data/service/webvirtmgr/console/webvirtmgr-console
  12. directory=/data/service/webvirtmgr
  13. autostart=true
  14. autorestart=true
  15. stdout_logfile=/var/log/supervisor/webvirtmgr-console.log
  16. redirect_stderr=true
  17. user=nginx

重启服务

  1. service supervisord restart

7、权限设置(重点),也是设置Local登录的一种方式

增加权限组

  1. groupadd libvirtd

增加用户到权限组

  1. usermod -a -G libvirtd root
  2. usermod -a -G libvirtd nginx

设置kvm服务libvirtd启动权限

  1. vi /etc/libvirt/libvirtd.conf

增加权限启动配置

  1. vi /etc/polkit-1/localauthority/50-local.d/50-org.libvirtd-group-access.pkla
  1. [libvirtd group Management Access]
  2. Identity=unix-group:libvirtd
  3. Action=org.libvirt.unix.manage
  4. ResultAny=yes
  5. ResultInactive=yes
  6. ResultActive=yes

最后重启服务

  1. service libvirtd restart
    service supervisord start

上面的权限检查:

①、确定是否已libvirtd组启动licvirtd服务

  1. ls -l /var/run/libvirt/libvirt-sock
  2. srwxrwx--- 1 root libvirtd 0 févr. 12 16:03 /var/run/libvirt/libvirt-sock

②、确定WebVirtMgr启动的用户

  1. ps -ef | grep run_gunicorn | awk 'NR==1{ print $1 }'
  2. nginx

③、确定用户已经加入到libvirtd组

  1. groups root
    libvirtd
  2. groups nginx
    libvirtd

8、配置到这里基本全部配置完成,可以直接使用Local添加运行

登录http://x.x.x.x:8001

放心,如果按照以上配置绝对可以运行的起来,已经测试了100+台。

参考:

https://github.com/retspen/webvirtmgr/wiki/Install-WebVirtMgr(官方配置文档)

CentOS 7搭建KVM在线管理面板WebVirtMgr的更多相关文章

  1. CentOS 7搭建KVM在线管理面板WebVirtMgr之使用SSH授权登录

    环境:CentOS 7.4 1.创建SSH私钥和ssh配置选项(在安装了WebVirtMgr的系统上): # 切换到nginx用户su - nginx -s /bin/bash # 生产ssh密钥 s ...

  2. 快速搭建 kvm web 管理工具 WebVirtMgr

    作者:SRE运维博客 博客地址: https://www.cnsre.cn/ 文章地址:https://www.cnsre.cn/posts/211117937177/ 相关话题:https://ww ...

  3. kvm虚拟化管理平台WebVirtMgr部署-完整记录(3)

    继下面三篇文章完成了kvm虚拟化管理平台webvirtmgr环境的部署安装:kvm虚拟化管理平台WebVirtMgr部署-虚拟化环境安装-完整记录(0)kvm虚拟化管理平台WebVirtMgr部署-完 ...

  4. kvm虚拟化管理平台WebVirtMgr部署-完整记录(2)

    继上一篇kvm虚拟化管理平台WebVirtMgr部署-完整记录(1),接下来说说WebVirtMgr的日常配置:添加宿主机,创建虚机,磁盘扩容,快照等具体操作记录如下: 一.配置宿主机1.登录WebV ...

  5. kvm虚拟化管理平台WebVirtMgr部署-完整记录(1)

    公司机房有一台2U的服务器(64G内存,32核),由于近期新增业务比较多,测试机也要新增,服务器资源十分有限.所以打算在这台2U服务器上部署kvm虚拟化,虚出多台VM出来,以应对新的测试需求.当KVM ...

  6. KVM虚拟化管理平台WebVirtMgr部署及使用

    KVM虚拟化管理平台WebVirtMgr部署及使用   需求: 公司机房有一台2U的服务器(64G内存,32核),由于近期新增业务比较多,测试机也要新增,服务器资源十分有限.所以打算在这台2U服务器上 ...

  7. KVM web管理工具——WebVirtMgr(一)

    WebVirtMgr 介绍     WebVirtMgr采用几乎纯Python开发,其前端是基于Python的Django,后端是基于Libvirt的Python接口,将日常kvm的管理操作变的更加的 ...

  8. KVM Web管理平台 WebVirtMgr

    WebVirtMgr介绍 WebVirtMgr是一个KVM管理平台,让kvm管理变得更为可视化,对中小型kvm应用场景带来了更多方便.WebVirtMgr采用几乎纯Python开发,其前端是基于Pyt ...

  9. centos7.2 kvm虚拟化管理平台WebVirtMgr部署

    在服务器上部署kvm虚拟化,虚出多台VM出来,以应对新的测试需求.当KVM宿主机越来越多,需要对宿主机的状态进行调控,决定采用WebVirtMgr作为kvm虚拟化的web管理工具,图形化的WEB,让人 ...

随机推荐

  1. sh脚本学习之:变量

    变量的创建 环境配置 /etc/profile =>~/.bash_profile(~/.bash_login,~/.profile) => ~/.bashrc sh声明 name=&qu ...

  2. [转载]HTML5 真的会消灭原生App吗?

    http://mp.weixin.qq.com/s?__biz=MzA5NjQ4MzkyMw==&mid=201728945&idx=1&sn=8f43b5bb10695efc ...

  3. # 20155337 2016-2017-2 《Java程序设计》第六周学习总结

    20155337 2016-2017-2 <Java程序设计>第六周学习总结 教材学习内容总结 •串流(Stream): 数据有来源及目的地,衔接两者的是串流对象.如果要将数据从来源取出, ...

  4. 第7月第19天 swift on linux

    1. https://github.com/iachievedit/moreswift http://dev.iachieved.it/iachievedit/more-swift-on-linux/ ...

  5. mysql修改时区

    查看mysql当前时间 查看mysql时区设置 查看mysql数据库的时区 mysql修改时区的几种方法

  6. Spring Boot 多模块项目创建与配置 (一)

    最近在负责的是一个比较复杂项目,模块很多,代码中的二级模块就有9个,部分二级模块下面还分了多个模块.代码中的多模块是用maven管理的,每个模块都使用spring boot框架.之前有零零散散学过一些 ...

  7. springcloud使用Zuul构建微服务网关入门

    为什么要使用微服务网关 不同的微服务一般会经过不同的网络地址,而外部客户端可能需要调用多个服务的接口才能完成一个业务需求. 如果让客户端直接与各个微服务通信,会有以下的问题: 客户端会多次请求不同的微 ...

  8. React-Native 之 Navigator与NavigatorIOS使用

    前言 学习本系列内容需要具备一定 HTML 开发基础,没有基础的朋友可以先转至 HTML快速入门(一) 学习 本人接触 React Native 时间并不是特别长,所以对其中的内容和性质了解可能会有所 ...

  9. Java多态概述

    多态 所谓多态,实际上就是一个对象的多种状态: 下面例子中,Tiger可以看做Tiger,也可以看做Animal Cat  可以看做Cat,也可以看做Animal Dog 可以看做Dog,也可以看做A ...

  10. 使用react中遇到的问题

    引入antdesign中Carousel走马灯时遇到问题? Uncaught Error: Element ref was specified as a string (slick) but no o ...