6.12.1、通过Xmanager - Passive管理kvm虚拟机(首先要安装xmanager):

1、安装虚拟化管理软件:

[root@centos7 ~]# yum install -y virt-manager openssh-askpass

#virt-manager:图形化管理虚拟机工具;openssh-askpass:远程连接KVM主机;

[root@centos7 ~]# yum groupinstall -y "Fonts"

[root@centos7 ~]# yum install -y dejavu-lgc-sans-fonts

#上面两行是解决xmanager-passive乱码的问题;

[root@centos7 ~]# yum install -y xorg-x11-font-utils xorg-x11-server-utils xorg-x11-utils xorg-x11-xauth xorg-x11-xinit

#安装x11图形界面工具;

[root@centos7 ~]# vim /etc/ssh/sshd_config

X11Forwarding yes

[root@centos7 ~]# systemctl restart sshd

#上面两行是开启ssh的X11转发功能;

2、在xshell中设置:

3、运行xmanager-passive:

提示:运行后是不会显示界面的,会在电脑任务栏的右下角出现一个"X"图标;

4、kvm宿主机主动连接xmanager-passive:

[root@centos7 ~]# export DISPLAY=172.16.1.254:0.0

#设定连接的ip端口;

[root@centos7 ~]# virt-manager &

[1] 3369

#执行该命令后xmanager-passive会自动跳出;

[root@centos7 ~]# echo $DISPLAY

172.16.1.254:0.0

[1]+ 完成 virt-manager

说明:当关掉Xmanager - Passive后virt-manager进程也会结束掉;

5、管理虚拟主机:

(1)查看虚拟机连接配置:

1)

2)

3)

4)

(2)查看虚拟机的相关配置项:

1)

2)

3)

4)

5)

6)

7)

8)

9)

10)

(3)克隆:

1)

6.12.2、通过网页方式管理kvm虚拟机:

1、安装WebVirtMgr依赖包:

[root@centos7 ~]# yum -y install gcc python-devel git python-pip libvirt-python libxml2-python python-websockify supervisor nginx novnc

[root@centos7 ~]# pip install numpy

2、下载webvirtmgr包和安装Python的Django环境:

(1)下载webvirtmgr包:

[root@centos7 ~]# git clone git://github.com/retspen/webvirtmgr.git

(2)安装django环境:

[root@centos7 ~]# cd webvirtmgr/

[root@centos7 webvirtmgr]# pip install -r requirements.txt

(3)设置管理用户信息:

[root@centos7 webvirtmgr]# ./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'): #回车

Email address: #回车

Password: 123456 #输入密码

Password (again): 123456 #再次输入密码

Superuser created successfully.

Installing custom SQL ...

Installing indexes ...

Installed 6 object(s) from 1 fixture(s)

(4)生成配置文件:

[root@centos7 webvirtmgr]# ./manage.py collectstatic

(5)补充:添加其它管理用户的方法:

[root@centos7 webvirtmgr]# ./manage.py createsuperuser

3、配置nginx:

(1)拷贝web包到nginx站点目录并授权:

[root@centos7 webvirtmgr]# cd ..

[root@centos7 ~]# mv webvirtmgr /var/www/

[root@centos7 ~]# chown -R nginx:nginx /var/www/webvirtmgr

(2)配置nginx.conf:

主要配置的是server部分;

[root@centos7 ~]# cat /etc/nginx/nginx.conf

user nginx;

worker_processes auto;

error_log /var/log/nginx/error.log;

pid /run/nginx.pid;

include /usr/share/nginx/modules/*.conf;

events {

worker_connections 1024;

}

http {

log_format main '$remote_addr - $remote_user [$time_local] "$request" '

'$status $body_bytes_sent "$http_referer" '

'"$http_user_agent" "$http_x_forwarded_for"';

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

sendfile on;

tcp_nopush on;

tcp_nodelay on;

keepalive_timeout 65;

types_hash_max_size 2048;

include /etc/nginx/mime.types;

default_type application/octet-stream;

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

server {

listen 80 default_server;

server_name $hostname;

location /static/ {

root /var/www/webvirtmgr/webvirtmgr;

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;

}

}

}

(3)检查nginx的配置文件:

[root@centos7 nginx]# nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

(4)启动nginx并加入到开机自启动:

[root@centos7 ~]# systemctl start nginx

[root@centos7 ~]# systemctl enable nginx

4、创建文件/etc/supervisord.d/webvirtmgr.ini如下内容:

[root@centos7 ~]# vim /etc/supervisord.d/webvirtmgr.ini

[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

5、启动supervisord并加入开机自启动:

[root@centos7 ~]# systemctl start supervisord.service

[root@centos7 ~]# systemctl enable supervisord.service

6、配置ssh认证:

(1)说明:

ssh和tcp设置一种即可,其实就是设置无密码登录,要注意的是从webvirtmgr的什么用户到宿主机的什么用户的无密码登录,

比如我用nginx用户跑的django webvirtmgr,而宿主机是root跑的virsh,所以需要设置nginx到root的无密码登录,git官网推

荐的是用nginx用户跑django webvirtmgr,webvirtmgr用户跑的virsh,所以设置的是nginx用户到宿主机webvirtmgr用户的

无密码登录。

(2)发送认证公钥:

[root@centos7 ~]# su - nginx -s /bin/bash

-bash-4.2$ ssh-keygen

-bash-4.2$ touch ~/.ssh/config

-bash-4.2$ echo -e "StrictHostKeyChecking=no\nUserKnownHostsFile=/dev/null" >> ~/.ssh/config

-bash-4.2$ chmod 0600 ~/.ssh/config

-bash-4.2$ ssh-copy-id root@localhost

#如果有其它的kvm宿主机,也需要将公钥发送到其它的宿主机上;

7、在网页端管理虚拟机:

1、登录:

2、连接宿主机:

(1)

(2)

(3)

3、管理宿主机:

(1)添加存储池(存放虚拟机的虚拟磁盘用):

(2)添加桥接网络:

(3)虚拟机配置:

6.12.3、小结:

1、使用可视化工具连接kvm宿主机后能够在管理工具上查看虚拟机的界面,主要用的是vnc,默认的vnc监听是"0.0.0.0:0";

2、以上内容没有写如何在kvm可视化管理工具中如何安装操作系统,因为安装较为简单,这里只写出了一些重要参数的设置

项,在生产中建议使用命令安装虚拟机,然后使用kvm可视化管理工具进行克隆即可;

3、使用manager-passvie管理kvm虚拟机需要在每台宿主机上安装"virt-manager"等管理工具,且每次用时都需要在宿主机

上执行"virt-manager &"命令,非常的不方便;WebVirtMgr管理平台可以单独装一台服务器,然后通过ssh免密连接到其它

的kvm宿主机,实现对多台kvm宿主机的管理;

4、以上kvm可视化管理工具用于小规模的服务器kvm虚拟化管理,如果是大规模的kvm虚拟化管理,需要使用openstack;

6.12、通过kvm可视化管理虚拟机的更多相关文章

  1. kvm命令管理虚拟机

    virsh 既有命令行模式,也有交互模式,在命令行直接输入 virsh 就进入交互模式, virsh 后面跟命令参数,则是命令行模式: KVM 工具集合 libvirt:操作和管理KVM虚机的虚拟化 ...

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

    一.背景说明  在之前的篇章中,提到在webvirtmgr里安装linux系统的vm,下面说下安装windows系统虚拟机的操作记录: 由于KVM管理虚拟机的硬盘和网卡需要virtio驱动,linux ...

  3. CloudStack+KVM环境搭建(步骤很详细,说明ClockStack是用来管理虚拟机的)

    文章目录环境准备配置本地域名解析关闭selinux安装ntp服务安装管理端安装Mysql数据库安装服务端RPM:初始化CloudStack数据库:初始化cloudstack管理服务器安装系统虚拟机安装 ...

  4. KVM虚拟机管理——虚拟机创建和操作系统安装

    1. 概述2. 交互式安装2.1 图形化-本地安装2.1.1 图形化本地CDROM安装2.2.2 图形化本地镜像安装2.2 命令行-本地安装2.2.1 命令行CDROM安装2.3 图形化-网络安装2. ...

  5. CentOS7.1 KVM虚拟化之经常使用管理虚拟机命令(3)

    一.查看虚拟机列表及状态 [root@kvm01 ~]# virsh list --all Id Name State ---------------------------------------- ...

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

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

  7. KVM Web管理平台 WebVirtMgr

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

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

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

  9. [原创]KVM虚拟化管理平台的实现

    KVM虚拟化管理平台的实现 源码链接:https://github.com/wsjhk/IaaS_admin.git 根据KVM虚拟化管理的要求,设计并实现网页操作管理KVM虚拟机.设计原理架构如下图 ...

随机推荐

  1. 基于混合云模式的calico部署

    开始前准备 确定calico数据存储 Calico同时支持kubernetes api和etcd数据存储.官方给出的建议是在本地部署中使用K8S API,仅支持Kubernetes模式.而官方给出的e ...

  2. 像素 PIXEL 图片的基本单位 像素非常小 图片是成千上万的像素组成 显示/屏幕分辨率 (DPI 屏幕分辨率)

    像素 PIXEL 图片的基本单位 像素非常小 图片是成千上万的像素组成 显示/屏幕分辨率 (DPI 屏幕分辨率) 图像分辨率 (PPI) 1920*1080是像素点长度1920个像素点 X1080个像 ...

  3. WIFF SD卡

    https://detail.tmall.com/item.htm?spm=a230r.1.14.1.2d4d6923Fq3Hgx&id=36945441834&cm_id=14010 ...

  4. 鸿蒙 Android iOS 应用开发对比02

    个人理解,不抬杠 转载请注明原著:博客园老钟 https://www.cnblogs.com/littlecarry/ IOS 把界面抽象成 "控制" Controller:And ...

  5. docker私有仓库搭建及使用

      1.下载官方镜像 sudo docker pull registry 下载完成后,docker images可以查看到pull下来的镜像registry 2.启动registry容器,用于提供私有 ...

  6. [Windows] 将中文输入法热键改回Ctrl+Space

    造冰箱的大熊猫@cnblogs 2021/6/6 之前因为Code Composer Studio的缘故将Windows XP上的中英文切换热键从Ctrl+Space改为了Ctrl+Shift+Spa ...

  7. Elasticsearch分页查询

    global index global CLIENT index = "guajibao-ipused-2019.10.13" CLIENT = Elasticsearch(hos ...

  8. Go语言的函数03---返回值

    package main import "fmt" /*无返回值*/ func Sub1(a, b int) { ret := a - b fmt.Println("a- ...

  9. SLAM架构的两篇顶会论文解析

    SLAM架构的两篇顶会论文解析 一. 基于superpoint的词袋和图验证的鲁棒闭环检测 标题:Robust Loop Closure Detection Based on Bag of Super ...

  10. 使用BootstrapVue相关组件,构建Vue项目界面

    基于Vue的前端框架有很多,Element算一个,而BootstrapVue也可以非常不错的一个,毕竟Bootstrap也是CSS中的大佬级别的,它和Vue的整合,使得开发起来更加方便了.Bootst ...