Skip to content

Instantly share code, notes, and snippets.

@OrangeCrush
Created March 1, 2016 02:03
Show Gist options
  • Save OrangeCrush/eea869f863499b0bc940 to your computer and use it in GitHub Desktop.
Save OrangeCrush/eea869f863499b0bc940 to your computer and use it in GitHub Desktop.
centos7-kvm.sh
#!/bin/bash
VM_NAME=$1
INSTALL_HOST=$2
virsh destroy $VM_NAME
virsh undefine $VM_NAME
virt-install \
--network bridge:br0 \
--virt-type kvm \
--name $VM_NAME \
--ram=2048 \
--vcpus=2 \
--disk path=/vm-images/${VM_NAME}.img,size=10 \
--graphics none \
--location="http://${INSTALL_HOST}/boot/iso" \
--mac=RANDOM \
--extra-args="ks=http://${INSTALL_HOST}/boot/ks/ks_centos7_kvm.cfg console=tty0 console=ttyS0,115200"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment