centos7 kvm create vm

# virt-install \
--network bridge:br0 \
--name vm1 \
--ram=4096 \
--vcpus=2 \
--disk path=/vm-images/vm1.img,size=40 \
--graphics vnc \
--location=https://mirrors.aliyun.com/centos/7.4.1708/os/x86_64/ \
--extra-args='ks=http://ip:port/path/ks.cfg ip=192.168.122.100 netmask=255.255.255.0 gateway=192.168.122.1 dns=8.8.8.8'
keyboard 'us'
rootpw --iscrypted $1$zcKX70RY$eDa8u/fGojQGwIhCZtamn1
url --url="https://mirrors.aliyun.com/centos/7.4.1708/os/x86_64/"
lang en_US.UTF-8
firewall --disabled
auth  --useshadow  --passalgo=sha512
text
firstboot --disable
selinux --disabled
skipx
network  --bootproto=dhcp --device=eth0
reboot
timezone Asia/Shanghai --isUtc --nontp
bootloader --location=mbr
zerombr
clearpart --all --initlabel
part / --fstype="ext4" --size=10240
part /boot --fstype="ext4" --size=512
part swap --fstype="swap" --size=4096

%packages
@^minimal
@core
%end

%post
/usr/bin/curl "http://ip:port/path/?action=add_vm&ip=`ip a | grep inet.*en | awk '{print $2}' | awk -F '/' '{print $1}'`"
%end
# yum install qemu-kvm libvirt libvirt-python libguestfs-tools virt-install
# systemctl enable libvirtd && systemctl start libvirtd
# yum install virt-manager virt-viewer

KVM Virtualization in RHEL 7 Made Easy

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值