This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
public:techstuff:libvirt [2012/08/21 13:51] – Deleted by PageMove plugin nathan | public:techstuff:libvirt [2020/04/25 13:05] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== libvirt ====== | ||
+ | ===== Creating a VM ===== | ||
+ | |||
+ | ==== Creating an KVM VM ==== | ||
+ | |||
+ | virt-install | ||
+ | --name=< | ||
+ | --ram=< | ||
+ | --location=http:// | ||
+ | --os-type=linux | ||
+ | --os-variant=debiansqueeze | ||
+ | --disk=/ | ||
+ | |||
+ | ==== Creating an LXC VM ==== | ||
+ | |||
+ | * Capped resources at 512mb of ram and 2 cpus | ||
+ | |||
+ | cd /img | ||
+ | mkdir < | ||
+ | sudo debootstrap wheezy < | ||
+ | sudo virt-install --connect lxc:/// --name cubert --ram 512 --vcpu 2 --filesystem / | ||
+ | |||
+ | virt-install \ | ||
+ | --connect lxc:/// | ||
+ | --name httpd_guest | ||
+ | --ram 512 | ||
+ | --vcpus 2 | ||
+ | ==== Existing KVM image ==== | ||
+ | |||
+ | virt-install | ||
+ | --name <VM name> | ||
+ | --ram < | ||
+ | --disk path=/ | ||
+ | --import --noautoconsole --force | ||
+ | |||
+ | ==== Other Useful Options ==== | ||
+ | |||
+ | * Create VM with a bridge attached to eth0 | ||
+ | < | ||
+ | |||
+ | * Run install over console | ||
+ | |||
+ | < | ||
+ | |||
+ | * Installing to an LVM Pool instead. Replace disk line with this one. You'll end up with a volume called < | ||
+ | |||
+ | < | ||
+ | |||
+ | * If you want a specific name you'll need to create the volume manually first. | ||
+ | |||
+ | < | ||
+ | |||
+ | And then use this line to specify it. | ||
+ | |||
+ | < | ||
+ | |||
+ | ===== Open Serial Console to VM ===== | ||
+ | |||
+ | virsh console <VM name> | ||
+ | |||
+ | ===== Enable Kernel output over serial ===== | ||
+ | |||
+ | On the VM edit / | ||
+ | |||
+ | GRUB_CMDLINE_LINUX=" | ||
+ | | ||
+ | Finally run update-grub as root. |