Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tools:kvm [2024/01/19 16:15] – [VM] darrontools:kvm [2024/08/15 00:35] (current) – [VM] darron
Line 58: Line 58:
  
 ==Create== ==Create==
 +
 +__Interactive__
 +
 +This example uses a fixed MAC address.
  
 <code> <code>
Line 70: Line 74:
 virsh destroy ${NAME} virsh destroy ${NAME}
 virsh undefine ${NAME} virsh undefine ${NAME}
-rm -f $DISK+rm -f ${DISK}
  
 virt-install \ virt-install \
Line 78: Line 82:
 --vcpus 1 \ --vcpus 1 \
 --os-variant debian11 \ --os-variant debian11 \
---network bridge=br0 \+--network bridge=br0,mac=02:00:c0:a8:00:6e \
 --graphics none \ --graphics none \
 --console pty,target_type=serial \ --console pty,target_type=serial \
 --location "${DVD}" \ --location "${DVD}" \
---initrd-inject preseed.cfg \ +--extra-args 'console=ttyS0'
---extra-args 'console=ttyS0,115200n8 serial'+
 </code> </code>
 +
 +__Non interactive__
 +
 +Append the following to the interactive script above
 +
 +<code>
 +--initrd-inject preseed.cfg --noautoconsole --wait
 +</code>
 +
 +This preseed file uses a fixed IP address.
  
 [[:tools:preseed|preeseed.cfg]] [[:tools:preseed|preeseed.cfg]]
 +
  
 ==List== ==List==
Line 93: Line 107:
 virsh list --all virsh list --all
 </code> </code>
 +
 +==Start==
 +
 +<code>
 +virsh start debian12
 +</code>
 +
 +==Auto start==
 +
 +<code>
 +virsh autostart debian12
 +</code>
 +
 +== No auto start==
 +
 +<code>
 +virsh autostart --disable debian12
 +</code>
 +
 +== Information ==
 +
 +<code>
 +virsh dominfo debian12
 +</code>
 +
  
 ==Console== ==Console==
Line 101: Line 140:
  
 ==Stop== ==Stop==
 +
 +<code>
 +virsh shutdown debian12
 +</code>
 +
 +NB there are optional modes
 +
 +== Force stop==
  
 <code> <code>
Line 110: Line 157:
 <code> <code>
 virsh undefine debian12 virsh undefine debian12
 +</code>
 +
 +==Export==
 +
 +<code>
 +virsh dumpxml debian12 > debian12.xml
 +</code>
 +
 +==Import==
 +
 +<code>
 +virsh define debian12.xml
 </code> </code>
 ===Resources=== ===Resources===
Line 117: Line 176:
 [[https://www.golinuxcloud.com/virt-install-examples-kvm-virt-commands-linux/|virt-install examples]] [[https://www.golinuxcloud.com/virt-install-examples-kvm-virt-commands-linux/|virt-install examples]]
  
 +[[https://cdimage.debian.org/debian-cd/current/amd64/iso-dvd/|DVD ISO Debian Current]]
 +
 +[[https://cloud.debian.org/cdimage/archive/11.10.0/amd64/iso-dvd/|DVD ISO Debian Bullseye 11.10]]
 +
 +[[https://cloud.debian.org/cdimage/archive/10.13.0/amd64/iso-dvd/|DVD ISO Debian Buster 10.13]]