kvm 安装虚拟机

本文介绍了如何使用KVM安装虚拟机,分别针对CentOS 7和Windows 7提供了详细步骤。对于CentOS,通过virt-install创建qcow2映像文件,设置内存、CPU数量,并指定网络桥接。对于Windows 7,同样使用virt-install配置内存、CPU、ISO镜像,并启用VNC图形界面。
摘要由CSDN通过智能技术生成

使用virt-install:
(1) qemu-img create -f qcow2 ./centos.img 15G
(2) virt-install –name centos7 –ram 2048 –disk path=./images/centos7.qcow2,size=10 –vcpus 2 –os-type linux –os-variant rhel7 –network bridge=virbr0 –graphics none –console pty,target_type=serial –location ./boot/CentOS-7-x86_64-DVD-1511.iso –extra-args ‘console=ttyS0,115200n8 serial’

for windows7:
(1)qemu-img create -f qcow2 ./windows7.img 50G

(2)sudo virt-install –virt-type=kvm –name windows7 –ram 4096 –vcpus=4 –os-variant=win7 –virt-type=kvm –hvm –cdrom=/home/jack/vms/images/windows7.iso –network=bridge=virbr0,model=virtio –graphics vnc –disk path=/home/jack/vms/images/windows7.img,size=50,sparse=yes,bus=virtio,format=qcow2 –video cirrus

使用virsh:
(1) qemu-img create -f qcow2 ./centos.img 15G
(2) touch centos.xml

<domain type='kvm'>
  <name>centos7</name>
  <uuid>4c8d5b14-eb51-2973-158f-fbc917a63f1a</uuid>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='static'>2</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-trusty'>hvm
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值