KVM: Difference between revisions

From 太極
Jump to navigation Jump to search
Line 71: Line 71:
<li> [https://mintguide.org/tools/340-kvm-virtualization-on-a-home-pc-with-linux-mint.html KVM virtualization on a home PC with Linux Mint] </li>
<li> [https://mintguide.org/tools/340-kvm-virtualization-on-a-home-pc-with-linux-mint.html KVM virtualization on a home PC with Linux Mint] </li>
<li> [https://www.linuxtechi.com/install-configure-kvm-ubuntu-18-04-server/ How to Install and Configure KVM on Ubuntu 18.04 LTS Server]. I skip step 4: Configure Network Bridge for KVM virtual Machines. </li>
<li> [https://www.linuxtechi.com/install-configure-kvm-ubuntu-18-04-server/ How to Install and Configure KVM on Ubuntu 18.04 LTS Server]. I skip step 4: Configure Network Bridge for KVM virtual Machines. </li>
<pre>
# Step:2 Install KVM and its required packages
sudo apt update
sudo apt install qemu qemu-kvm libvirt-bin  bridge-utils  virt-manager
# Step:3 Start & enable libvirtd service
sudo service libvirtd start
sudo update-rc.d libvirtd enable
service libvirtd status
# Step 5: Creating Virtual machine (virt-manager or virt-install command )
sudo virt-manager
</pre>
<li>[https://www.tecmint.com/install-kvm-on-ubuntu/ How to Install KVM on Ubuntu 20.04]
<li>[https://www.tecmint.com/install-kvm-on-ubuntu/ How to Install KVM on Ubuntu 20.04]
{{Pre}}
{{Pre}}
Line 95: Line 82:
# I got two new: virbr0, virbr0-nic
# I got two new: virbr0, virbr0-nic
# Click the superkey (Windows) and search/launch "Virtual Machine Manager"
# Click the superkey (Windows) and search/launch "Virtual Machine Manager"
</pre>
Error: No active connection to install on
<pre>
sudo virt-install --name=ubuntu2004 \
  --os-type=Linux \
  --os-variant=ubuntu20.04 \
  --vcpu=2 --ram=2048 \
  --graphics vnc \
  --location=ubuntu-20.04.1-desktop-amd64.iso \
  --network bridge:virbr0
</pre>
</pre>
</li>
</li>

Revision as of 11:25, 26 November 2020

Resource

Install

Install on Ubuntu

Install on CentOS

snapshot

  • How to Create, Revert and Delete KVM Virtual machine (domain) snapshot with virsh command, How to create snapshot in Linux KVM VM/Domain
    $ sudo su
    # virsh list --all
    
    # virsh snapshot-create-as --domain win10 --name win10_snap --description "Windows 10 snapshot"    # Create a snapshot
    # virsh snapshot-list win10
    # virsh snapshot-info --domain win10 --snapshotname win10_snap
    
    # virsh snapshot-revert win10 win10_snap    # Restore
    
    # virsh snapshot-delete --domain win10 --snapshotname win10_snap
    
  • To create a snapshot using the GUI, open virtualization manager window. In the VM properties, click on the icon (two displays overlapped) which is on the right of the menu, which says Manage VM snapshots.

GUI manager

Back and restore images

How to KVM Backup and Restore in Linux

# Backup 
virsh list --all
virsh dumpxml win10 > /MyBackup/win10.xml
sudo cp /var/lib/libvirt/images/win10.qcow2 /MyBackup/win10.qcow2
sudo chown $USER:$USER /MyBackup/*.qcow2

# Restore Making
sudo virsh undefine win10
ls -l /etc/libvirt/qemu
virsh list –all
sudo rm /var/lib/libvirt/images/win10.qcow2
sudo cp /MyBackup/win10.qcow2 /var/lib/libvirt/images/
sudo virsh define --file /MyBackup/win10.xml
# virsh start win10

Cheat sheet

KVM Cheatsheet

Run macOS on KVM / QEMU

How To run macOS on KVM / QEMU