https://www.jianshu.com/p/8fd2ddadebe9
# 拉取镜像
docker pull primiano/docker-webvirtmgr
# 设置环境
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
vim /etc/sysconfig/libvirtd
LIBVIRTD_ARGS="--listen
vim /etc/libvirt/libvirtd.conf
:#允许tcp监听
listen_tcp = 1
#配置tcp通过sasl认证
auth_tcp = sasl
#取消CA认证功能
listen_tls = 0
启动服务:service libvirtd start
saslpasswd2 -a libvirt 你的账号
Password: 你的密码
Again (for verification): 再次确认你的密码
查看账号:
[root@dell ylsjw]# sasldblistusers2 -f /etc/libvirt/passwd.db
admin@dell: userPassword
验证设置
[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
http://192.168.1.249:8090
admin/1234
Label 192.168.1.34
FQDN / IP 192.168.1.34
用户名 admin
密码 123456
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: 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