Bash scripts to ease using kvm with libvirt. These scripts are using sudo, and for convenience a passwordless sudo is recommended.
The script kvm-install.sh installs kvm and libvirt on a RedHat-based
system. Tested on Rocky 9.
The script is idempotent, so it can be run multiple times.
Example usage:
./kvm-install.sh sureThe script kvm-uninstall.sh uninstalls kvm and libvirt on a
RedHat-based system. Tested on Rocky 9.
The script is idempotent, so it can be run multiple times.
Example usage:
./kvm-uninstall.sh sureThe script kvm-net.sh create and ruin network configuration for kvm.
Configures virtual bridge with NAT, and static DHCP.
Example usage:
./kvm-net.sh define default 192.168.122.0/24 --bridge-name=virbr0The script kvm-net-define.sh creates a network configuration for kvm. It
creates a bridge with NAT and static DHCP. The script is idempotent, so it
can be run multiple times without creating duplicate networks.
Example usage:
./kvm-net.sh define default 192.168.122.0/24 --bridge-name=virbr0The script kvm-net-undefine.sh removes a network configuration for kvm. It
removes the bridge and static DHCP. The script is idempotent, so it can be
run multiple times without creating duplicate networks.
Example usage:
./kvm-net.sh undefine default --bridge-name=virbr0This script imports cloud images into KVM libvirt.
Example usage:
./kvm-import-image.sh ubuntu24This script creates a new VM in KVM libvirt. It uses the cloud image
imported by kvm-import-image.sh and creates a new VM with the specified
name and configuration.
Example usage:
./kvm-create-vm.sh ubuntu24 ubuntu24-guest 192.168.100.2 --ram=2048 --vcpus=2 --disk-size=20G This script deletes a VM in KVM libvirt. It removes the VM and its associated resources.
Example usage:
./kvm-delete-vm.sh ubuntu24-guestThis script copies the necessary kvm utility script to a remote server and executes it there with the arguments passed to this script.
Example usage:
./kvm-remote.sh my-test-server.org install sure