23213 发表于 2016-4-20 09:16:26

kvm虚拟机常用命令

创建虚拟机
virt-install \   
--name centos \            #虚拟机名字
--ram 1024 \                #内存大小
--vcpus=2 \                  #CPU的数量
--disk path=/kvm/vm1.img,size=8 \            #硬盘文件
--network bridge=br0 \                      #网卡接口
--os-variant=rhel6 \                           #操作系统类型
--cdrom /iso/CentOS-6.6-x86_64-minimal.iso \                  #安装光盘镜像文件
--vnclisten=10.24.24.25 \             #vnc监听ip
--vncport=6900 \                     #vnc监听端口
--vnc
我的配置文件如下:
virt-install --name centos01 --ram 1024 --vcpus=1 --disk path=/kvm/centos01.img,size=60 --network bridge=br0 \
--os-variant=rhel6 --cdrom /iso/CentOS-6.6-x86_64-bin-DVD1.iso --vnclisten=192.168.0.185 --vncport=6900 --vnc


virsh list 列出运行中的虚拟机
virsh start centos 启动centos虚拟机
virsh shutdown centos 关闭centos虚拟机
virsh destroy centos 强制关闭centos虚拟机
virsh autostart centos 设置centos自动启动
virsh undefine centos 删除centos虚拟机
virsh suspend centos 暂停centos虚拟机
virsh resume centos 恢复centos虚拟机


davehe 发表于 2016-4-20 11:22:54

不错
页: [1]
查看完整版本: kvm虚拟机常用命令