Thu*_*fir 4 command-line kvm virtual-machine webserver system-installation
如何从 CLI创建虚拟机?
创建虚拟机
Run Code Online (Sandbox Code Playgroud)First, download an ISO cd image of some OS you want to run. For Ubuntu, you can find these at: http://www.ubuntu.com/getubuntu/download Double click on the name of the host. The Status column should read Active Right click on the name of the host, and select New This will start a wizard to guide you through the rest of your VM creation Enter your virtual machine details Name: foo Choose Local install media (ISO image or CDROM), or you can use another method if you know what you're doing Forward Locate your install media Use ISO image Browse to find the ISO you downloaded earlier Optional: Select the matching OS Type Optional: Select the matching Version Forward
主要只是为了我自己的启发。
只需使用:
virt-install \
--name vm_name \
--ram=2048 \
--vcpus=2 \
--disk pool=guest_images,size=30,bus=virtio,format=qcow2 \
--cdrom /var/iso/debian.iso \
--network bridge=kvmbr0,model=virtio \
--graphics vnc,listen=0.0.0.0,password=Qwerty1234 \
--boot cdrom,hd,menu=on
Run Code Online (Sandbox Code Playgroud)
其中/var/iso/debian.iso- iso 映像的路径
guest_images- 磁盘池,需要在vm之前创建