Merge pull request #149 from KernelGhost/main
Remove obsolete documentation.
239
docs/KVM.md
@ -1,239 +0,0 @@
|
||||
# Creating a Virtual Machine in KVM
|
||||
|
||||
This step-by-step guide will take you through setting up a CPU and memory efficient virtual machine
|
||||
to use with WinApps leveraging KVM, an open-source virtualization software contained in most Linux distributions.
|
||||
|
||||
## Install KVM
|
||||
|
||||
First up, you must install KVM and the Virtual Machine Manager. By installing `virt-manager`, you will get everything you need for your distribution:
|
||||
|
||||
```bash
|
||||
sudo apt install -y virt-manager
|
||||
```
|
||||
|
||||
## Download the Windows Professional and KVM VirtIO drivers
|
||||
|
||||
You will need Windows 10 Professional (or Enterprise or Server) to run RDP apps, Windows 10 Home will not suffice.
|
||||
You will also need drivers for VirtIO to ensure the best performance and the lowest overhead for your system.
|
||||
You can download these at the following links:
|
||||
|
||||
Windows 10 ISO: https://www.microsoft.com/en-us/software-download/windows10ISO
|
||||
|
||||
KVM VirtIO drivers (for all distros): https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso
|
||||
|
||||
## Create your virtual machine
|
||||
|
||||
The following guide will take you through the setup. If you're an expert user, you may wish to:
|
||||
|
||||
- [Define a VM from XML (may not work on all systems)](#define-a-vm-from-xml)
|
||||
- [Run KVM in user mode](#run-kvm-in-user-mode)
|
||||
|
||||
Otherwise, to set up the standard way, open `virt-manager` (Virtual Machines).
|
||||
|
||||

|
||||
|
||||
Next, go to `Edit`->`Preferences`, and check `Enable XML editing`, then click the `Close` button.
|
||||
|
||||

|
||||
|
||||
Now it is time to add a new VM by clicking the `+` button.
|
||||
|
||||

|
||||
|
||||
Choose `Local install media` and click `Forward`.
|
||||
|
||||

|
||||
|
||||
Now select the location of your Windows 10 ISO, and `Automatically detect` the installation.
|
||||
|
||||

|
||||
|
||||
Set your memory and CPUs. We recommend `2` CPUs and `4096MB` for memory. We will be using a Memory Ballooning service,
|
||||
meaning 4096 is the maximum amount of memory the VM will ever use, but will not use this amount except when it is needed.
|
||||
|
||||

|
||||
|
||||
Choose your virtual disk size, keep in mind this is the maximum size the disk will grow to,
|
||||
but it will not take up this space until it needs it.
|
||||
|
||||

|
||||
|
||||
Next, name your machine `RDPWindows` so that WinApps can detect it, and choose to `Customize configuration before install`.
|
||||
|
||||

|
||||
|
||||
After clicking `Finish`, ensure under CPU that `Copy host CPU configuration` is selected, and `Apply`.
|
||||
|
||||
**NOTE:** Sometimes this gets turned off after Windows is installed. You should check this option after install as well.
|
||||
|
||||

|
||||
|
||||
Next, go to the `XML` tab, and edit the `<clock>` section to contain:
|
||||
|
||||
```xml
|
||||
<clock offset='localtime'>
|
||||
<timer name='hpet' present='yes'/>
|
||||
<timer name='hypervclock' present='yes'/>
|
||||
</clock>
|
||||
```
|
||||
|
||||
Then `Apply`. This will drastically reduce idle CPU usage (from ~25% to ~3%).
|
||||
|
||||

|
||||
|
||||
Next, under Memory, lower the `Current allocation` to the minimum memory the VM should use. We recommend `1024MB`.
|
||||
|
||||

|
||||
|
||||
Under `Boot options`, check `Start virtual machine on host boot up`.
|
||||
|
||||

|
||||
|
||||
For SATA Disk 1, set the `Disk bus` to `VirtIO`.
|
||||
|
||||

|
||||
|
||||
For the NIC, set the `Device model` to `virtio`.
|
||||
|
||||

|
||||
|
||||
Click the `Add Hardware` button in the lower right, and choose `Storage`. For `Device type`, select `CDROM device`
|
||||
and choose the VirtIO driver ISO you downloaded earlier. This will give the Windows 10 Installer access
|
||||
to drivers during the installation process. Now click `Finish` to add the new CD-ROM device.
|
||||
|
||||

|
||||
|
||||
You're now ready to click `Begin Installation`
|
||||
|
||||

|
||||
|
||||
Now move on to installing the virtual machine.
|
||||
|
||||
## Install the virtual machine
|
||||
|
||||
From here out you will install Windows 10 Professional as you would on any other machine.
|
||||
|
||||

|
||||
|
||||
Once you get to the point of selecting the location for installation, you will see there are no disks available.
|
||||
This is because we need to load the VirtIO driver. Select `Load driver`.
|
||||
|
||||

|
||||
|
||||
The installer will then ask you to specify where the driver is located. Select the `E:\` drive
|
||||
or whichever drive the VirtIO driver ISO is located on.
|
||||
|
||||

|
||||
|
||||
Choose the appropriate driver for the OS you've selected, which is most likely the `w10` driver for Windows 10.
|
||||
|
||||

|
||||
|
||||
You will now see a disk you can select for the installation.
|
||||
|
||||

|
||||
|
||||
Windows will begin to install, and you will likely need to reboot the VM a number of times during this process.
|
||||
|
||||

|
||||
|
||||
At some point, you will come to a network screen. This is because the VirtIO drivers
|
||||
for the network haven't yet been loaded. Simply click `I don't have internet`.
|
||||
|
||||

|
||||
|
||||
It will confirm your choice, so just choose `Continue with limited setup`.
|
||||
|
||||

|
||||
|
||||
After you get into Windows and login with the user you created during the installation. Open `Explorer`
|
||||
and navigate the `E:\` drive or wherever the VirtIO driver ISO is mounted. Double-click the `virt-win-gt-64.exe` file
|
||||
to launch the VirtIO driver installer.
|
||||
|
||||

|
||||
|
||||
Leave everything as default and click `Next` through the installer. This will install device drivers as well as
|
||||
the Memory Ballooning service.
|
||||
|
||||

|
||||
|
||||
Once you finish the driver install, you will need to make some registry changes to enable RDP Applications
|
||||
to run on the system. Start by downloading the [RDPApps.reg](/install/RDPApps.reg) file,
|
||||
right-clicking on the `Raw` button, and clicking on `Save target as`.
|
||||
|
||||

|
||||
|
||||
Once you've downloaded the registry file, right-click on it, and choose `Merge`, then accept any confirmations along the way.
|
||||
|
||||

|
||||
|
||||
Next up, we need to rename the VM so that WinApps can locate it. Go to the start menu and type `About`
|
||||
to bring up the `About your PC` settings.
|
||||
|
||||

|
||||
|
||||
Scroll down and click on `Rename this PC`.
|
||||
|
||||

|
||||
|
||||
Rename to `RDPWindows`, and then `Next`, but **don't** restart.
|
||||
|
||||

|
||||
|
||||
Lastly, scroll down to `Remote Desktop`, and toggle `Enable Remote Desktop` on, and `Confirm`.
|
||||
|
||||

|
||||
|
||||
At this point, you will need to restart, and you've completed your setup.
|
||||
|
||||
Rather than restart, you can go right ahead and install other applications like Microsoft Office or Adobe CC
|
||||
that could be used through WinApps.
|
||||
|
||||
You may also wish to install
|
||||
the [Spice Guest Tools](https://www.spice-space.org/download/windows/spice-guest-tools/spice-guest-tools-latest.exe)
|
||||
inside the VM which enables features like auto-desktop resize and cut-and-paste when using `virt-manager`.
|
||||
As WinApps uses RDP, this is unnecessary if you don't plan to access the machine via `virt-manager`.
|
||||
|
||||
Once you're finished, restart the VM, but don't log in. Simply close the VM viewer, and close the Virtual Machine Manager.
|
||||
|
||||
## Expert installs
|
||||
|
||||
### Define a VM from XML
|
||||
|
||||
This expert guide for XML imports is specific to Ubuntu 20.04 and may not work on all hardware platforms.
|
||||
|
||||
You can refer to the [KVM](https://www.linux-kvm.org) documentation for specifics, but the first thing you need to do is
|
||||
set up a Virtual Machine running Windows 10 Professional (or any version that supports RDP). First, install KVM:
|
||||
|
||||
``` bash
|
||||
sudo apt install -y virt-manager
|
||||
```
|
||||
|
||||
Now, copy your Windows ISO and VirtIO iso (links to download in the main guide) into the folder
|
||||
and update the `kvm/RDPWindows.xml` appropriately.
|
||||
|
||||
Next, define a VM called RDPWindows from the sample XML file with:
|
||||
|
||||
``` bash
|
||||
virsh define kvm/RDPWindows.xml
|
||||
virsh autostart RDPWindows
|
||||
```
|
||||
|
||||
You should then open the VMs properties in `virt-manager` and ensure that under CPU `Copy host CPU configuration` is selected.
|
||||
|
||||
Boot it up, install Windows, and then [Install the virtual machine](#install-the-virtual-machine).
|
||||
|
||||
### Run KVM in user mode
|
||||
|
||||
Now set up KVM to run as your user instead of root and allow it through AppArmor (for Ubuntu 20.04 and above):
|
||||
|
||||
``` bash
|
||||
sudo sed -i "s/#user = "root"/user = "$(id -un)"/g" /etc/libvirt/qemu.conf
|
||||
sudo sed -i "s/#group = "root"/group = "$(id -gn)"/g" /etc/libvirt/qemu.conf
|
||||
sudo usermod -a -G kvm $(id -un)
|
||||
sudo usermod -a -G libvirt $(id -un)
|
||||
sudo systemctl restart libvirtd
|
||||
sudo ln -s /etc/apparmor.d/usr.sbin.libvirtd /etc/apparmor.d/disable/
|
||||
```
|
||||
|
||||
You will likely need to reboot to ensure your current shell is added to the group.
|
BIN
docs/kvm/00.png
Before Width: | Height: | Size: 101 KiB |
BIN
docs/kvm/01.png
Before Width: | Height: | Size: 21 KiB |
BIN
docs/kvm/02.png
Before Width: | Height: | Size: 14 KiB |
BIN
docs/kvm/03.png
Before Width: | Height: | Size: 36 KiB |
BIN
docs/kvm/04.png
Before Width: | Height: | Size: 35 KiB |
BIN
docs/kvm/05.png
Before Width: | Height: | Size: 25 KiB |
BIN
docs/kvm/06.png
Before Width: | Height: | Size: 30 KiB |
BIN
docs/kvm/07.png
Before Width: | Height: | Size: 42 KiB |
BIN
docs/kvm/08.png
Before Width: | Height: | Size: 75 KiB |
BIN
docs/kvm/09.png
Before Width: | Height: | Size: 126 KiB |
BIN
docs/kvm/10.png
Before Width: | Height: | Size: 72 KiB |
BIN
docs/kvm/11.png
Before Width: | Height: | Size: 77 KiB |
BIN
docs/kvm/12.png
Before Width: | Height: | Size: 88 KiB |
BIN
docs/kvm/13.png
Before Width: | Height: | Size: 80 KiB |
BIN
docs/kvm/14.png
Before Width: | Height: | Size: 73 KiB |
BIN
docs/kvm/15.png
Before Width: | Height: | Size: 96 KiB |
BIN
docs/kvm/16.png
Before Width: | Height: | Size: 36 KiB |
BIN
docs/kvm/17.png
Before Width: | Height: | Size: 43 KiB |
BIN
docs/kvm/18.png
Before Width: | Height: | Size: 53 KiB |
BIN
docs/kvm/19.png
Before Width: | Height: | Size: 49 KiB |
BIN
docs/kvm/20.png
Before Width: | Height: | Size: 43 KiB |
BIN
docs/kvm/21.png
Before Width: | Height: | Size: 32 KiB |
BIN
docs/kvm/22.png
Before Width: | Height: | Size: 30 KiB |
BIN
docs/kvm/23.png
Before Width: | Height: | Size: 71 KiB |
BIN
docs/kvm/24.png
Before Width: | Height: | Size: 199 KiB |
BIN
docs/kvm/25.png
Before Width: | Height: | Size: 225 KiB |
BIN
docs/kvm/26.png
Before Width: | Height: | Size: 198 KiB |
BIN
docs/kvm/27.png
Before Width: | Height: | Size: 168 KiB |
BIN
docs/kvm/28.png
Before Width: | Height: | Size: 178 KiB |
BIN
docs/kvm/29.png
Before Width: | Height: | Size: 171 KiB |
BIN
docs/kvm/30.png
Before Width: | Height: | Size: 157 KiB |
BIN
docs/kvm/31.png
Before Width: | Height: | Size: 160 KiB |