在kali系统中安装KVM
检查CPU是否支持
egrep -o '(vmx|svm)' /proc/cpuinfo
安装
apt-get install kvm qemu
apt-get install virtinst python-libvirt virt-viewer virt-manager
测试安装是否成功
virsh -c qemu:///system list
安装Windows 7系统
virt-install --name win7 --hvm --ram 3072 --vcpus 1 --disk path=/images/win7.img,size=64 --network network:default --accelerate --vnc --vncport=8621 --cdrom /data/iso/cn_windows_7_enterprise_x64_dvd_x15-70741.iso -d
上述默认使用的时NAT,如果需要使用桥接的话,如下:
virt-install --name win7 --hvm --ram 3072 --vcpus 1 --disk path=/images/win7.img,size=64 --network bridge=virbr0 --accelerate --vnc --vncport=8621 --cdrom /data/iso/cn_windows_7_enterprise_x64_dvd_x15-70741.iso -d
注意:使用桥接的话,需要执行virsh net-start default,则virbr0网卡将自动被创建。
可能遇到的问题
1. 执行virt-install --name win7 --hvm --ram 3072 --vcpus 1 --disk path=/images/win7.img,size=64 --network network:default --accelerate --vnc --vncport=8621 --cdrom /data/iso/cn_windows_7_enterprise_x64_dvd_x15-70741.iso -d时,报如下错误:
libvirtError: Requested operation is not valid: network 'default' is not active
[Fri,
28 Jul 2017 17:13:43 virt-install 1799] DEBUG (guest:482) Removing
created disk path=/images/win7.img vol_object=<libvirt.virStorageVol
object at 0x7ff5d947e590>
Removing disk 'win7.img' | 0 B 00:00
[Fri, 28 Jul 2017 17:13:43 virt-install 1799] DEBUG (cli:321) Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
virsh --connect qemu:///system start win7
otherwise, please restart your installation.
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
virsh --connect qemu:///system start win7
otherwise, please restart your installation.
解决办法:
先查看default network 的状态
virsh net-list --all
开启default
virsh net-start default