KVM虚拟化管理平台WebVirtMgr部署及使用
KVM虚拟化管理平台WebVirtMgr部署及使用
WebVirtMgr介绍
yum -y install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-12.noarch.rpm
yum -y install git python-pip libvirt-python libxml2-python python-websockify upervisor nginx novnc python-virtinst libvirt vm ridge-utils virt-manager qemu-kvm-tools virt-viewer virt-v2v tunctl unzip zip
cd /usr/local/src/
git clone git://github.com/retspen/webvirtmgr.git
cd webvirtmgr/
pip install -r requirements.txt
./manage.py syncdb # 默认是python执行,如下报错,换用其他版本的python
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:密码
Password (again):密码
###==========================###
./manage.py collectstatic #生成配置文件
WARNING:root:No local_settings file found.
You have requested to collect static files at the destination
location as specified in your settings.
This will overwrite existing files!
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: yes
..........
..........
###==========================###
./manage.py createsuperuser #添加管理员账号
WARNING:root:No local_settings file found.
Username: sun //这个是管理员账号,用上面的admin和这个管理员账号都可以登陆webvirtmgr的web界面管理平台
Email address: 1916989848@qq.com
Password:
Password (again):
Superuser created successfully.
###==========================###
/usr/bin/python2 manage.py createsuperuser #添加管理员账号(同样使用python2版本执行,不要使用默认的python执行)
注意此处用默认的python执行上面命令,一般会报错,如下:
ImportError: No module named django.core.management
这个一般是由于python版本引起的,因为系统自带有好几个版本的python
[root@openstack webvirtmgr]# python //按Tab键自查找
python python2.6
python2 python2.6-config python-config
[root@openstack webvirtmgr]# python -V
Python 2.6.6
由此可看出,系统默认的Python版本是2.6.6
说明上面命令默认是python2.6执行的
既然使用python2.6执行上面的命令报错,那就换用其他版本python2执行(如果当前是python3.3.0,那么就将下面的/usr/bin/python2换成/usr/bin/python2.6)
cd ..
mkdir -pv /var/www
cp -Rv webvirtmgr /var/www/webvirtmg
chown -R nginx:nginx /var/www/webvirtmgr
su - nginx -s /bin/bash
ssh-keygen #产生公私钥
ssh-copy-id (kvm-ip) #由于这里webvirtmgr和kvm服务部署在同一台机器,所以这里本地信任。如果kvm部署在其他机器,那么这个是它的ip
[root@local]#vim /etc/nginx/conf.d/webvirtmgr.conf //添加下面内容到文件中
server {
listen 80;
server_name 10.3.134.35;
#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
[root@openstack ops]# vim /etc/supervisord.conf //在文件末尾添加,注意将默认的python改为python2,因为上面只有用这个版本执行才不报错!
[program:webvirtmgr]
command=/usr/bin/python2 /var/www/webvirtmgr/manage.py run_gunicorn -c /var/www/webvirtmgr/conf/gunicorn.conf.py #启动8000端口***如果报错无法启动,查看/var/www/wvirtmgr权限是否正常!!!
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/python2 /var/www/webvirtmgr/console/webvirtmgr-console #启动6080端口(这是控制台vnc端口)
directory=/var/www/webvirtmgr
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/webvirtmgr-console.log
redirect_stderr=true
user=nginx
[root@localhost ~]# netstat -lnpt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:8000 0.0.0.0:* LISTEN 1698/python2
tcp 0 0 0.0.0.0:6080 0.0.0.0:* LISTEN 1697/python2
tcp 0 0 0.0.0.0:5900 0.0.0.0:* LISTEN 544/qemu-kvm
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 32518/nginx
cp ifcfg-eth0 ifcfg-br0
[root@vfeelit network-scripts]# cat ifcfg-br0
TYPE=Bridge
NAME=br0
DEVICE=br0
ONBOOT=yes
BOOTPROTO=none
PEERDNS=yes
NM_CONTROLLED=no
IPADDR=192.168.10.10
NETMASK=255.255.255.0
GATEWAY=192.168.10.2
DNS1=223.5.5.5
DNS2=223.6.6.6
[root@vfeelit network-scripts]# cat ifcfg-eth0
TYPE=Ethernet
BRIDGE=br0
BOOTPROTO=none
PEERDNS="yes"
NAME="eth0"
DEVICE="eth0"
ONBOOT="yes"
NM_CONTROLLED="no"
12 web访问
http://10.2.134.35/login/
这里用超级管理员登陆,只有超级管理员登陆后才能看到“基础构架”窗口
普通用户登陆后,只能看到“WebVirtMgr”一个窗口
选择“SSH链接“,设置Label,IP,用户
注意:Label与IP要相同
以下为部分网友出现报错:
打开后,有报错!看来在上面使用ssh连接的配置环节有误所致!
解决措施:
1)在webvirtmgr服务器(服务端)上(这里kvm和WebVirtMgr部署在同一台机器上)创建nginx用户家目录(默认nginx服务安装时是没有nginx家目录的),生成nginx的公私钥
[root@openstack ops]# cd /home/
[root@openstack home]# mkdir nginx
[root@openstack home]# chown nginx.nginx nginx/
[root@openstack home]# chmod 700 nginx/ -R
[root@openstack home]# su - nginx -s /bin/bash
-bash-4.1$ ssh-keygen #期间输入yes后直接回车,回车
-bash-4.1$ touch ~/.ssh/config && echo -e "StrictHostKeyChecking=no\nUserKnownHostsFile=/dev/null" >> ~/.ssh/config
-bash-4.1$ chmod 0600 ~/.ssh/config
2)在kvm(客服端)服务器上(这里kvm和WebVirtMgr部署在同一台机器上)配置用户,这里默认采用root用户
---------------------------------------------------------------------------------------------------------------------
如果采用其他用户,比如webvirtmgr,操作如下:
[root@openstack ops]#useradd webvirtmgr
[root@openstack ops]#echo "123456" | passwd --stdin webvirtmgr
[root@openstack ops]#groupadd libvirt
[root@openstack ops]#usermod -G libvirt -a webvirtmgr
---------------------------------------------------------------------------------------------------------------------
3)在webvirtmgr服务器(服务端)上(这里kvm和WebVirtMgr部署在同一台机器上),将nginx用户的ssh-key上传到kvm服务器上(这里kvm和WebVirtMgr部署在同一台机器上)
[root@openstack ops]# su - nginx -s /bin/bash
-bash-4.1$ ssh-copy-id root@192.168.1.17
Warning: Permanently added '192.168.1.17' (RSA) to the list of known hosts.
root@192.168.1.17's password: #输入192.168.1.17即本机的root账号
Now try logging into the machine, with "ssh 'root@192.168.1.17'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
---------------------------------------------------------------------------------------------------------------------
这里采用的是root用户,如果采用其他用户,比如上面假设的webvirtmgr用户,操作如下:
[root@openstack ops]#su - nginx -s /bin/bash
-bash-4.1$ssh-copy-id webvirtmgr@192.168.0.23
---------------------------------------------------------------------------------------------------------------------
4)在kvm(客服端)服务器上(这里kvm和WebVirtMgr部署在同一台机器上)配置 libvirt ssh授权
[root@openstack ops]# vim /etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla
[Remote libvirt SSH access]
Identity=unix-user:root #注意这里采用的是root用户
Action=org.libvirt.unix.manage
ResultAny=yes
ResultInactive=yes
ResultActive=yes
[root@openstack ops]# chown -R root.root /etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla
-------------------------------------------------------------------------------------------------------------------------------
这里采用的是root用户,如果采用其他用户,比如上面假设的webvirtmgr用户,操作如下:
[root@openstack ops]#vim /etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla
[Remote libvirt SSH access]
Identity=unix-user:webvirtmgr #这里就设定webvirtmgr用户
Action=org.libvirt.unix.manage
ResultAny=yes
ResultInactive=yes
ResultActive=yes
[root@openstack ops]#chown -R webvirtmgr.webvirtmgr /etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla
--------------------------------------------------------------------------------------------------------------------------------
5)重启 libvirtd 服务
/etc/init.d/libvirtd restart

web创建虚拟机;
1:首先创建iso目录和虚拟机文件的存储目录

3:创建虚拟机
KVM虚拟化管理平台WebVirtMgr部署及使用的更多相关文章
- kvm虚拟化管理平台WebVirtMgr部署-完整记录(3)
继下面三篇文章完成了kvm虚拟化管理平台webvirtmgr环境的部署安装:kvm虚拟化管理平台WebVirtMgr部署-虚拟化环境安装-完整记录(0)kvm虚拟化管理平台WebVirtMgr部署-完 ...
- kvm虚拟化管理平台WebVirtMgr部署-完整记录(2)
继上一篇kvm虚拟化管理平台WebVirtMgr部署-完整记录(1),接下来说说WebVirtMgr的日常配置:添加宿主机,创建虚机,磁盘扩容,快照等具体操作记录如下: 一.配置宿主机1.登录WebV ...
- kvm虚拟化管理平台WebVirtMgr部署-完整记录(1)
公司机房有一台2U的服务器(64G内存,32核),由于近期新增业务比较多,测试机也要新增,服务器资源十分有限.所以打算在这台2U服务器上部署kvm虚拟化,虚出多台VM出来,以应对新的测试需求.当KVM ...
- centos7.2 kvm虚拟化管理平台WebVirtMgr部署
在服务器上部署kvm虚拟化,虚出多台VM出来,以应对新的测试需求.当KVM宿主机越来越多,需要对宿主机的状态进行调控,决定采用WebVirtMgr作为kvm虚拟化的web管理工具,图形化的WEB,让人 ...
- kvm虚拟化管理平台WebVirtMgr部署-完整记录(0)
打算部署kvm虚拟机环境,下面是虚拟化部署前的一些准备工作: 操作系统环境安装1)修改内核模式为兼容内核启动[root@ops ~]# uname -aLinux openstack 2.6.32-4 ...
- kvm虚拟化管理平台WebVirtMgr部署-完整记录(安装ubuntu虚拟机)-(5)
之前介绍了在webvirtmgr平台下创建centos,windows server 2008的虚拟机,今天说下创建ubuntu虚拟机的过程. (1)首先下载ubuntu16.04的iso镜像放到/u ...
- kvm虚拟化管理平台WebVirtMgr部署-完整记录(安装Windows虚拟机)-(4)
一.背景说明 在之前的篇章中,提到在webvirtmgr里安装linux系统的vm,下面说下安装windows系统虚拟机的操作记录: 由于KVM管理虚拟机的硬盘和网卡需要virtio驱动,linux ...
- 008-kvm虚拟化管理平台WebVirtMgr部署-完整记录(1)
公司机房有一台2U的服务器(64G内存,32核),由于近期新增业务比较多,测试机也要新增,服务器资源十分有限.所以打算在这台2U服务器上部署kvm虚拟化,虚出多台VM出来,以应对新的测试需求. 当KV ...
- [原创]KVM虚拟化管理平台的实现
KVM虚拟化管理平台的实现 源码链接:https://github.com/wsjhk/IaaS_admin.git 根据KVM虚拟化管理的要求,设计并实现网页操作管理KVM虚拟机.设计原理架构如下图 ...
随机推荐
- ch4inrulz: 1.0.1靶机渗透
ch4inrulz: 1.0.1靶机渗透 扫描主机端口,还行啦四个开放的端口,8011和80端口都运行着web服务. 80端口下的robots.txt告诉我们什么都没有 在8011端口的apache服 ...
- PHAR伪协议&&[CISCN2019 华北赛区 Day1 Web1]Dropbox
PHAR:// PHP文件操作允许使用各种URL协议去访问文件路径:如data://,php://,等等 include('php://filter/read=convert.base64-encod ...
- 我要吹爆这份阿里中间件技术内部的RM笔记,简直佩服到五体投地
消息队列 RocketMQ 版是阿里云基于 Apache RocketMQ 构建的低延迟.高并发.高可用.高可靠的分布式消息中间件.该产品最初由阿里巴巴自研并捐赠给 Apache 基金会,服务于阿里集 ...
- git将本地仓库中的文件上传到远程仓库
现在我们开始创建本地git仓库(版本库又叫仓库) (本地仓库:$ git init之后的目录): 1.任意地方新建文件夹aaa,右击git bash here, 2.弹出一个对话框, 3. 首先配置你 ...
- 基于Excel参数化你的Selenium2测试-xlrd
本篇文章转载至苦叶子: 前言 今天我们就如何使用xlrd模块来进行python selenium2 + excel自动化测试过程中的参数化进行演示说明,以解决大家在自动化测试实践过程中参数化的疑问 ...
- 在KEIL下查看单片机编程内存使用情况
原文链接:https://blog.csdn.net/D_azzle/article/details/83410141 截至到目前为止,本人接触单片机也有将近一年的时间.这一年以来也接触过了很具代表性 ...
- 初识HTTP 图解 形象生动
使用软件: 通信猫 请自行下载 使用平台: win7 360浏览器 当前PC连接的是无线网,所以第2步查看的是 无线局域网适配器上的IP地址
- 2.1 java语言概述
链接:https://pan.baidu.com/s/1ab2_KapIW-ZaT8kedNODug 提取码:miao
- milvus和faiss安装及其使用教程
写在前面 高性能向量检索库(milvus & faiss)简介 Milvus和Faiss都是高性能向量检索库,可以让你在海量向量库中快速检索到和目标向量最相似的若干个向量,这里相似度量标准可以 ...
- 034 01 Android 零基础入门 01 Java基础语法 04 Java流程控制之选择结构 01 流程控制概述
034 01 Android 零基础入门 01 Java基础语法 04 Java流程控制之选择结构 01 流程控制概述 本文知识点:Java中的流程控制相关概念的认识 三大流程控制语句结构的简介 顺序 ...