Server Based Virtual Machines
2025/07/05
Posted Tag: #Linux
Other Tags: #Windows, #Personal, #All
I have tried and used ESXi, Promox and other server centered distributions for virtual machines but Ubuntu Server LTS just works. Here is how I Install everything to accomplish this on the server and my installation of Arch Linux.
On the Server
Below is the installation of QEMU/KVM on Ubuntu Server LTS.
sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients virtinst cpu-checker libguestfs-tools libosinfo-bin
sudo systemctl status libvirtd.service - Just to make sure things are good
In my last post I presented using Emby in a Docker container and it functions great for me. But if you have a bridge network interface as I do but wish to use QEMU/KVM virtual machines the Docker bridge will interfere with the network bridge making it unusable for virtual machines. I use a bridged network because it allows me to use the virtual machine as a stand alone machine with its own IP address and NFS mounts work great. Here is how to make Docker play nice with my bridged network. I always name my bridge br10
. You should reboot the server after installation.
sudo cat <<EOF >/etc/iptables-br10.conf
*filter
:DOCKER-USER - [0:0]
-F DOCKER-USER
-A DOCKER-USER -i br10 -o br10 -j ACCEPT
COMMIT
EOF
sudo cat <<EOF >/etc/systemd/system/iptables-br10.service
[Unit]
Description=Prevent docker from interfering with br10
Before=network-pre.target
[Service]
Type=oneshot
ExecStart=/sbin/iptables-restore -n /etc/iptables-br10.conf
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable iptables-br10
On Arch Linux
First of all make sue you have visualization enabled in your BIOS. If this fails determine how you enable it in your computer's BIOS and there are multiple setting names different BIOS use so I can't cover that here. My BIOS in Advanced CPU Settings there is SVM Mode. If you highlight it there is a message that says CPU Visualization. Good luck.
LC_ALL=C lscpu | grep Virtualization
The installation of QEMU/LVM and Virtual Machine Manager below will work on most Linux distributions using another update manager other than pacman
. We will use this to create and manage virtual machines on Ubuntu Server LTS.
sudo su
cd /
pacman -S qemu qemu-arch-extra virt-manager virt-viewer dnsmasq dmidecode ovmf edk2-ovmf vde2 openbsd-netcat iptables-nft bridge-utils libguestfs swtpm
systemctl enable --now libvirtd.service
systemctl status libvirtd.service - Just to make sure things a good.
usermod -a -G libvirt $(whoami)
newgrp libvirt
usermod -a -G qemu $(whoami)
systemctl restart libvirtd.service
sed -i "s/#unix_sock_group = \"libvirt\"/unix_sock_group = \"libvirt\"/g" /etc/libvirt/libvirtd.conf
sed -i "s/#unix_sock_ro_perms = \"0777\"/unix_sock_ro_perms = \"0777\"/g" /etc/libvirt/libvirtd.conf
sed -i "s/#unix_sock_rw_perms = \"0770\"/unix_sock_rw_perms = \"0770\"/g" /etc/libvirt/libvirtd.conf
If you want to create a virtual machine within a virtual machine, it is called nesting. If using an Intel processor it would be kvm-intel
.
sudo su
cd /
modprobe -r kvm_amd
modprobe kvm_amd nested=1
cat <<EOF >/etc/modprobe.d/kvm-amd.conf
options kvm-amd nested=1
EOF
systool -m kvm_amd -v | grep nested - To test
I will next go into how to create a virtual machine on the server using both Arch Linux and Windows.