KVM Virtualization Cookbook
上QQ阅读APP看书,第一时间看更新

How to do it...

To start a new virtual machine using the qemu-system utility, perform the following steps:

  1. Start a new QEMU virtual machine using the x86_64 CPU architecture: 
root@kvm:~# qemu-system-x86_64 -name debian -vnc 146.20.141.254:0 -cpu Nehalem -m 1024 -drive     format=raw,index=2,file=debian.img -daemonize    
root@kvm:~#
  1. Ensure that the instance is running: 
root@kvm:~# pgrep -lfa qemu
3527 qemu-system-x86_64 -name debian -vnc 146.20.141.254:0 -m 1024 -drive format=raw,index=2,file=debian.img -daemonize
root@kvm:~#
  1. Terminate the Debian QEMU instance:   
root@kvm:~# pkill qemu    
root@kvm:~#
  1. Start a new QEMU instance using the prebuilt CentOS image: 
root@kvm:~# qemu-system-x86_64 -vnc 146.20.141.254:0 -m 1024 -hda CentOS-7-x86_64-GenericCloud.qcow2 -daemonize    
root@kvm:~#
  1.  Ensure that the instance is running: 
root@kvm:~# pgrep -lfa qemu
3546 qemu-system-x86_64 -vnc 146.20.141.254:0 -m 1024 -hda CentOS-7-x86_64-GenericCloud.qcow2 -daemonize
root@kvm:~#
  1. Terminate the CentOS QEMU instance:   
root@kvm:~# pkill qemu    
root@kvm:~#
Make sure to replace the IP address of the -vnc parameter with the one from your host machine.