# ========== # - Install KVM system on file-ah # ========== # - NTFS Treiber und Programm Utils # - # - only needed for mounting windows partition directly # apt-get install ntfs-3g # ----- # - Installiere KVM und notwendige Pakete # ----- # - Note !! # - See if files /etc/pam.d/common-* has changed # - Backup these files first. # - cp -a /etc/pam.d /root/etc_pam.d # Install TPM (Trusted Platform Module) Emulator 'swtpm' # apt install swtpm swtpm-tools # Enable secure-boot/UEFI on KVM. # # The secure boot/UEFI is available by default when you have installed the KVM # program on your machine. If it is not available by any chance, you may enter # the command below to install it. # apt install ovmf # ----- # - Install KVM System # ----- # - Install KVM System on Debian trixie # # apt install qemu-system libvirt-clients libvirt-daemon-system libosinfo-bin # # When installing on a server, you can add the --no-install-recommends apt option, # to prevent the installation of extraneous graphical packages: # # apt install --no-install-recommends qemu-system libvirt-clients libvirt-daemon-system libosinfo-bin # apt install --no-install-recommends qemu-system libvirt-clients libvirt-daemon-system libosinfo-bin # To support creating KVM guest system via console install package 'virtinst'. # # apt install virtinst qemu-kvm # Anzeige der grafischen Konsole einer virtuellen Maschine # apt install virt-viewer # Maybe you want also install package 'libguestfs-tools'. # # this package provides guest disk image management system and diagnostic tools like: # # guestmount # guestunmount # libguestfs-test-tool # ... # virt-copy-in # virt-copy-out # ... # virt-rescue # virt-resize # ... # virt-tail # ... # apt install libguestfs-tools # - Einloggen und nachsehen, ob KVM erfolgreich installiert wurde # - # - Es sollte eine leere Tabelle aber KEIN Fehler angezeigt werden # - # - Id Name State # - ---------------------------------- # - virsh -c qemu:///system list # ----- # - Configure KVM System # ----- # - In order to be able to manage virtual machines as regular user, that user # - needs to be added to some groups. # - #usermod -a -G libvirt root usermod -a -G libvirt chris usermod -a -G libvirt sysadm #usermod -a -G libvirt-qemu root usermod -a -G libvirt-qemu chris usermod -a -G libvirt-qemu sysadm # activate/enable ksm support # # Kernel Samepage Merging (KSM) erlaubt eine Deduplizierung des Memory unter Linux # und wurde mit der Kernel Version 2.6.32 eingeführt. KSM versucht gleiche Memory # Pages zu erkennen und diese zusammenzuführen um den doppelt belegten Memory # freizugeben. Es versucht möglichst Memory Pages zu finden welche selten aktualisiert # werden, da es sich ansonsten als ineffizient erweisen könnte. # # Ursprünglich wurde KSM für den Einsatz von virtuellen Maschinen entwickelt. Wenn # diese virtuellen Maschinen die gleichen Programme oder Betriebssystem einsetzen, # kann der gesamte Memory Verbrauch unter Umständen dramatisch reduziert werden und # mehr virtuelle Maschinen mit dem vorhandenem RAM betrieben werden. # # Erste Tests von Red Hat haben gezeigt, dass 52 virtuelle Maschinen mit Windows XP # und 1 GB RAM auf einem Server mit nur 16 GB RAM betrieben werden können. # # Die Virtualisierung KVM unterstützt den Einsatz von KSM. Basierend auf diesem # Bug-Report (http://bugzilla.openvz.org/show_bug.cgi?id=1623) unterstützt OpenVZ # KSM nicht. # # Ob KSM in Ihrem Kernel integriert ist können Sie anhand der Kernel Konfiguration # überprüfen: # # $ grep KSM /boot/config-`uname -r` # CONFIG_KSM=y # # Install ksm.service: # apt-get install ksmtuned --no-install-recommends # VNC is configured to listen on 127.0.0.1 by default. # To make it listen on all public interfaces, uncomment # this next option in file /etc/libvirt/qemu.conf. # # vnc_listen = "0.0.0.0" # # NB, strong recommendation to enable TLS + x509 certificate # verification when allowing public access # # vim /etc/libvirt/qemu.conf # ----- # - Download virtio-win driver # ----- # link image directory to /misc/libvirt_images # mkdir -p /misc/libvirt_images rmdir /var/lib/libvirt/images/ ln -s /misc/libvirt_images /var/lib/libvirt/images # Download virtio driver, see: # # https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/ # # Currently up-to-date driver: virtio-win-0.1.285.iso # cd /misc/libvirt_images wget https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.285-1/virtio-win-0.1.285.iso # ----- # - Configure network # ----- # - Install bridge-utils # - apt-get install bridge-utils # Configure bridge using netwoerk interface 'eno1np0' # # auto br0 # iface br0 inet static # hwaddress 7c:c2:55:c0:26:74 # address 192.168.100.20/24 # gateway 192.168.100.254 # # # bridge settings # bridge_ports eno1np0 # bridge_stp off # bridge_fd 5 # bridge_hello 2 # bridge_maxage 12 # # # hook scripts # pre-up ip link set dev eno1np0 up # --- # --- Some hints # --- # 1.) Festplatten unter Windows sind deutlich schneller wenn man cache='none' setzt: # # # # # # # # 2.) Das Netzwerk ist schneller mit einer Intel-NIC: # # # # # # # If you modify a guest's xml file (located in the /etc/libvirt/qemu/ # directory) i.e. vm10.xml, afterwords you must redefine the guest: # virsh --connect qemu:///system define /etc/libvirt/qemu/vm10.xml