[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
howtos:emulators:libvirt_qemu_manage_install [2022/02/17 04:14 (UTC)] – [Appendage] zeebrahowtos:emulators:libvirt_qemu_manage_install [2023/12/19 08:57 (UTC)] (current) – [Packages, dependencies, order] zeebra
Line 11: Line 11:
 ===== Requirements ===== ===== Requirements =====
  
-Be sure to use Slackware 15.0 and **Kernel-generic** to accurately be able to reproduce this build and as a reference point. It should work on others, but use kernel-generic to be sure. +Be sure to use **Slackware 15.0** (full install) and **Kernel-generic** to accurately be able to reproduce this build and as a reference point. It should work on others, but use kernel-generic to be sure. 
-Your processor must be capable of virtualization. You can check that with:+Your processor should be capable of virtualization, otherwise you can only use QEMU as a type 2 hypervisor (which is probably not what you want). You can check virtualization capability with:
 <code>lscpu | grep -i virtualization</code> <code>lscpu | grep -i virtualization</code>
 It should give an answer like: It should give an answer like:
Line 20: Line 20:
 ===== Preliminaries ===== ===== Preliminaries =====
  
-Before installation it is possible to dry run ./configure for qemu and meson-build for libvirt and you will find this info: (not complete)\\+If you try to just build QEMU or Libvirt on Slackware 15, you will find out this information: (not complete) \\
 qemu says: qemu says:
   * Run-time dependency libnfs found: NO / libnfs support: NO\\   * Run-time dependency libnfs found: NO / libnfs support: NO\\
Line 28: Line 28:
   * vde support: NO\\   * vde support: NO\\
   * usb net redir: NO\\   * usb net redir: NO\\
 +  * slirp support: NO (since QEMU 7.2)\\
 +
  
 libvirt says: libvirt says:
Line 33: Line 35:
   * Run-time dependency yajl found: NO (yajl: NO)\\   * Run-time dependency yajl found: NO (yajl: NO)\\
  
-<note warning>**Please familiarize yourself with this article and this method so we avoid making a mess:**\\ +Note. You can test this by going to the QEMU and libvirt directories and running ./configure and meson configure.
-**https://docs.slackware.com/howtos:slackware_admin:building_a_package**</note>+
  
-===== Methodology (read this carefully) =====+===== Before getting started =====
  
-  - You CAN use "make install" or equivalent if you want (maybe "DESTDIR=/opt install" if you want to install directly in /opt), but for ease and stages, use the above method instead. ([[howtos:slackware_admin:building_a_package]]) +<note warning>**Please familiarize yourself with this article and this method to avoid making a mess:**\\ 
-  - This guide is using /opt/root/build for user (with user read/write access) - you could/should use /home/user/build  (simply replace all "/opt/root" in the steps of this guide with "/home/user" <-- where "user" is your username) +**https://docs.slackware.com/howtos:slackware_admin:building_a_package**</note>
-  - This guide is using /opt/fakeroot for root and DESTDIR for packaging - you could use that or another root only writable directory (root root 755)If you're unsure, use /opt/fakeroot so you can follow step-by-step. +
-  - Whenever it says "(as ROOT)" you must continue in the same folder you were in (su) +
-  - Whenever it says "(as USER)" or "(as ROOT)", it is a note, there are also some other notes in (paranthesis) inside code brackets +
-  - As this guide moves on, it will repeat less and less assumed details (see stage1 for most details) +
-<note tip>It is possible to do the whole process (except installpkg, ps. not tested..) as user and install into a user "fakeroot", but you MUST ensure correct owner, group, permissions after. Do so at your own risk if you know what you're doing. If you can you probably should. But for ease and safety this guide does not.</note> +
-<note>It is not appropriate to package in stages, but much easier for this guide and for installing the packages later, including in another Slackware 15 installation. It's fine for personal use.</note>+
  
 ===A few things to consider before proceeding:=== ===A few things to consider before proceeding:===
   * Audit support (general) - if you habitually use this and/or might need it, better to do it now before kvm/qemu/libvirt   * Audit support (general) - if you habitually use this and/or might need it, better to do it now before kvm/qemu/libvirt
   * Gstreamer codecs (spice) - libav and gst-plugins-ugly support, better to deal with general codec stuff before qemu/spice etc, in particular those 2   * Gstreamer codecs (spice) - libav and gst-plugins-ugly support, better to deal with general codec stuff before qemu/spice etc, in particular those 2
-     * https://gstreamer.freedesktop.org/src/gst-plugins-ugly/gst-plugins-ugly-1.18.5.tar.xz +     * https://gstreamer.freedesktop.org/src/gst-plugins-ugly 
-     * https://gstreamer.freedesktop.org/src/gst-libav/gst-libav-1.18.5.tar.xz+     * https://gstreamer.freedesktop.org/src/gst-libav/
   * Compiling Qemu with only the machines you need (unless you need alot of exotic CPU emulation and/or cross-compilation)   * Compiling Qemu with only the machines you need (unless you need alot of exotic CPU emulation and/or cross-compilation)
 +
 +===== Methodology (read this carefully) =====
 +
 +  - The norm for Slackware is to build packages as root on a disposable machine installation (for example a virtual machine, or a build computer)
 +  - This guide uses /opt/root/build directory and /opt/fakeroot as build destination (make DESTDIR=)
 +  - Double check this article to know what you are doing: [[howtos:slackware_admin:building_a_package | Building a Slackware package]]
 +  - This guide assumes you use the same methods
 +  - This guide uses user for make and root for make install
 +  - Whenever it says "(as ROOT)" you must continue in the same folder you were in (su)
 +  - Whenever it says "(as USER)" or "(as ROOT)", it is a note, there are also some other notes in (paranthesis) inside code brackets
 +
 +<note tip>It is possible to do the whole process (except installpkg, ps. not tested..) as user and install into a user "fakeroot", but you MUST ensure correct owner, group, permissions after with chown/chgrp -R /dir/fakeroot after. Do so at your own risk if you know what you're doing. If you are on a non-disposable environment you probably should. But for ease and safety this guide does not.</note>
 +
 +<note>Since there are quite alot of packages here, I can't be bothered to package them 1 and 1, so I rather package them together in "stages", based on dependencies. It's much easier to do and deploy, but you can package them individually. </note>
 +
 \\ \\
 +
 +===== Packages, dependencies, order =====
 +
 +<note important>The below are just links to the project download pages and an overview of the build order. These versions have not been tested, but are all the dependencies of QEMU with libvirt and virt-manager. You just have to build them roughly in this order and you're good to go. </note>
 +
 +^ Stage 1                 ^ Stage 2       ^ Stage 3          ^ Stage 4  ^ Stage 5 ^ Stage 6 ^
 +| [[https://gitlab.com/libosinfo/libosinfo/-/tags | libosinfo]] | [[https://github.com/dgibson/dtc/tags | dtc ]] | [[https://download.libvirt.org/ | libvirt ]] | [[https://gitlab.com/libvirt/libvirt-glib/-/tags | libvirt-glib]] | [[https://www.qemu.org/download/ | QEMU ]] | [[https://virt-manager.org/download.html | virt-manager]] |
 +| [[https://gitlab.com/libosinfo/osinfo-db-tools/-/tags |osinfo-db-tools]] | [[https://github.com/sahlberg/libnfs/tags | libnfs]] | | [[https://github.com/libvirt/libvirt-python/tags | libvirt-python ]] |
 +| [[https://gitlab.com/spice/spice-protocol/-/tags | spice-protocol]] | [[https://gitlab.com/libosinfo/osinfo-db/-/tags | osinfo-db ]] | | [[https://download.gnome.org/sources/gtk-vnc/ | gtk-vnc ]] |
 +|  | [[https://github.com/numactl/numactl/releases | numactl ]] | | [[https://www.spice-space.org/download/gtk/ | spice-gtk ]] |
 +|  | [[https://www.spice-space.org/download/releases/spice-server/ | spice-server]] | | [[https://gitlab.freedesktop.org/slirp/libslirp | libslirp]] |
 +|  | [[https://gitlab.com/spice/usbredir/-/tags | usbredir]] | |
 +|  | [[https://github.com/virtualsquare/vde-2/releases | vde-2 ]] | |
 +|  | [[https://gitlab.freedesktop.org/virgl/virglrenderer/-/releases | virglrenderer ]] | |
 +|  | [[https://github.com/lloyd/yajl/tags | yajl ]] | |
  
 ===== Building, packaging, installing ===== ===== Building, packaging, installing =====
Line 84: Line 109:
  
 == Process 1 ==  == Process 1 == 
-Note. "meson configure" is optional\\ +**libosinfo-v1.11.0**
-**libosinfo-v1.9.0**+
 <code> <code>
 (as USER) (as USER)
-cd libosinfo-v1.9.0 +cd libosinfo-v1.11.0 
-meson configure+meson configure --prefix=/usr/local
 meson build meson build
 ninja -C build ninja -C build
Line 258: Line 282:
 You should NOT get an error like this: (Error when getting information for file “/usr/local/etc/osinfo”: No such file or directory), if you do, something went wrong with osinfo database loading, and you can load it manually (see doinst.sh) or fix your package. You should NOT get an error like this: (Error when getting information for file “/usr/local/etc/osinfo”: No such file or directory), if you do, something went wrong with osinfo database loading, and you can load it manually (see doinst.sh) or fix your package.
  
 +<note>the below simply means you extract qemu package to some directory, and run ./configure in the directory to check the output</note>
 after installing this package, we can go to qemu testdir and test with ./configure, we expect this:\\ after installing this package, we can go to qemu testdir and test with ./configure, we expect this:\\
 libnfs support: Yes\\ libnfs support: Yes\\
Line 398: Line 423:
 python3 setup.py install --root=/opt/root/build/stage6/fakeroot/ python3 setup.py install --root=/opt/root/build/stage6/fakeroot/
 as ROOT as ROOT
 +mkdir /opt/fakeroot/usr
 cd /opt/root/build/stage6/ cd /opt/root/build/stage6/
 chown -R root fakeroot/ chown -R root fakeroot/
Line 424: Line 450:
 ==== Appendage ==== ==== Appendage ====
  
-Other packages to consider:+**Other packages to consider:**
   *acpica (acpi tables for qemu)   *acpica (acpi tables for qemu)
   *ovmf (firmware UEFI stuff for qemu)   *ovmf (firmware UEFI stuff for qemu)
   *snappy (particular compression algo for qemu)   *snappy (particular compression algo for qemu)
   *gst-plugin-ugly (codec for spice)   *gst-plugin-ugly (codec for spice)
-  *gst-libav (gstreamer codec for spice)+  *gst-libav (gstreamer codec for spice)\\
  
-If you want to test this on Slackware try these things:\\ +<note>These things have been tested on the build Slackware 15.0, and the resulting packages have also been tested on a clean Slackware 15.0 installationMost functions have been tested, but not connecting to VM over network instead of local (vnc), and not import of images from other VM environments (I don't havelike virtualboxvmware etcEverything tested was found to work as expected. If you follow the instructionsit includes solutions to debugged thingseverything should work as expected.</note
-link here in the future..\\ +  
-For now a summary of some steps that can be done to get kvm/qemu/libvirt/virt-manager up and running: (both qemu system and session)\\ +**If you want configure and set up libvirt/qemu/kvm and virt-manager on Slackware 15.0 use the info in this link:**\\ 
- +https://docs.slackware.com/howtos:emulators:libvirt_config_methods
-<code> +
-groupadd --system libvirt +
-groupadd --system kvm +
-usermod -aG libvirt,kvm username +
-</code> +
-Noteyou need to log out of X and tty and back in for group to take effect (you can do that later too)\\ +
- +
-The below step is for qemu:sessionand temporary, if you want to make it permanentadd udev rule +
-<code+
-chgrp kvm /dev/kvm +
-chmod g+rw /dev/kvm +
-</code> +
- +
-go to the libvirt config file and uncomment the relevant options and set them correctly. +
-<code> +
-nano /usr/local/etc/libvirt/libvirtd.conf +
-unix_sock_group = "libvirt" +
-unix_sock_ro_perms = "0770" +
-unix_sock_rw_perms = "0770" +
-unix_sock_admin_perms = "0770" +
-auth_unix_ro = "polkit" +
-auth_unix_rw = "polkit" +
-ctrl+x (save) +
-libvirtd -d +
-virtlogd -d +
-</code>+
  
-This is just an example you can use on a computer where you are the only user. 
  
 === Cleaning === === Cleaning ===
 howtos:emulators:libvirt_qemu_manage_install ()