virt-install 使用 qcow2格式虚拟机镜 、macvtap网卡

安装虚拟机

这里使用 amazn2 虚拟机镜像安装,根据官网文档,需要预先配置一个 seed.iso 文件
参考文档:https://docs.aws.amazon.com/zh_cn/AWSEC2/latest/UserGuide/amazon-linux-2-virtual-machine.html
其他镜像下载:https://docs.openstack.org/image-guide/obtain-images.html

  • 脚本
    $ cat vm01.sh
#!/bin/bash

seed_iso='/home/dw/seedconfig/seed.iso'
img='/images/amzn2-kvm-2.0.20221210.0-x86_64.xfs.gpt.qcow2'

name='vm01'

cmd=(
  virt-install
  --name $name
  --os-type=linux
  --os-variant=rhel7.0
  --ram=32768
  --vcpus=8
  --cpu host-model
  --cdrom ${seed_iso}
  --disk path=${img},bus=virtio,format=qcow2
  --network type=direct,source=em3,source_mode=bridge,model=virtio,link_state=up
  --force
  --autostart
)

"${cmd[@]}"
posted @ 2023-03-16 15:58  武平宁  阅读(395)  评论(0)    收藏  举报