redhat:virtualization-redhat:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
redhat:virtualization-redhat:start [2020/04/01 10:43] – [KVM Hypervisor unter Redhat / CentOS 7] michaelredhat:virtualization-redhat:start [2020/04/01 11:32] michael
Line 1: Line 1:
-====== KVM Hypervisor unter Redhat / CentOS ======+====== KVM Hypervisor on Red Hat / CentOS 8.x ======
  
-**KVM** ist eine Open Source Hardware Virtualisierungslösung, welche dazu gebraucht werden kann; um mehrere Linux basierende oder auch Windows basierende Systeme parallel auf einem Host zu betreiben+**KVM** is an open source hardware virtualization solution which can be used to run several Linux-based or Windows-based systems in parallel on one host
  
-KVM ist typischerweise bekannt als sogenannte "**Kernel based Virtual Machine**"Dies ist soweil nach der Installation des Pakets das KVM Module beim nächsten Boot mit dem Kernel geladen wird und so einen //normalen Linux Server// in einen Baremetal-Hypervisor verwandelt+KVM is known as a so-called "**Kernel based Virtual Machine**"This is because after installing the packagethe KVM module is loaded with the kernel at the next boot, turning a //normal Linux server// into a bare metal hypervisor
  
-Nun werde ich beschreiben, wie genau so ein [[https://de.wikipedia.org/wiki/Kernel-based_Virtual_Machine|KVM Hypervisor]] aufgesetzt wird und wie man ihn anschliessend verwalten kann.+Now I will describe how to set up such a [[https://de.wikipedia.org/wiki/Kernel-based_Virtual_Machine|KVM Hypervisor]] and how to manage it afterwards.
  
  
 +  * [[redhat:virtualization-redhat:kvm-installation-centos7|OLD - KVM Installation on CentOS / Red Hat 7.x]]
  
-<wrap em>Bevor mit der Installation des Hypervisors begonnen wirdmuss immer zuerst überprüft werden; ob die aktuelle Maschine überhaupt eine Virtualisierung unterstützt. Dies wird folgendermassen gemacht:</wrap>+ 
 +---- 
 + 
 +<WRAP center round important 100%> 
 +<wrap em>Before we startverify support for **Virtual Technology** of the CPU by issueing the following command:</wrap>
  
 <code> <code>
-grep -E '(vmx|svm)' /proc/cpuinfo+lscpu grep Virtualization
 </code> </code>
 +<sxh bash; gutter: false;>
 +Virtualization:      VT-x
 +Virtualization type: full
 +</sxh>
  
-Wenn man nun den Output **vmx** oder **svn** bekommt ist alles in OrdnungWenn nichts kommt kann auf diesem Host nicht visualisiert werden.+The output of the above command shows that, our server kvm-virtualization-01.recipes.com supports Virtualization.
  
-[[redhat:virtualization-redhat:kvm-installation-centos7|KVM Installation auf CentOS / Red Hat 7.5]]+However, if the above command returns no result on your server then,
  
 +  - ''In case of bare-metal machine, you have to enable the VT support from system BIOS.''
 +  - ''In case of virtual machine, you have to enable the VT support from VM's CPU Settings.''
 +</WRAP>
  
-===== Installation von KVM ===== 
-Jetzt kann die Installation von KVM durchgeführt werden. Als erstes werden dafür die benötigten Pakages installiert. 
  
-<code> 
- # yum install qemu-kvm qemu-img virt-manager libvirt libvirt-python libvirt-client virt-install virt-viewer bridge-utils 
-</code> 
  
-Nach erfolgreicher Installation müssen die Services gestartet & aktiviert werden. 
  
-<code> +===== Installing KVM and QEMU =====
-# systemctl start libvirtd +
-# systemctl enable libvirtd +
-</code>+
  
-Nun sollte überprüft werdenob KVM erfolgreich seine beiden Core-Module laden konnte.+ 
 +In CentOS 8 / RHEL 8virtualization components including KVM and QEMU hypervisors are bundled in virt module. Therefore, it is really simple now to configure a KVM virtualization host in CentOS 8.
  
 <WRAP center box 100%> <WRAP center box 100%>
 +We are installing virt module using dnf command.
 +
 <code> <code>
-lsmod | grep kvm+dnf install -y @virt
 </code> </code>
- +<sxh bash; gutter: false;
-<sxh bash; gutter: false> +... 
-kvm_intel             162153  0 +================================================================================ 
-kvm                   525409  kvm_intel+Installed: 
 +  libguestfs-1:1.38.4-11.1.module_el8.0.0+189+f9babebb.x86_64 
 +  libvirt-client-4.5.0-24.3.module_el8.0.0+189+f9babebb.x86_64 
 +  libvirt-daemon-config-network-4.5.0-24.3.module_el8.0.0+189+f9babebb.x86_64 
 +  libvirt-daemon-kvm-4.5.0-24.3.module_el8.0.0+189+f9babebb.x86_64 
 +  alsa-lib-1.1.6-3.el8.x86_64 
 +  autogen-libopts-5.18.12-7.el8.x86_64 
 +  boost-atomic-1.66.0-6.el8.x86_64 
 +  boost-chrono-1.66.0-6.el8.x86_64 
 +  boost-date-time-1.66.0-6.el8.x86_64 
 +  boost-iostreams-1.66.0-6.el8.x86_64 
 +  boost-program-options-1.66.0-6.el8.x86_64 
 +  boost-random-1.66.0-6.el8.x86_64 
 +  boost-regex-1.66.0-6.el8.x86_64 
 +  boost-system-1.66.0-6.el8.x86_64 
 +  boost-thread-1.66.0-6.el8.x86_64 
 +  cairo-1.15.12-3.el8.x86_64 
 +  celt051-0.5.1.3-15.el8.x86_64 
 +  dnsmasq-2.79-4.el8.x86_64 
 +  edk2-ovmf-20180508gitee3198e672e2-9.el8_0.1.noarch 
 +  fribidi-1.0.4-6.el8.x86_64 
 +  genisoimage-1.1.11-39.el8.x86_64 
 +  glusterfs-api-3.12.2-40.2.el8.x86_64 
 +  glusterfs-cli-3.12.2-40.2.el8.x86_64 
 +  gnutls-dane-3.6.5-2.el8.x86_64 
 +  gnutls-utils-3.6.5-2.el8.x86_64 
 +  graphite2-1.3.10-10.el8.x86_64 
 +  gstreamer1-1.14.0-3.el8.x86_64 
 +  gstreamer1-plugins-base-1.14.0-4.el8.x86_64 
 +  harfbuzz-1.7.5-3.el8.x86_64 
 +  hivex-1.3.15-7.module_el8.0.0+189+f9babebb.x86_64 
 +  ipxe-roms-qemu-20181214-1.git133f4c47.el8.noarch 
 +  iso-codes-3.79-2.el8.noarch 
 +  libX11-1.6.7-1.el8.x86_64 
 +  libX11-common-1.6.7-1.el8.noarch 
 +  libX11-xcb-1.6.7-1.el8.x86_64 
 +  libXau-1.0.8-13.el8.x86_64 
 +...
 </sxh> </sxh>
 </WRAP> </WRAP>
  
-Stimmt die Ausgabe mit der oben aufgelisteten Ausgabe in etwa übereinso sollte nun schon alles parat sein zum Virtualisierungen.+<WRAP center box 100%> 
 +We are also installing virt-install packagebecause it provides some very useful command line tools.
  
-<WRAP center round tip 100%> 
-''**Wichtig zu Beachten:** 
-Falls Redhat 7 oder CentOS 7 als minimal Installation installiert wurde, so fehlt nun noch das sogenannte x-window Pakage, welches jedoch zum anzeigen des Virt-managers unumgänglich ist. Zum nachinstallieren folgenden Befehl ausführen:'' 
 <code> <code>
-yum install "@X Window System" xorg-x11-xauth xorg-x11-fonts-* xorg-x11-utils -y+dnf install -y virt-install
 </code> </code>
-</WRAP> 
  
 +<sxh bash; gutter: false;>
 +...
 +================================================================================
 +Installing:
 + virt-install        noarch 2.0.0-5.1.el8                       AppStream 100 k
 +Installing dependencies:
 + libosinfo           x86_64 1.2.0-5.el8                         AppStream 244 k
 + osinfo-db           noarch 20181011-8.el8_0.1                  AppStream 172 k
 + osinfo-db-tools     x86_64 1.2.0-1.el8                         AppStream  90 k
 + python3-libvirt     x86_64 4.5.0-2.module_el8.0.0+189+f9babebb AppStream 291 k
 + virt-manager-common noarch 2.0.0-5.1.el8                       AppStream 921 k
 + python3-chardet     noarch 3.0.4-7.el8                         BaseOS    195 k
 + python3-pysocks     noarch 1.6.8-3.el8                         BaseOS     34 k
 + python3-requests    noarch 2.20.0-1.el8                        BaseOS    123 k
 + python3-urllib3     noarch 1.23-5.el8                          BaseOS    178 k
  
-===== Vorbereitungen zu starten des Virt-Managers ===== +Transaction Summary 
-Befindet man sich auf einem Server mit GUI und arbeitet auch direkt auf diesem, so kann man ganz einfach via Konsole den **virt-manager** aufrufen und das Programm wird gestartet.+================================================================================ 
 +Install  10 Packages 
 +... 
 +</sxh>
  
-Ist man jedoch so wie ich, per **Putty** von einem **Windows System** aus verbunden, so wird dies nicht ganz so einfach funktionieren. Es muss nämlich hierzu zuerst noch ein spezielles Programm Namens: "[[https://sourceforge.net/projects/xming/|Xming]]" +</WRAP>
-auf dem Windows System installiert werden. **Xming** erlaubt es Grafikdarstellungen welche via SSH gesendet werden in Windows als eigenes Fenster Remote darzustellen. So können wir also dann später auch ganz einfach nur den **virt-manager** per Putty aufrufen und es sollte dann die besagte Konsole öffnen.+
  
 <WRAP center box 100%> <WRAP center box 100%>
-==== Xming Installation ==== +Allow QEMU/KVM Commands for personal user
-  - ''Als erstes sollte wenn nicht schon passiert Xming [[https://sourceforge.net/projects/xming/|HIER]] **heruntergeladen** und **installiert** werden.'' +
-  - ''Anschliessend soll Xming gestartet werden.'' {{ :redhat:virtualization-redhat:xming-systray.png?nolink&700 |}} +
-  - ''<wrap hi><wrap em>WICHTIG:</wrap>Nun müssen alle bestehenden Sitzungen von Putty zum Hypervisor getrennt werden!</wrap>'' +
-  - ''Als nächstes müssen wir dann in Putty selber bei der Hypervisor-Verbindung das **X11 forwarding** zulassen.'' ''Dazu geht man beim richtigen System (Nach dem laden des Putty Profiles) Unter **Connection / SSH / X11** und setzt dort ein häcklein bei "**Enable X11 forwarding**."'' {{ :redhat:virtualization-redhat:putty-x11.png?nolink&400 |}}  +
-  - ''Nun kann man die veränderten **Einstellung in der Session speichern**; Und anschliessend die Putty Verbindung neu aufbauen.''+
  
-''<wrap em>Hat nun alle geklappt kann, jetzt auch von der Putty Session aus ganz einfach mit dem Befehl: "**virt-manager**" die Management Oberfläche von KVM gestartet werden.</wrap>'' +If you want to allow your login user (non-root) to run virsh command or other KVM/QEMU commands, or use these commands without sudo, (needed by cockpit) then add your login user to the libvirt group as follows:
-</WRAP> +
- +
- +
-===== Starten des Virt Managers ===== +
- +
-Virt Manager is a graphical tool through which we can install and manage virtual machines. To start the virt manager type the '**virt-manager**' command from the terminal.+
  
 <code> <code>
-virt-manager+usermod -aG libvirt YOURUSERNAME
 </code> </code>
 +</WRAP>
  
-{{:redhat:virtualization-redhat:virt-manger-1.jpg?nolink|}} 
  
  
-===== Configure Bridge Interface ===== +<WRAP center box 100%> 
-Before Start creating VMs , let’s first create the bridge interface. Bridge interface is required if you want to access virtual machines from outside of your hypervisor network.+Validate all the components on your KVM host can support virtualization.
  
 <code> <code>
-cd /etc/sysconfig/network-scripts/ +virt-host-validate
-# cp ifcfg-eno49 ifcfg-br0+
 </code> </code>
  
-<WRAP center round box 100%+<sxh bash; gutter: false;
-**Edit** the **Interface file** and set followings:+  QEMUChecking for hardware virtualization                                 : PASS 
 +  QEMU: Checking if device /dev/kvm exists                                   : PASS 
 +  QEMU: Checking if device /dev/kvm is accessible                            : PASS 
 +  QEMU: Checking if device /dev/vhost-net exists                             : PASS 
 +  QEMU: Checking if device /dev/net/tun exists                               : PASS 
 +  QEMU: Checking for cgroup 'memory' controller support                      : PASS 
 +  QEMU: Checking for cgroup 'memory' controller mount-point                  : PASS 
 +  QEMU: Checking for cgroup 'cpu' controller support                         : PASS 
 +  QEMU: Checking for cgroup 'cpu' controller mount-point                     : PASS 
 +  QEMU: Checking for cgroup 'cpuacct' controller support                     : PASS 
 +  QEMU: Checking for cgroup 'cpuacct' controller mount-point                 : PASS 
 +  QEMU: Checking for cgroup 'cpuset' controller support                      : PASS 
 +  QEMU: Checking for cgroup 'cpuset' controller mount-point                  : PASS 
 +  QEMU: Checking for cgroup 'devices' controller support                     : PASS 
 +  QEMU: Checking for cgroup 'devices' controller mount-point                 : PASS 
 +  QEMU: Checking for cgroup 'blkio' controller support                       : PASS 
 +  QEMU: Checking for cgroup 'blkio' controller mount-point                   : PASS 
 +  QEMU: Checking for device assignment IOMMU support                         : PASS 
 +  QEMU: Checking if IOMMU is enabled by kernel                               : WARN (IOMMU appears to be disabled in kernel. Add intel_iommu=on to kernel cmdline arguments) 
 +</sxh>
  
-<code> +It looks like ''**IOMMU** (input-output memory management unit)'' support is not yet enabled in the CentOS 8 Kernel.
-# vim ifcfg-eno49 +
-</code>+
  
-  * ''TYPE=Ethernet'' +The solution is already suggested by the above command. Therefore, we are adding the same in the Kernel command line options.
-  * ''BOOTPROTO=static'' +
-  * ''DEVICE=eno49'' +
-  * ''ONBOOT=yes'' +
-  * ''BRIDGE=br0''+
  
-</WRAP>+<code># grub2-editenv - set "$(grub2-editenv - list | grep kernelopts) intel_iommu=on"</code>
  
-<WRAP center round box 100%> +<wrap em>To take effect, restart your machine!</wrap>
-**Edit** the **Bridge file (ifcfg-br0)** and set the followings:+
  
-<code> +After reboot, again run the ''virt-host-validate'' command.
-# vim ifcfg-br0 +
-</code>+
  
-  * ''TYPE=Bridge'' +<sxh bash; gutter: false;> 
-  ''BOOTPROTO=static'' +  QEMU: Checking for hardware virtualization                                 : PASS 
-  ''DEVICE=br0'' +  QEMU: Checking if device /dev/kvm exists                                   : PASS 
-  ''ONBOOT=yes'' +  QEMU: Checking if device /dev/kvm is accessible                            : PASS 
-  * ''IPADDR=192.168.1.21'' +  QEMU: Checking if device /dev/vhost-net exists                             : PASS 
-  * ''NETMASK=255.255.255.0'' +  QEMU: Checking if device /dev/net/tun exists                               : PASS 
-  * ''GATEWAY=192.168.1.1'' +  QEMU: Checking for cgroup 'memorycontroller support                      : PASS 
-  * ''DNS1=192.168.1.1''+  QEMU: Checking for cgroup 'memorycontroller mount-point                  : PASS 
 +  QEMU: Checking for cgroup 'cpucontroller support                         : PASS 
 +  QEMU: Checking for cgroup 'cpucontroller mount-point                     : PASS 
 +  QEMU: Checking for cgroup 'cpuacctcontroller support                     : PASS 
 +  QEMU: Checking for cgroup 'cpuacctcontroller mount-point                 : PASS 
 +  QEMU: Checking for cgroup 'cpusetcontroller support                      : PASS 
 +  QEMU: Checking for cgroup 'cpusetcontroller mount-point                  : PASS 
 +  QEMU: Checking for cgroup 'devicescontroller support                     : PASS 
 +  QEMU: Checking for cgroup 'devicescontroller mount-point                 : PASS 
 +  QEMU: Checking for cgroup 'blkiocontroller support                       : PASS 
 +  QEMU: Checking for cgroup 'blkiocontroller mount-point                   : PASS 
 +  QEMU: Checking for device assignment IOMMU support                         : PASS 
 +  QEMU: Checking if IOMMU is enabled by kernel                               : PASS 
 +</sxh>
  
-<wrap em>Replace the IP address and DNS server details as per your setup.</wrap>+''Everything is fine now.''
 </WRAP> </WRAP>
  
-Restart the network Service to enable the bridge interface.+KVM and QEMU hypervisors has been installed on CentOS 8.
  
-<code> 
-# systemctl restart network 
-</code> 
  
-Check the Bridge interface configuration, with the command below:+===== Installing Cockpit Web Interface in CentOS 8 =====
  
-<code> +Although, KVM commandline-tools are quite sufficient for managing a Virtualization environment. But, we can also use the CentOS 8 native Web UI i.e. Cockpit to manage virtual machines via a graphical interface.
-# ip addr show br0 +
-</code>+
  
 +We are installing Cockpit using dnf command. To add support of managing virtual machines, we have to install cockpit-machines package as well.
  
-===== Start Creating Virtual Machines. ===== 
-Create Virtual Machine either from the command line using '**virt-install**' command or from GUI (**virt-manager**) 
  
 <WRAP center box 100%> <WRAP center box 100%>
-''**Now let’s Create a virtual machine** of **Windows Server 2012 R2** using virt-manager.'' +<code
- +# dnf install -y cockpit cockpit-machines 
-  - Start the “virt-manager” +</code>
-  - Go to the File Option, click on ''New Virtual Machine'' <WRAP clear/{{:redhat:virtualization-redhat:virt-manger-2.jpg?nolink|}} +
-  We will be using ISO file as installation media. In the next step Specify the path of ISO file.{{:redhat:virtualization-redhat:virt-manger-3.jpg?nolink|}} +
-  - Click on Forward. And specify the Compute Resources : RAM and CPU as per your setup. {{:redhat:virtualization-redhat:virt-manger-4.jpg?nolink|}} +
-  - Click on Forward to proceed further. Then specify the storage Size of Virtual Machine, In my case I am using 25G.{{:redhat:virtualization-redhat:virt-manger-5.jpg?nolink|}} +
-  - In the Next step Specify the Name of Virtual Machine and select network as **Bridge br0**{{:redhat:virtualization-redhat:virt-manger-6.jpg?nolink|}} +
-  - Click on Finish to start the installation. {{:redhat:virtualization-redhat:virt-manger-7.png?nolink|}} +
- +
-''<wrap em>Follow the screen instructions and complete the installation.</wrap>''+
  
 +<sxh bash; gutter: false;>
 +...
 +================================================================================
 +Installing:
 + cockpit                      x86_64 185.1-1.el8_0              BaseOS     68 k
 + cockpit-machines             noarch 184.1-1.el8                AppStream 669 k
 +Installing dependencies:
 + PackageKit                   x86_64 1.1.12-2.el8               AppStream 600 k
 + PackageKit-glib              x86_64 1.1.12-2.el8               AppStream 141 k
 + cairo-gobject                x86_64 1.15.12-3.el8              AppStream  33 k
 + python3-cairo                x86_64 1.16.3-6.el8               AppStream  90 k
 + python3-gobject              x86_64 3.28.3-1.el8               AppStream  25 k
 + python3-systemd              x86_64 234-8.el8                  AppStream  81 k
 + setroubleshoot-plugins       noarch 3.3.10-1.el8               AppStream 365 k
 + checkpolicy                  x86_64 2.8-2.el8                  BaseOS    338 k
 + cockpit-bridge               x86_64 185.1-1.el8_0              BaseOS    596 k
 + cockpit-system               noarch 185.1-1.el8_0              BaseOS    1.6 M
 + cockpit-ws                   x86_64 185.1-1.el8_0              BaseOS    834 k
 + gdk-pixbuf2                  x86_64 2.36.12-2.el8              BaseOS    466 k
 + glib-networking              x86_64 2.56.1-1.1.el8             BaseOS    155 k
 + gsettings-desktop-schemas    x86_64 3.28.1-1.el8               BaseOS    619 k
 +...
 +</sxh>
 </WRAP> </WRAP>
  
- +<WRAP center box 100%> 
-===== Creating a virtual Machine from Command Line: ===== +Enable and start Cockpit Unit.
- +
-Virtual Machines can be created from the console as well using the ''virt-install'' commandIn the following example i'm going to install an virtual machine with Ubuntu 16.04 LTS. +
 <code> <code>
-virt-install --name=Ubuntu-16-04 --file=/var/lib/libvirt/images/ubuntu16-04.dsk --file-size=20 --nonsparse --graphics spice --vcpus=2 --ram=2048 --cdrom=ubuntu-16.04-server-amd64.iso --network bridge=br0 --os-type=linux --os-variant=generic+systemctl enable --now cockpit.socket
 </code> </code>
  
-The above **virt-install** command consitst of following options :+<sxh bash; gutterfalse;> 
 +Created symlink /etc/systemd/system/sockets.target.wants/cockpit.socket at /usr/lib/systemd/system/cockpit.socket 
 +</sxh>
  
-  * ''**–name** = <Name of the Virtual Machine>'' +''Cockpit service is by-default allowed in CentOS 8 firewall.''
-  * ''**–file** = <Location where our virtual machine disk file will be stored >'' +
-  * ''**–file-size** = < Size of the Virtual Machine, in my case it is 20GB >'' +
-  * ''**–nonsparse** = < Allocate the whole storage while creating>'' +
-  * ''**–graphics** = < Specify the graphical tool for interactive installation, in above example I am using spice >'' +
-  * ''**–vcpu** = < Number of virtual CPU for the Machine >'' +
-  * ''**–ram** = < RAM size for the virtual Machine >'' +
-  * ''**–cdrom** = < Virtual CD ROM which specify the installation media like ISO file >'' +
-  * ''**–network** = < it is used to specify which network we will use for the virtual machine, in this example I am bridge interface>'' +
-  * ''**–os-type** = < Operating system type like linux and window>'' +
-  * ''**–os-variant**= <KVM maintains the OS variants like ‘fedora18′, ‘rhel6’ and ‘winxp’ , this option is optional and if you not sure about OS variant you can mentioned it as generic>'' +
- +
- +
-Open now the Virt Viewer //(on Windows)// and follow the instruction to complete the installation. +
- +
-{{:redhat:virtualization-redhat:ubuntu-16-04-virt-install.jpg?nolink|}} +
- +
-Follow the instruction now and complete the installation. +
- +
-Once the Installation is completed we can access the Virtual Machine console from ‘virt-manager‘ as shown below. +
- +
-{{:redhat:virtualization-redhat:ubuntu-16-04-virt-install2.jpg?nolink|}} +
- +
-That’s it, basic installation and configuration of KVM hypervisor is completed. +
- +
- +
-<WRAP center box 100%> +
-===== KVM Manageing (web-Based): ===== +
-Solutions to manage and supervise virtual machines over a WebGUI. +
- +
-<WRAP center round tip 100%> +
-  * ''Cockpit'' +
-  * ''https://www.virtualizor.com/'' +
-  * ''https://github.com/ArchipelProject/Archipel/wiki''+
 </WRAP> </WRAP>
  
 +Browse URL https://YOUR-SERVERS-IP:9090/ in a client's browser.
  
-''Alternativkomplette KVM-Virtualisierungs-Plattformen:'' +The Cockpit uses a self-signed SSL certificatetherefore, you may see a Security warning
-  * https://ovirt.org/ +Ignore the Security warning and continue to the website.
-  * https://www.proxmox.com/de/ +
-</WRAP>+
  
  
  
  
-===== Redhat Dokumentation zum Thema ===== 
- 
-<WRAP center round download 80%> 
-''{{ :redhat:virtualization-redhat:red_hat_enterprise_linux-7-virtualization_deployment_and_administration_guide-en-us.pdf |}}'' 
-</WRAP> 
  
  • redhat/virtualization-redhat/start.txt
  • Last modified: 2020/09/02 12:37
  • by michael