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
redhat:virtualization-redhat:start [2020/04/01 10:59] – [KVM Hypervisor on Red Hat / CentOS 8.x] michaelredhat:virtualization-redhat:start [2020/09/02 12:37] (current) michael
Line 8: Line 8:
  
  
 +  * [[redhat:virtualization-redhat:kvm-suspend-restore-vm-on-reboot|Configure KVM to suspend/restore virtual machines on host reboot]]
   * [[redhat:virtualization-redhat:kvm-installation-centos7|OLD - KVM Installation on CentOS / Red Hat 7.x]]   * [[redhat:virtualization-redhat:kvm-installation-centos7|OLD - KVM Installation on CentOS / Red Hat 7.x]]
  
Line 35: Line 36:
  
  
-===== Installing KVM =====+===== Installing KVM and QEMU =====
  
  
Line 46: Line 47:
 # dnf install -y @virt # dnf install -y @virt
 </code> </code>
 +<sxh bash; gutter: false;>
 +...
 +================================================================================
 +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>
 </WRAP> </WRAP>
  
Line 54: Line 97:
 # dnf install -y virt-install # dnf install -y virt-install
 </code> </code>
 +
 +<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
 +
 +Transaction Summary
 +================================================================================
 +Install  10 Packages
 +...
 +</sxh>
  
 </WRAP> </WRAP>
Line 59: Line 124:
  
 <WRAP center box 100%> <WRAP center box 100%>
-Validate all the components on your KVM host can support virtualization.+''Validate all the components on your KVM host can support virtualization.''
  
 <code> <code>
Line 85: Line 150:
   QEMU: Checking for device assignment IOMMU support                         : 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)   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> </sxh>
  
-</WRAP>+It looks like ''**IOMMU** (input-output memory management unit)'' support is not yet enabled in the CentOS 8 Kernel.
  
 +The solution is already suggested by the above command. Therefore, we are adding the same in the Kernel command line options.
  
 +<code># grub2-editenv - set "$(grub2-editenv - list | grep kernelopts) intel_iommu=on"</code>
  
 +<wrap em>To take effect, restart your machine!</wrap>
  
 +After reboot, again run the ''virt-host-validate'' command.
  
 +<sxh bash; gutter: false;>
 +  QEMU: Checking 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                               : PASS
 +</sxh>
  
 +''Everything is fine now.''
 +</WRAP>
  
 +KVM and QEMU hypervisors has been installed on CentOS 8.
  
  
- +===== Configure KVM Environment =====
-Nach erfolgreicher Installation müssen die Services gestartet & aktiviert werden. +
- +
-<code> +
-# systemctl start libvirtd +
-# systemctl enable libvirtd +
-</code> +
- +
- +
- +
- +
- +
- +
-Nun sollte überprüft werden, ob KVM erfolgreich seine beiden Core-Module laden konnte.+
  
 <WRAP center box 100%> <WRAP center box 100%>
-<code> +==== Allow QEMU/KVM Commands for personal user: ====
-# lsmod | grep kvm +
-</code>+
  
-<sxh bash; gutter: false> +If you want to allow your login user (non-root) to run virsh command or other KVM/QEMU commandsor use these commands without sudo, (needed by cockpit) then add your login user to the libvirt group as follows:
-kvm_intel             162153 +
-kvm                   525409  1 kvm_intel +
-</sxh> +
-</WRAP> +
- +
-Stimmt die Ausgabe mit der oben aufgelisteten Ausgabe in etwa übereinso sollte nun schon alles parat sein zum Virtualisierungen.+
  
-<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+usermod -aG libvirt YOURUSERNAME
 </code> </code>
 </WRAP> </WRAP>
- 
- 
-===== Vorbereitungen zu starten des Virt-Managers ===== 
-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. 
- 
-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]]" 
-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 ==== +==== Setup own VM-Storage / ISO-Storage configuration: ====
-  - ''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>'' +**Create needed directories**:
-</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+mkdir -p /data01/vm-storage 
 +# mkdir /data01/iso-images
 </code> </code>
  
-{{:redhat:virtualization-redhat:virt-manger-1.jpg?nolink|}}+----
  
 +**Make the virsh pool configuration changes**:
  
-===== Configure Bridge Interface ===== +  - Listing current pools: <code># virsh pool-list</code><sxh bash; gutter: false;>
-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.+
  
-<code> +Name                 State      Autostart  
-cd /etc/sysconfig/network-scripts+------------------------------------------- 
-cp ifcfg-eno49 ifcfg-br0 +default              active     yes  
-</code>+</sxh> 
 +  - ''Destroying current default pool:''<code># virsh pool-destroy default</code><sxh bash; gutter: false;>Pool default destroyed</sxh
 +  - ''Undefine current default pool:''<code>virsh pool-undefine default</code><sxh bash; gutter: false;>Pool default has been undefined</sxh> 
 +  - ''Defining a new pool with name "default":''<code># virsh pool-define-as --name default --type dir --target /data01/vm-storage</code><sxh bash; gutter: false;>Pool default defined</sxh> 
 +  - ''Set pool to be started when libvirt daemons starts:''<code>virsh pool-autostart default</code><sxh bash; gutter: false;>Pool default marked as autostarted</sxh> 
 +  ''Start pool:''<code># virsh pool-start default</code><sxh bash; gutter: false;>Pool default started</sxh> 
 +  - ''Checking pool state:''<code># virsh pool-list</code><sxh bash; gutter: false;> 
 +Name                 State      Autostart  
 +------------------------------------------- 
 +default              active     yes   
 +</sxh>
  
-<WRAP center round box 100%> +From now, when creating virtual machines, Virtual Machine Manager will inform you that the *.img file (virtual disk of your VM), will be saved at ''/data01/vm-storage/''
-**Edit** the **Interface file** and set followings:+</WRAP>
  
-<code> +===== Installing Cockpit Web Interface in CentOS 8 =====
-# vim ifcfg-eno49 +
-</code>+
  
-  * ''TYPE=Ethernet'' +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.
-  * ''BOOTPROTO=static'' +
-  * ''DEVICE=eno49'' +
-  * ''ONBOOT=yes'' +
-  * ''BRIDGE=br0''+
  
-</WRAP>+We are installing Cockpit using dnf command. To add support of managing virtual machines, we have to install cockpit-machines package as well.
  
-<WRAP center round box 100%> 
-**Edit** the **Bridge file (ifcfg-br0)** and set the followings: 
  
 +<WRAP center box 100%>
 <code> <code>
-vim ifcfg-br0+dnf install -y cockpit cockpit-machines
 </code> </code>
  
-  * ''TYPE=Bridge'' +<sxh bash; gutter: false;> 
-  * ''BOOTPROTO=static'' +... 
-  * ''DEVICE=br0'' +===============================================================================
-  * ''ONBOOT=yes'' +Installing: 
-  * ''IPADDR=192.168.1.21'' + cockpit                      x86_64 185.1-1.el8_0              BaseOS     68 k 
-  * ''NETMASK=255.255.255.0'' + cockpit-machines             noarch 184.1-1.el8                AppStream 669 k 
-  * ''GATEWAY=192.168.1.1'' +Installing dependencies: 
-  * ''DNS1=192.168.1.1'' + PackageKit                   x86_64 1.1.12-2.el8               AppStream 600 k 
- + PackageKit-glib              x86_64 1.1.12-2.el8               AppStream 141 k 
-<wrap em>Replace the IP address and DNS server details as per your setup.</wrap>+ 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>
- 
-Restart the network Service to enable the bridge interface. 
- 
-<code> 
-# systemctl restart network 
-</code> 
- 
-Check the Bridge interface configuration, with the command below: 
- 
-<code> 
-# ip addr show br0 
-</code> 
- 
- 
-===== 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.'' +Enable and start Cockpit Unit.
- +
-  - Start the “virt-manager” +
-  - 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>'' +
- +
-</WRAP> +
- +
- +
-===== Creating a virtual Machine from Command Line: ===== +
- +
-Virtual Machines can be created from the console as well using the ''virt-install'' command. In 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.1585731566.txt.gz
  • Last modified: 2020/04/01 10:59
  • by michael