KVM: Difference between revisions
Jump to navigation
Jump to search
Line 80: | Line 80: | ||
--location=ubuntu-20.04.1-desktop-amd64.iso | --location=ubuntu-20.04.1-desktop-amd64.iso | ||
</pre> | </pre> | ||
Add '''--network bridge:br0''' if we have added a new bridge network (''br0'') in the host (eg using '''netplan''' or '''nmcli''' in Ubuntu). See some resource below. | Add '''--network bridge:br0''' if we have added a new bridge network (''br0'') in the host (eg using '''netplan''' or '''nmcli''' or '''nm-connection-editor''' GUI Tool in Ubuntu). See some resource below. | ||
</li> | </li> | ||
<li>[https://www.cyberciti.biz/faq/how-to-install-kvm-on-ubuntu-20-04-lts-headless-server/ How to install KVM on Ubuntu 20.04 LTS Headless Server]</li> | <li>[https://www.cyberciti.biz/faq/how-to-install-kvm-on-ubuntu-20-04-lts-headless-server/ How to install KVM on Ubuntu 20.04 LTS Headless Server]</li> |
Revision as of 11:14, 26 November 2020
Resource
- KVM Kernel-based Virtual Machine
- https://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine
- Virtual Machine Manager - virt-manager. It can display VNC or SPICE, and uses libvirt to lookup the graphical connection details.
- My notes:
- One advantage over VB for me: No need to go to VirtualBox website for the installation and frequent updates. I can use the command line to install it.
- The desktop screen resolution can be automatically adjusted without a need to install guest addition or vmware tool. Tested Ubuntu and Pop_OS.
- It has two windows. One is virt-manager and the other is the virtual machine.
- Use Left Control + Left Alt to escape the virtual machine.
- https://en.wikipedia.org/wiki/QEMU
- It is probably the most widely deployed open source hypervisor in an open source environment.
- KVM cannot be installed on a Windows system.
- How to Install Linux KVM and Create Guest VM with Examples. Para-virtualization, checking the virtualization support on hardware and others. It includes the usage of virsh and virt-install commands.
- Virtualization solutions on Linux systems - KVM and VirtualBox
- Guest additions: it seems QEUM/KVM does not have that to download.
- Share clipboard. How can I copy&paste from the host to a KVM guest? sudo apt install spice-vdagent in the guest virtual machine. had to reboot guest to be able to make it work. It works.
- Display resolution. The display has a resolution 1024x768. In the virtual machine window, I do 'View' -> 'Scale to Display' where I choose 'Always' and check the checkbox 'Auto resize VM with window'. It did increase the resolution. See also the command line method: How to increase the visualized screen resolution on QEMU / KVM?
- Share files
- QEMU/KVM on Ubuntu and sharing files between host and guests. It works. Modify/create a file /etc/rc.local file to automount the folder at each login. Note the share folder still belongs to the user's group. So we can actually create a soft link for this folder on the host.
- Is there something like “VirtualBox Guest Additions” for QEMU/KVM?
- Mouse integration. virt-manager KVM mouse pointer integration (client mouse mode) with Ubuntu guest. Any way to release focus on a KVM guest in virt-manager without having to click Ctrl_L + Alt_L?
- Monitoring performance in virtual machine manager from redhat.com
- How To Use QEMU To Test Operating Systems & Distributions
- Using KVM and VirtualBox side by side and VirtualBox and KVM beside each other
- Comparison
- Fundamental question:
- Can we install KVM without any Operating System installed -Yes because KVM is already a part of Linux kernel. The Linux kernel acts as the virtualization engine.
- Is it possible to install the Linux kernel alone?
- Change amount of Ram and CPU cores in KVM, HowTo Add Memory in KVM Virtual Machine
virsh --version virsh list virsh dominfo ubuntu16.04 | grep mem virsh setmaxmem ubuntu16.04 --size 4194304 --config # in KB virsh setmem ubuntu16.04 --size 2097152 --config # in KB virsh dominfo ubuntu16.04 | grep mem # Or edit the XML configuration file virsh edit ubuntu16.04
Install
Install on Ubuntu
- Virtualization - The Debian Administrator's Handbook
- How to install KVM on Ubuntu 14.04 LTS Headless Server from cyberciti
- Simple Virtualization With Ubuntu 16.04 Linux and KVM from linuxconfig
- KVM virtualization on a home PC with Linux Mint
- How to Install and Configure KVM on Ubuntu 18.04 LTS Server. I skip step 4: Configure Network Bridge for KVM virtual Machines.
- How to Install KVM on Ubuntu 20.04
sudo apt install -y qemu qemu-kvm libvirt-daemon \ libvirt-clients bridge-utils virt-manager sudo systemctl status libvirtd # enable it to start on boot sudo systemctl enable --now libvirtd lsmod | grep -i kvm ip a # I got two new: virbr0, virbr0-nic # Click the superkey (Windows) and search/launch "Virtual Machine Manager"
Click the "Create a new virtual machine" button will result in an error: No active connection to install on. Rebooting does not help. But when I use the command line to create a new VM it works.
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
Add --network bridge:br0 if we have added a new bridge network (br0) in the host (eg using netplan or nmcli or nm-connection-editor GUI Tool in Ubuntu). See some resource below.
- How to install KVM on Ubuntu 20.04 LTS Headless Server
- Where are image files saved: /var/lib/libvirt/images (/var/lib/docker for Docker)
- Troubleshooting: virt-manager can't connect to libvirt. Rebooting computer!
Install on CentOS
- How to install KVM on CentOS 8 Headless Server
- How to install KVM on CentOS 7 / RHEL 7 Headless Server
- How to Deploy Multiple Virtual Machines using Network Install (HTTP, FTP and NFS) under KVM Environment
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
- Manage KVM Virtual Machines Using Cockpit Web Console
- How To Manage KVM Virtual Machines With Virt-Manager. View -> Graph -> Memory Usage
Network
- Host only (used by VirtualBox) = Isolated network (used by KVM). Step 1: Select a VM. Click Edit, choose "Connection Details" and add a new network (Isolated mode). This default network has IPv4 192.168.122.0/24 Step 2: Click Edit, choose "Virtual machine Details" and click the Information icon (circle shape). Click "Add Hardware" and choose "Isolated network" for the Network source. Leave the MAC address and Device model as defaults. This network network has IP4 192.168.100.0/24.
- How to configure bridged network in virt-manager (CentOS / RHEL 7)
- Install And Set Up KVM On Ubuntu 20.04 Focal Fossa Linux
- How to Configure Network Bridge in Ubuntu
- KVM: Creating a bridged network with NetPlan on Ubuntu bionic
- VirtualNetworking
- Network XML format
- KVM Networking - NAT & Host-Only
- Home Lab Project: Network Bridges for KVM - NAT, Host-only, Isolated
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