一起牛网_苹果安卓手游族群聚集地!
发布时间:2021-06-29 10:12:40来源:一起牛手游网作者:一起牛手游网
WebVirtMgr 是一个基于 libvirt 开发的用来管理虚拟机的 Web 界面。纯 Python 开发的,前端是基于 Python 的 Django,后端是基于 Libvirt 的 Python 接口。
它允许您创建和配置新的域,并调整域的资源分配。VNC 查看器向 guest 域提供完整的图形控制台。仅支持 KVM 虚拟。
Web 界面需要 Nginx 反代,本文以 CentOS 7 系统在 OneinStack 一键包下安装 LNMP 环境为例。
WebVirtMgr 面板 和 KVM 服务器 可以安装在同一主机,也可以分开安装的。我是把 WebVirtMgr 面板 装在相对国内访问稍快点的美西 VPS 上。
使用 libvirt 配置的 KVM虚拟机 网络可以使用 bridged(桥接模式)和 NAT(网络地址转换模式)。本文以单 IP 使用 NAT 模式为例。
sudo yum -y install epel-release sudo yum -y update sudo yum -y install git python-pip libvirt-python libxml2-python python-websockify supervisor sudo yum -y install gcc python-devel sudo pip install numpy
cd /data/wwwroot/ git clone git://github.com/retspen/webvirtmgr.git cd webvirtmgr sudo pip install -r requirements.txt ./manage.py syncdb ./manage.py collectstatic
执行过程中按要求输入用户信息:
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 (Put: yes) Username (Leave blank to use ‘admin’): admin (Put: your username or login) E-mail address: username@domain.local (Put: your email) Password: xxxxxx (Put: your password) Password (again): xxxxxx (Put: confirm password) Superuser created successfully.
可添加额外的超级用户
./manage.py createsuperuser
vim /usr/local/nginx/conf/nginx.conf #按自己实际 Nginx 配置文件路径
*** 省略server { listen 9556; server_name $hostname;location /static/ { root /data/wwwroot/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; } }*** 省略
nginx -t sudo service nginx restart chown -R www.www /data/wwwroot/webvirtmgr
vim /etc/supervisord.d/webvirtmgr.ini
[program:webvirtmgr] command=/usr/bin/python /data/wwwroot/webvirtmgr/manage.py run_gunicorn -c /data/wwwroot/webvirtmgr/conf/gunicorn.conf.py directory=/data/wwwroot/webvirtmgr autostart=true autorestart=true logfile=/var/log/supervisor/webvirtmgr.log log_stderr=true user=www[program:webvirtmgr-console] command=/usr/bin/python /data/wwwroot/webvirtmgr/console/webvirtmgr-console directory=/data/wwwroot/webvirtmgr autostart=true autorestart=true stdout_logfile=/var/log/supervisor/webvirtmgr-console.log redirect_stderr=true user=www
若系统、环境跟本文不符请注意修改文中路径和用户权限
systemctl restart supervisord systemctl enable supervisord
以上已完成 WebVirtMgr 面板的安装,在浏览器 http://ip:9556 打开就能看到登陆面板了,下面安装 KVM 主机服务器。
wget -O – http://retspen.github.io/libvirt-bootstrap.sh | sudo sh
建立两个文件夹存放 虚拟机镜像文件 和 安装系统所需的ISO文件(之后要在面板的 “存储池” 里设置)
mkdir -p /home/kvm/img mkdir -p /home/kvm/iso
sudo saslpasswd2 -a libvirt dane #添加用户和设置密码。 sudo sasldblistusers2 -f /etc/libvirt/passwd.db #查看用户 virsh -c qemu+tcp://127.0.0.1/system nodeinfo #验证设置
允许安装 WebVirtMgr 面板的主机访问 KVM 主机服务器
iptables -A INPUT -s 安装WebVirtMgr面板主机的IP -j ACCEPT service iptables save systemctl restart iptables.service
现在就可以登陆 WebVirtMgr 面板添加主机服务器和建立KVM虚拟机了。面板很简单不做记录。
切记:使用 NAT 模式 不需要按网上各种教程建立网桥桥接。
食物语手游腊味合蒸高阶阵容打法思路一览
神雕侠侣2手游氪金玩家消费指南
王牌战士幽灵实战技巧讲解
爱江山更爱美人游戏中宫论战攻略
王牌战士团战如何切入详细讲解
和平精英通讯塔是什么 和平精英通讯塔玩法详细解析
暴走英雄坛延生保命丹怎么用 延生保命丹平民用法攻略
凌烟诀新手前期武学学习与主线攻略
梦幻西游三维版每日日常活动任务安排流程攻略
王者荣耀
角色扮演
坠落星界
其它游戏
炽姬无双
角色扮演
梦三国
角色扮演
跑跑卡丁车官方竞速版
体育竞技
邪恶疯人院
休闲益智
征途永恒
角色扮演
传奇世界3D
角色扮演
一刀传世
角色扮演