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 14:52] – [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 \
 --name "${NAME}" \ --name "${NAME}" \
---ram 4096 \+--ram 1024 \
 --disk path="${DISK}" \ --disk path="${DISK}" \
 --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 'ks=file:/preseed.cfg 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==
  
 <code> <code>
-virsh console bullseye-amd64+virsh console debian12
 </code> </code>
  
Line 103: Line 142:
  
 <code> <code>
-virsh shutdown bullseye-amd64+virsh shutdown debian12 
 +</code> 
 + 
 +NB there are optional modes 
 + 
 +== Force stop== 
 + 
 +<code> 
 +virsh destroy debian12
 </code> </code>
  
Line 109: Line 156:
  
 <code> <code>
-virsh undefine bullseye-amd64+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]]