DEV Community

Miguel
Miguel

Posted on

Setting up Qemu in Debian Linux

Guide to Setting up QEMU in Debian Linux

Setup Qemu in Debian Linux

To check if virtualization is enabled on your Debian Linux system, you can use the following command:

egrep -c '(vmx|svm)' /proc/cpuinfo
Enter fullscreen mode Exit fullscreen mode

If the output is greater than 0, it means that virtualization is enabled on your system. This command checks for the presence of the Intel VT-x or AMD-V extensions, which are required for running virtual machines with QEMU.

Install QEMU and Virtual Machine Manager

sudo apt install qemu-kvm qemu-system qemu-utils python3 python3-pip libvirt-clients libvirt-daemon-system bridge-utils virtinst libvirt-daemon virt-manager -y
Enter fullscreen mode Exit fullscreen mode

Verify that Libvirtd service is started

sudo systemctl status libvirtd.service
Enter fullscreen mode Exit fullscreen mode

systemctl status libvirtd.service

Start Default Network for Networking

Using virsh, the command-line interface tool for managing virtual machines, you can also interact with networks. Here's how you can start the default network and make it auto-start after a system reboot:

Start the Default Network:

   sudo virsh net-start default
Enter fullscreen mode Exit fullscreen mode

Enable auto-start:
To make the default network auto-start after a system reboot, use the net-autostart command followed by the network name:

   sudo virsh net-autostart default
Enter fullscreen mode Exit fullscreen mode

These commands will start the default network and configure it to start automatically when the host system boots up.

Check status with:

sudo virsh net-list --all
Enter fullscreen mode Exit fullscreen mode
 Name      State      Autostart   Persistent
----------------------------------------------
 default   active       yes          yes
Enter fullscreen mode Exit fullscreen mode

Add the user to the libvirt group, which allows the user to access and manage virtual machines using libvirt:

sudo usermod -aG libvirt $USER
sudo usermod -aG libvirt-qemu $USER
sudo usermod -aG kvm $USER
sudo usermod -aG input $USER
sudo usermod -aG disk $USER
Enter fullscreen mode Exit fullscreen mode

Reboot to complete the process.

Image description

Top comments (0)