public:managing_kvm_on_debian
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| public:managing_kvm_on_debian [2024/05/07 21:13] – [Creating a network bridge] thomas | public:managing_kvm_on_debian [2024/05/17 20:56] (current) – thomas | ||
|---|---|---|---|
| Line 6: | Line 6: | ||
| < | < | ||
| - | sudo apt install --no-install-recommends qemu-system libvirt-clients libvirt-daemon-system virtinst qemu-utils dnsmasq swtpm swtpm-tools ovmf bridge-utils | + | sudo apt install --no-install-recommends qemu-system libvirt-clients libvirt-daemon-system virtinst qemu-utils dnsmasq swtpm swtpm-tools ovmf bridge-utils |
| </ | </ | ||
| Line 46: | Line 46: | ||
| </ | </ | ||
| </ | </ | ||
| + | |||
| + | You can also use a ZFS dataset as storage pool, with this alternative XML configuration: | ||
| + | |||
| + | < | ||
| + | <pool type=" | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | :!: Note that this does not support libvirt snapshots. You will need to make snapshots via ZFS manually, which may not be ideal. | ||
| Then, create the pool based on the definition and make sure it autostarts: | Then, create the pool based on the definition and make sure it autostarts: | ||
| Line 133: | Line 146: | ||
| </ | </ | ||
| - | Then, define it with '' | + | Then, define it with '' |
| < | < | ||
| virsh net-define bridged.xml | virsh net-define bridged.xml | ||
| + | virsh net-autostart bridged | ||
| + | virsh net-start bridged | ||
| </ | </ | ||
| Line 154: | Line 169: | ||
| < | < | ||
| - | virt-install --network bridged [...] | + | virt-install --network |
| </ | </ | ||
| Line 170: | Line 185: | ||
| --graphics vnc, | --graphics vnc, | ||
| --disk size=50 --memory 4096 | --disk size=50 --memory 4096 | ||
| + | --network network=bridged | ||
| </ | </ | ||
| - | You can then connect with a VNC client to the host to perform the installation. | + | You can then connect with a VNC client to the host to perform the installation. The recommended client is [[https:// |
| Some useful options: | Some useful options: | ||
| * '' | * '' | ||
| - | More examples can be found in [[public: | + | More examples can be found in [[public: |
| + | |||
| + | < | ||
| + | apt install libosinfo-bin | ||
| + | osinfo-query os | ||
| + | </ | ||
| ===== Listing running VMs ===== | ===== Listing running VMs ===== | ||
| Line 191: | Line 212: | ||
| </ | </ | ||
| - | ===== Forcing a VM to stop ===== | + | If the server had NVRAM enabled, you must specify the '' |
| < | < | ||
| - | virsh destroy | + | virsh undefine |
| + | </ | ||
| + | ===== Stopping a guest ===== | ||
| + | |||
| + | This will ask a VM to shut down: | ||
| + | |||
| + | < | ||
| + | virsh shutdown < | ||
| + | </ | ||
| + | |||
| + | This will force a VM to shut down: | ||
| + | < | ||
| + | virsh destroy < | ||
| </ | </ | ||
| ===== Editing a VM's XML configuration ===== | ===== Editing a VM's XML configuration ===== | ||
| Line 202: | Line 235: | ||
| </ | </ | ||
| + | ===== Finding the VNC display for a guest ===== | ||
| + | |||
| + | < | ||
| + | virsh vncdisplay < | ||
| + | </ | ||
| + | |||
| + | or | ||
| + | |||
| + | < | ||
| + | virsh domdisplay < | ||
| + | </ | ||
| + | |||
| + | This snippet will list out the displays for all guests: | ||
| + | |||
| + | < | ||
| + | for dom in $(virsh list --name); do echo -n "$dom: "; virsh domdisplay $dom; done | ||
| + | </ | ||
| + | |||
| + | ===== Managing media ===== | ||
| + | |||
| + | Listing attached media: | ||
| + | |||
| + | < | ||
| + | virsh domblklist < | ||
| + | </ | ||
| + | |||
| + | To replace a disk or cd-rom with another: | ||
| + | |||
| + | < | ||
| + | virsh change-media < | ||
| + | </ | ||
| + | |||
| + | Or to simply eject a disk: | ||
| + | |||
| + | < | ||
| + | virsh change-media vm1 hdc --eject | ||
| + | </ | ||
| ===== Resources ===== | ===== Resources ===== | ||
| Line 207: | Line 277: | ||
| * http:// | * http:// | ||
| * https:// | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
public/managing_kvm_on_debian.1715116405.txt.gz · Last modified: by thomas
