KVM管理工具 WebVirtMgr
WEB管理工具 WebVirtMgr
WebVirtMgr是一个基于libvirt的Web界面,用于管理虚拟机。它允许您创建和配置新域,并调整域的资源分配。VNC查看器为来宾域提供完整的图形控制台。KVM是目前唯一支持的虚拟机管理程序。
基础环境
[root@BJtest32 ~]# cat /etc/redhat-release
CentOS release 6.6 (Final)
[root@BJtest32 ~]# uname -r
2.6.32-504.el6.x86_64
[root@BJtest32 ~]# getenforce
Disabled
查看是否支持虚拟化
cat /proc/cpuinfo | grep -E 'vmx|svm'
查看KVM 驱动是否加载
lsmod | grep kvm
如果没有加载kvm驱动,利用命令加载驱动
modprobe -a kvm
modprobe -a kvm_intel
hosts免密登录
kvm所用的所有服务器都需要互相做免密
如果只有一台机器,把本机的id_rsa.pub 拷贝到authorized_keys里
[root@BJtest32 ~]# ssh-keygen
[root@BJtest32 ~]# -copy-id -i .ssh/id_rsa.pub root@$IP
依赖包及管理工具
kvm属于内核,不需要安装。但是需要一些管理工具包
yum install -y qemu-kvm libvirt libvirt-python libguestfs-tools virt-install virt-manager python-virtinst libvirt-client virt-viewer qemu-kvm-tool
libvirt 用来管理kvm
yum install -y virt-install
安装管理KVM命令
WebVirtMgr 安装
官方地址
WebVirtMgr只在管理端安装
[root@BJtest32 data]# yum -y install http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
[root@BJtest32 data]# yum -y install git python-pip libvirt-python libxml2-python python-websockify supervisor nginx
[root@BJtest32 data]# git clone git://github.com/retspen/webvirtmgr.git
[root@BJtest32 data]# cd webvirtmgr
[root@BJtest32 webvirtmgr]# pip install -r requirements.txt # or python-pip (RedHat, Fedora, CentOS, OpenSuse)
#requirements.txt主要是用于记录所有依赖包及其精确的版本号。以便新环境部署
[root@BJtest32 webvirtmgr]# ./manage.py syncdb
WARNING:root:No local_settings file found.
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_groups
Creating table auth_user_user_permissions
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table servers_compute
Creating table instance_instance
Creating table create_flavor
You just installed Django's auth system, which means you don't have any superusers defined.
这里需要我们输入Yes,配置管理员用户
配置信息如下
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'): root #用户名称
Email address: cyh@i4t.com #邮箱地址 (可以不填)
Password: #管理员用户密码
Password (again): #重复输入密码
Superuser created successfully. #创建成功
Installing custom SQL ...
Installing indexes ...
Installed 6 object(s) from 1 fixture(s)
#配置Django 静态页面
[root@BJtest32 webvirtmgr]# ./manage.py collectstatic
输入Yes即可
#如果还需要再添加管理员用户,执行下面的命令
#前台启动WebVirMgr,默认是Debug模式同时日志打印在前台
[root@BJtest32 webvirtmgr]# ./manage.py createsuperuser
以上执行Python脚本必须在webvirtmgr目录
启动WebVirMgr
前台启动WebVirMgr,默认是Debug模式同时日志打印在前台
[root@BJtest32 webvirtmgr]# ./manage.py runserver 0:8000
IP+8000端口访问

用户名和密码就是刚刚创建的
登录成功,没有报错。
现在在服务器端Ctrl+C退出
安装Nginx使用supervisor进行管理。
配置Nginx
Nginx安装 安装完成后修改配置文件
[root@BJtest32 conf.d]# cat webvirtmgr.conf
server {
listen 80;
server_name webvirtmgr.nfsnobody.com;
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 5120M;
}
location /static/ {
root /data1/webvirtmgr;
expires max;
}
}
[root@BJtest32 conf.d]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@BJtest32 conf.d]# /etc/init.d/nginx restart
配置supervisor
supervisorctl所有的操作都需要在webvirtmgr的安装目录下,否则会提示找不到文件
WebVirtMgr默认使用supervisor进行管理(启动停止服务) 所以我们需要配置supervisor
安装supervisor
[root@BJtest32 ~]# yum remove supervisor -y
[root@BJtest32 ~]# pip install supervisor==3.1.3
[root@BJtest32 ~]# echo_supervisord_conf > /etc/supervisor/supervisord.conf
#修改配置文件
[root@BJtest32 ~]# vim /etc/supervisord.conf
#新增以下内容
[include]
files = /etc/supervisord.d/*.conf
#创建目录
[root@BJtest32 ~]# mkdir /etc/supervisord.d/
#配置service
[root@BJtest32 ~]# vi /etc/init.d/supervisord
#!/bin/bash
#
# supervisord This scripts turns supervisord on
#
# Author: Mike McGrath <mmcgrath@RedHat.com> (based off yumupdatesd)
#
# chkconfig: - 95 04
#
# description: supervisor is a process control utility. It has a web based
# xmlrpc interface as well as a few other nifty features.
# processname: supervisord
# config: /etc/supervisor/supervisord.conf
# pidfile: /tmp/supervisord.pid
#
# source function library
. /etc/rc.d/init.d/functions
PIDFILE=/tmp/supervisord.pid
RETVAL=0
start() {
echo -n $"Starting supervisord: "
daemon "supervisord --pidfile=$PIDFILE -c /etc/supervisord.conf"
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/supervisord
}
stop() {
echo -n $"Stopping supervisord: "
killproc supervisord
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/supervisord
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|force-reload|reload)
restart
;;
condrestart)
[ -f /var/lock/subsys/supervisord ] && restart
;;
status)
status supervisord
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
exit 1
esac
exit $RETVAL
[root@BJtest32 ~]# chmod 755 /etc/init.d/supervisord
[root@BJtest32 ~]# chkconfig supervisord on
supervisord 启动成功后,可以通过 supervisorctl 客户端控制进程,启动、停止、重启。
运行 supervisorctl 命令,不加参数,会进入 supervisor 客户端的交互终端,并会列出当前所管理的所有进程。
创建supervisor配置文件
#创建配置文件
[root@BJtest32 ~]# vi /etc/supervisord.d/webvirtmgr.conf
[program:webvirtmgr]
command=/usr/bin/python /data/webvirtmgr/manage.py run_gunicorn -c /data/webvirtmgr/conf/gunicorn.conf.py
directory=/data/webvirtmgr
autostart=true
autorestart=true
logfile=/var/log/supervisor/webvirtmgr.log
log_stderr=true
user=root
[program:webvirtmgr-console]
command=/usr/bin/python /data/webvirtmgr/console/webvirtmgr-console
directory=/data/webvirtmgr
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/webvirtmgr-console.log
redirect_stderr=true
user=root
#重启supervisor
[root@BJtest32 ~]# /etc/init.d/supervisord status
supervisord (pid 6877) is running...
[root@BJtest32 ~]# /etc/init.d/supervisord restart
[root@BJtest32 ~]# supervisorctl status
webvirtmgr RUNNING pid 8773, uptime 0:01:12
webvirtmgr-console RUNNING pid 8772, uptime 0:01:12
Web界面配置webvirtmgr
1.Add Connection 添加宿主机(即KVM主机)
2.点击SSH连接
3.Label 为主机名,必须为主机名做免密
4.IP 为宿主机IP
5.用户名为服务器用户名
6.点击添加
添加完后点击主机名激活
虚机实例就是已经存在的虚拟机
创建存储KVM镜像目录
KVM中的虚拟机都是以镜像的方式进行存储

根据自己服务器的分区灵活选择位置
名称: 这里的名称显示的名称
路径: 即存储KVM虚拟机路径
创建完后需要创建镜像(相当于虚拟硬盘大小)
创建镜像
下面“Metadata”前的小方框一定不能勾选(默认是勾选的,要去掉!)
这里添加的“镜像”就是所创建虚拟机的硬盘空间
虚拟机所占用的空间就是这个“镜像”所在的宿主机下路径所在的分区空间(也就是/home/kvm/kvmstorage/,即宿主机的home分区)

创建完毕
上传镜像
创建完虚拟硬盘,我们在创建一个IOS镜像目录
点击>存储池>NEW_Storage
点击上传镜像
选中镜像选择上传
除了在浏览器上传,还可以直接下载阿里云镜像站镜像。只要镜像在/opt下就会被获取
wget -P /opt/ https://mirrors.aliyun.com/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-DVD-1810.iso
如果使用Web界面上传镜像nginx出现413的情况请修改client_max_body_size参数
KVM管理工具 WebVirtMgr的更多相关文章
- KVM管理工具webvirtmgr的使用
WebVirtMgr的日常配置:添加宿主机,创建虚拟机,磁盘扩容,快照等具体操作记录如下: 一.创建虚拟机 1.创建存储池 点击创建的宿主机,进入虚拟机部署界面 点击“存储池”按钮,创建存储池(即创建 ...
- kvm管理工具Webvirtmgr安装
虚拟机版本vmware workstation 15.5.0 pro (也就是linux版) cat /etc/redhat-release CentOS Linux release 7.4.17 ...
- KVM web管理工具——WebVirtMgr(一)
WebVirtMgr 介绍 WebVirtMgr采用几乎纯Python开发,其前端是基于Python的Django,后端是基于Libvirt的Python接口,将日常kvm的管理操作变的更加的 ...
- kvm-web管理工具webvirtmgr
前言: 使用开源的虚拟化技术,对公司自有的少数服务器进行虚拟化,在满足业务需求的同时,并未增加投入,同时也避免了使用云主机的不便,技术层面,kvm是开源的虚拟化产品,虚拟化性能出众,更重要的是免费!! ...
- Kvm --05 密码保护:Kvm管理之WebVirtMgr
目录 密码保护:Kvm管理之WebVirtMgr 1. 前言 2. 特点 3. 功能 4. 部署 1).安装相关依赖 2).安装Python需求环境 3).配置Nginx 4). 远程连接 5).更新 ...
- 快速搭建 kvm web 管理工具 WebVirtMgr
作者:SRE运维博客 博客地址: https://www.cnsre.cn/ 文章地址:https://www.cnsre.cn/posts/211117937177/ 相关话题:https://ww ...
- 虚拟化技术之kvm管理工具virsh常用基础命令(一)
在上一篇博客中,我们了解了KVM基础架构和部署以及图形管理工具virt-manager安装虚拟机的过程,回顾请参考https://www.cnblogs.com/qiuhom-1874/p/13499 ...
- KVM WEB管理工具——WebVirtMgr(二)日常配置
配置宿主机 1.登录WebVirtMgr管理平台 2.添加宿主机 选择首页的WebVirtMgr -->Addd Connection 选择“SSH链接“,设置Label,IP,用户 注意:La ...
- KVM WEB管理工具webvirtmgr安装和使用
生产环境的KVM宿主机越来越多,需要对宿主机的状态进行调控.这里用webvirtmgr进行管理.图形化的WEB,让人能更方便的查看kvm 宿主机的情况和操作 1 安装支持的软件源 yum -y ins ...
随机推荐
- Linux 内核 usb_control_msg 接口
usb_control_msg 函数就像 usb_bulk_msg 函数, 除了它允许一个驱动发送和结束 USB 控制信息: int usb_control_msg(struct usb_device ...
- Next.js 笔记
NEXT 中文文档地址! next.js 只有服务端使用的包需要做单独处理,无需打包到项目中,可以使用@zeit/next-bundle-analyzer观察代码. Router.beforePopS ...
- SPOJ - PHRASES Relevant Phrases of Annihilation (后缀数组)
You are the King of Byteland. Your agents have just intercepted a batch of encrypted enemy messages ...
- Python9_类
类的基础知识 属性:类变量.实例变量.方法:初始化方法 __init__ //初始化方法不是必须的:其他方法: //类的定义class Employee: empCount = 0 //类变量,有些 ...
- 使用element的upload组件实现一个完整的文件上传功能(上)
说到标题就有点心塞了,前段时间项目上需要实现一个文件上传的功能,然后就咔咔的去用了element的upload组件,不用不知道一用吓一跳哇. 在使用的过程中遇到了很多让意想不到的问题,后来也因为时间问 ...
- 使用PAC file结合ATS控制访问
介绍:前面已经介绍了ATS的安装和PAC文件的写法格式,现在把nginx端口转发,pac file访问控制和ATS代理结合起来分别控制不同的机器访问不同URL权限的目的 效果如下 一.使用nginx端 ...
- 【题解】HDU4689 Derangement(有技巧的计数DP)
[题解]HDU4689 Derangement(有技巧的计数DP) 传送门 呵呵没告诉我多测组数,然后\(n\le 20,7000\mathrm{ms}\)我写了个状压上去T了 题目大意: 要你求错排 ...
- SpringBoot拦截器没有生效的原因
最近的一个项目中,需要实现一个记录系统请求日志的功能,我通过拦截器实现了这个功能,但是,测试的时候发现拦截器没有发挥作用,检查了很久,没有发现错的地方,系统也没有报错,最终在网上找打了答案. 原来之前 ...
- 洛谷P1002 过河卒 题解 动态规划
题目链接:https://www.luogu.com.cn/problem/P1002 题目大意 棋盘上\(A\)点有一个过河卒,需要走到目标\(B\)点.卒行走的规则:可以向下.或者向右.同时在棋盘 ...
- 微信小程序开发笔记(一)
一.为什么要学习微信小程序开发 微信小程序是一个可以在微信上打开的轻应用,他是由多个页面组成的程序,跟传统APP比较如下: 优点 1.不需要在应用商店下载,不占用内存空间,即开即用 2.可以在微信内直 ...