创建磁盘文件
使用 qemu-img
命令创建一个 50GB 的 qcow2
格式的磁盘文件:
qemu-img create -f qcow2 -o size=50G /mysql/centos.qcow2
创建虚拟机
使用 virt-install
命令创建一个 CentOS 7 的虚拟机:
virt-install --name CentOS7_Base --ram 4096 --vcpus 4 --os-type linux --os-variant rhel7 --arch=x86_64 --network network=default,model=virtio --disk path=/mysql/centos.qcow2,format=qcow2 --location /hdfs/kvm/iso/CentOS-7-x86_64-Minimal-1804.iso --console pty,target_type=serial --graphics vnc,listen=0.0.0.0,port=7788
或者创建一个 CentOS 6.6 的虚拟机:
virt-install --name=centos6.6 --ram 4096 --vcpus=2 \
--disk path=/mysql/centos.qcow2,size=50 \
--accelerate --cdrom /mnt/CentOS-6.6-x86_64-bin-DVD1.iso \
--graphics vnc,listen=0.0.0.0,port=5920 \
--network bridge=br0 --force --autostart
参数说明:
-
--name<