安装部署kvm
#简单安装
#安装且设置网桥
创建kvm虚拟机
kvm install
创建 Linux centos 7 虚拟机
virt-install --name=centos7_template --memory=6536,maxmemory=6536 --vcpus=2,maxvcpus=2 \
--disk path=/data/vms/centos7_template/centos7_template.qcow2,size=80 --check all=off \
--os-type=linux --os-variant=rhel8.2 \
--location=/opt/iso/CentOS-7-x86_64-Minimal-1810.iso \
--graphics=none --console=pty,target_type=serial --extra-args="console=tty0 console=ttyS0"
创建 win 11 虚拟机
磁盘操作
磁盘操作
克隆虚拟机
#参考https://zhuanlan.zhihu.com/p/473682988
虚拟机克隆有两种操作方式: 直接使用virt-clone命令来本地克隆;
拷贝xml配置文件和磁盘文件来克隆,类似于静态迁移,只是需要手动修改ip、uuid、vncport、配置中磁盘名和磁盘路径,以避免与被克隆虚拟机冲突。
克隆VM1生成新的VM3:
被克隆的机器首先要关机
virsh shutdown
网络操作
#查看网卡信息
virsh domiflist test
#临时添加新网卡
virsh attach-interface snale --type bridge --source br0
#永久添加网卡命令
virsh attach-interface snale --type bridge --source br0 --config
#删除网卡
virsh detach-interface snale --type bridge --mac 52:54:00:d3:60:1b --config
内存管理
#更改内存大小