Skip to content

Instantly share code, notes, and snippets.

@sheeeng
Forked from calerogers/create-vm.sh
Created August 16, 2018 12:25
Show Gist options
  • Select an option

  • Save sheeeng/e3e04ad56dfaa8c5527a14ce0d0ea499 to your computer and use it in GitHub Desktop.

Select an option

Save sheeeng/e3e04ad56dfaa8c5527a14ce0d0ea499 to your computer and use it in GitHub Desktop.
#!/bin/bash
sudo qemu-img create -f qcow2 /home/username/$1.img 250G &&
sudo virt-install \
--name $1 \
--boot uefi \
--machine q35 \
--ram 16384 \
--vcpus 2 \
--disk path=/home/username/$1.img,format=qcow2 \
--location http://ftp.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64 \
--graphics none \
--noautoconsole \
-x "
preseed/url=http://url-to-preseed/preseed.cfg
console=ttyS0
locale=en_US
console-keymaps-at/keymap=us
console-setup/ask_detect=false
console-setup/layoutcode=us
keyboard-configuration/layout=USA
keyboard-configuration/variant=USA
hostname=$2
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment