User Tools

Differences

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

Link to this comparison view

Next revision
Previous revision
gentoo:kvm-qemu [2026/03/24 07:00] – created willygentoo:kvm-qemu [2026/03/24 10:43] (current) – [Kernel and required packages] willy
Line 5: Line 5:
 ===== Reference links ===== ===== Reference links =====
  
-The [[https://wiki.gentoo.org/wiki/QEMU|Gentoo WIKI]] page on QEMU has lots of good information, as well as [[https://www.linux-kvm.org/page/KvmOnGentoo|this]] page.+The [[https://wiki.gentoo.org/wiki/QEMU|Gentoo Wiki]] page on QEMU has lots of good information, as well as [[https://www.linux-kvm.org/page/KvmOnGentoo|this]] page.
  
-===== Required packages =====+===== Kernel and required packages =====
  
-Install the following:+I am asusming you use **genkernel** with //gentoo-sources// or **gentoo-kernel-bin** with the //dist// flags to have a standard kernel, that ships with all the required options enables. If this is not the case, follow the instructions on the Gentoo Wiki page linked above and compile a compliant kernel. 
 + 
 +You also need to have all the virtualization options enabled on your BIOS/UEFI firmware. 
 + 
 +Now, as for packages, you will want the VirtManager GUI and the QEMU package, so install the following:
 <code bash> <code bash>
-emerge app-emulation/libvirt app-emulation/virt-manager qemu -vp+emerge net-misc/bridge-utils app-emulation/libvirt app-emulation/virt-manager qemu -vp
 </code> </code>
  
-===== Level 2 Headline =====+And make sure your libvirtd has proper access configuration for the sockets: 
 +**/etc/libvirt/libvirtd.conf**: 
 +<code> 
 +unix_sock_group "libvirt" 
 +unix_sock_rw_perms "0770" 
 +</code> 
 + 
 +===== Networking configuration ===== 
 + 
 +If you want to use **bridged** networking, which means assign local LAN IP to your virtual machines, you need to convert your LAN interfaces to bridged. 
 + 
 +This means, given the following example (in /etc/conf.d/net): 
 +<code> 
 +config_eno1="10.0.0.50/24" 
 +route_eno1="default via 10.0.0.1" 
 +</code> 
 + 
 +To this: 
 +<code> 
 +bridge_br0="eno1" 
 +config_br0="10.0.0.50/24" 
 +route_br0="default via 10.0.0.1" 
 + 
 +config_eno1="null" 
 +</code> 
 + 
 +And add the required init links: 
 +<code bash> 
 +cd /etc/init.d 
 +ln -s net.lo net.br0 
 +rc-update add net.br0 default 
 +rc-update del net.eno1 default 
 +./net.eno1 stop 
 +./net.br0 start 
 +</code> 
 + 
 + 
 +===== Users configuration ===== 
 + 
 +add your users to groups **kvm**, **qemu** and **libvirt**. 
 + 
 +<code bash> 
 +gpasswd -a user libvirt 
 +gpasswd -a user kvm 
 +gpasswd -a user qemu 
 +rc-update add libvirt-guests 
 +rc-update add libvirtd 
 +/etc/init.d/libvirtd start 
 +/etc/init.d/libvirt-guests start 
 +</code>