Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save TsutomuNakamura/49f6f455f7399b96d6655d96c4b1920a to your computer and use it in GitHub Desktop.
Save TsutomuNakamura/49f6f455f7399b96d6655d96c4b1920a to your computer and use it in GitHub Desktop.
Run KVM with some options
#!/usr/bin/env bash
# Run KVM with iPXE boot
mkdir -p /var/kvm/distros/ubuntu-server-22.04/
virt-install --pxe \
--boot uefi \
--name ubuntu-desktop-22.04 \
--connect=qemu:///system \
--vcpus=2 \
--memory 16384 \
--disk path=/var/kvm/distros/ubuntu-server-22.04/disk.img,size=32,format=qcow2 \
--os-variant=ubuntu22.04 \
--arch x86_64 \
--network bridge:br0,mac=52:54:00:00:00:01 \
--graphics vnc,port=15901,listen=127.0.0.1
# Run KVM with specifying local image.
virt-install \
--name ubuntu-server-22.04 \
--boot uefi \
--connect=qemu:///system \
--vcpus=2 \
--memory 16384 \
--disk path=/var/kvm/distros/ubuntu-server-22.04/disk.img,size=32,format=qcow2 \
--os-type linux \
--os-variant=ubuntu22.04 \
--arch x86_64 \
--network bridge:br0,mac=52:54:00:00:00:01 \
--cdrom /var/kvm/iso/ubuntu-22.04.3-live-server-amd64.iso \
--graphics vnc,port=15901,listen=127.0.0.1,password=changeme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment