依赖安装
yum install -y qemu-kvm libvirt libvirt-daemon libvirt-daemon-config-network virt-install bridge-utils virt-manager libguestfs-tools xorg-x11-xauth
virt-manager 的配置
这步要打开新的ssh连接页面才会生效
vim /etc/ssh/sshd_config
X11Forwarding yes
systemctl restart sshd
打开新的连接面板,就可使用
virt-manager
检查安装结果
virsh version
根据库编译:libvirt 6.2.0 使用库:libvirt 6.2.0 使用的 API: QEMU 6.2.0 运行管理程序: QEMU 4.1.0
用linux.xml
<domain type=\’kvm\’>
<name>linux-1</name>
<memory unit=\’KiB\’>2097152</memory>
<currentMemory unit=\’KiB\’>2097152</currentMemory>
<vcpu placement=\’static\’>2</vcpu>
<os>
<type arch=\’x86_64\’ machine=\’pc-q35-4.1\’>hvm</type>
<boot dev=\’cdrom\’/>
</os>
<cpu mode=\’custom\’ match=\’exact\’ check=\’none\’>
<model fallback=\’forbid\’>qemu64</model>
</cpu>
<clock offset=\’utc\’/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type=\’file\’ device=\’disk\’>
<driver name=\’qemu\’ type=\’qcow2\’/>
<source file=\’/var/lib/libvirt/images/linux.qcow2\’/>
<target dev=\’vda\’ bus=\’virtio\’/>
<address type=\’pci\’ domain=\’0x0000\’ bus=\’0x04\’ slot=\’0x00\’ function=\’0x0\’/>


