Virt-install is a python script developed and maintained by the Virt-Manager project. The script enables users to easily create and define guest virtual machines. Configurations created by virt-install are stored within /etc/libvirt/qemu/
Open a terminal and install virt-install:
sudo apt-get install virtinst
创建Image
qemu-img create -f qcow2 ubuntutest.img 5G
… and use the ISO p_w_picpath in the virt-install command:
sudo virt-install --connect qemu:///system -n vm10 -r 1024 --vcpus=2 --disk path=/var/lib/libvirt/p_w_picpaths/vm10.img,size=12 -c /var/lib/libvirt/p_w_picpaths/CentOS-6.2-x86_64-bin-DVD1.iso --vnc --noautoconsole --os-type linux --accelerate --network=bridge:br0 --hvm
https://www.howtoforge.com/installing-kvm-guests-with-virt-install-on-ubuntu-12.04-lts-server
Note
When using the libvirt default network, libvirt will connect the virtual machine’s interface to a bridge called virbr0. There is a dnsmasq process managed by libvirt that will hand out an IP address on the 192.168.122.0/24 subnet, and libvirt has iptables rules for doing NAT for IP addresses on this subnet.
Use the (virsh vncdisplay vm-name
) command to get the VNC port number.
转载于:https://blog.51cto.com/christhai/1753308