notes/install_qemu.txt
2025-11-17 20:13:36 -08:00

97 lines
2.4 KiB
Text

Installing Qemu on Artix(runit)
doas pacman -S qemu virt-manager virt-viewer dnsmasq vde2 bridge-utils openbsd-netcat libvirt libvirt-runit
doas ln -s /etc/runit/sv/libvirtd /run/runit/service
doas ln -s /etc/runit/sv/virtlogd /run/runit/service
doas ln -s /etc/runit/sv/virtlockd /run/runit/service
<OPTIONAL: CUSTOM LOGGING SECTION>
cd /etc/runit/sv/libvirtd/log
doas nvim run
Edit the log to read:
#!/bin/bash
exec 2>&1; set -e
[ -d /var/log/libvirtd ] || install -dm /var/log/libvirtd
exec svlogd -tt /var/log/libvirtd
Write/Quit out of file.
cd /var/log/
doas mkdir libvirtd
<END OF OPTIONAL LOGGING SECTION>
doas nvim /etc/libvirt/libvirtd.conf Uncomment The Following Lines:
unix_sock_group = "libvirt"
unix_sock_ro_perms = "0777"
unix_sock_rw_perms = "0770"
Write/Quit out of file.
Add current user to libvirt group:
doas usermod -aG libvirt <username>
Reboot.
cd /usr/share/libvirt/networks
doas touch default.xml
Copy the following into default.xml(also available in notes/virsh):
<network>
<name>default</name>
<uuid>9a05da11-e96b-47f3-8253-a3a482e445f5</uuid>
<forward mode='nat'/>
<bridge name='virbr0' stp='on' delay='0'/>
<mac address='52:54:00:0a:cd:21'/>
<ip address='192.168.122.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.122.2' end='192.168.122.254'/>
</dhcp>
</ip>
</network>
If you are already using dnsmasq with mullvad, you may want to start off without internet:
<network>
<name>default</name>
<forward mode='nat'/>
<dns enable='no' />
<ip address='192.168.250.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.250.2' end='192.168.250.254'/>
</dhcp>
</ip>
</network>
doas virsh net-define --file default.xml
doas virsh net-start default
doas virsh net-autostart --network default
doas sv restart libvirtd
doas sv restart libvirtd/log
doas sv restart virtlockd virtlogd
Keep in mind that if you start without internet, you'll have to drop the host firewall to get it to work. There are ways of getting it to work with ufw and iptables, but I have yet to bother diving further into this.
The following forum post on linuxquestions.org might help if you run into further trouble:
https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/virsh-failed-to-start-network-default-4175672429/
Otherwise, check out the official docs:
https://wiki.libvirt.org/Networking.html