diff --git a/gui/kvm.sh b/devel/kvm.sh similarity index 100% rename from gui/kvm.sh rename to devel/kvm.sh diff --git a/devel/kvm/virt-install.sh b/devel/kvm/virt-install.sh new file mode 100755 index 0000000..aefbf81 --- /dev/null +++ b/devel/kvm/virt-install.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +if [ "$#" -lt 1 ] ;then + echo "Usage: $0 [name] [disk-dir] [iso-path]" + exit 1 +fi + +case $1 in + bridge) + NETWORK='bridge=br0' + ;; + nat) + NETWORK='network=default' + ;; + *) + NETWORK="type=direct,source=$1,model=virtio" + ;; +esac + +NAME=${2-centos7} +DISKDIR=${3-'vms'} +ISOPATH=${4-'CentOS-7-x86_64-Minimal-2003.iso'} + +mkdir -p "$DISKDIR" +sudo virsh destroy centos7 +sudo virsh undefine centos7 +sudo virt-install \ + --virt-type=kvm \ + --name "$NAME" \ + --ram 4096 \ + --vcpus=2 \ + --network "$NETWORK" \ + --nographics \ + --disk "path=$DISKDIR/$NAME.qcow2,size=40,bus=virtio,format=qcow2" \ + --extra-args "console=ttyS0" \ + --location "$ISOPATH"