[toc]
reference
- https://blog.csdn.net/yangshihuz/article/details/104055288
- https://blog.csdn.net/u010856284/article/details/89018195
webvirtmgr
準(zhǔn)備工作
# 拉取鏡像
docker pull primiano/docker-webvirtmgr
# 設(shè)置環(huán)境
mkdir -p /data/vm
groupadd -g 1010 webvirtmgr
useradd -u 1010 -g webvirtmgr -s /sbin/nologin -d /data/vm webvirtmgr
chown -R webvirtmgr:webvirtmgr /data/vm
啟動
docker run -d -p 8090:8080 -p 6090:6080 --name webvirtmgr \
--mount type=bind,source=/data/vm,target=/data/vm --restart=always primiano/docker-webvirtmgr
主機(jī)配置
- Libvirtd服務(wù)監(jiān)聽配置
修改/etc/sysconfig/libvirtd文件,去掉下面一行的注釋,使Libvirt服務(wù)處于監(jiān)聽狀態(tài):
vim /etc/sysconfig/libvirtd
LIBVIRTD_ARGS="--listen
- 配置Libvirt服務(wù),允許通過tcp方式通訊,修改
vim /etc/libvirt/libvirtd.conf:
#允許tcp監(jiān)聽
listen_tcp = 1
#配置tcp通過sasl認(rèn)證
auth_tcp = sasl
#取消CA認(rèn)證功能
listen_tls = 0
啟動服務(wù):
service libvirtd start
- 配置賬號密碼
saslpasswd2 -a libvirt 你的賬號
Password: 你的密碼
Again (for verification): 再次確認(rèn)你的密碼
查看賬號:
[root@dell ylsjw]# sasldblistusers2 -f /etc/libvirt/passwd.db
admin@dell: userPassword
驗證設(shè)置
[root@dell ylsjw]# virsh -c qemu+tcp://192.168.1.34/system nodeinfo
Please enter your authentication name: admin
Please enter your password:
CPU model: x86_64
CPU(s): 256
CPU frequency: 1500 MHz
CPU socket(s): 1
Core(s) per socket: 64
Thread(s) per core: 2
NUMA cell(s): 2
Memory size: 263587912 KiB
啟動登錄
- 啟動webvirtmgr web登錄頁面
http://192.168.1.249:8090 - 登錄初始用戶名/密碼:
admin/1234
頁面添加連接
Label 192.168.1.34
FQDN / IP 192.168.1.34
用戶名 admin
密碼 123456
修改啟動webvirtmgr登錄密碼
root@initial:/data/vm# docker exec -it webvirtmgr bash
root@18fa11b229e1:/# ping 192.168.1.34 -c 2
root@18fa11b229e1:/# cd /webvirtmgr/
root@18fa11b229e1:/webvirtmgr# python manage.py changepassword admin
Changing password for user 'admin'
Password:
Password (again):
Password changed successfully for user 'admin'
Q&A
1. No route to host
Q: kvm unable to connect to server at '192.168.1.34:16509': No route to host
A:firewall-cmd --zone=public --add-port=16509/tcp --permanent or close filewall temporary