How to Install and Setup Qemu on Debian 12

The Qemu is the emulator and stands for the “Quick Emulator” which is open-source. Other than the emulator, it is also known as the virtualizer. It is used to run any operating system regardless of its architecture on many platforms including Windows, MacOS, and Linux.

It is easy to run the Qemu as it does not require any host patches for running therefore it is easy and reliable to use, moreover, it has two operating modes, one is the “Full System Modulation” and another is the “User Mode Emulation”. The second mode is only for the Linux distributions. 

This blog will help users understand the installation and setup of Qemu on Debian 12 following the outline:

  1. What are the Key Features of Qemu
  2. How to Install Qemu on Debian12
  3. How to Setup the Stable System on Qemu Using Debian 12
  4. How to Set up a Testing/Unstable System on Qemu
  5. How to Set Up the Networking on Qemu
  6. How to Snapshot using the Qemu 
  7. How to Clone the Virtual Machine on Qemu
  8. How to Uninstall Qemu on Debian 12

Let’s start the blog by exploring some key features of the Qemu. 

What are the Key Features of Qemu?

The key features of the Qemu are:

  • It supports the various platforms of different architectures 
  • It can be run on two different modes
  • It allows the users to run all the processes of the operating system within the virtual environments
  • Users can perform the user-level emulation
  • For troubleshooting, Qemu allows users to take snapshots at any instant
  • It allows different network communication including bridge networks, NAT, and user-mode networking
  • It can be used through the command line interface 

After these key features, users are recommended to install the Qemu on Debian 12 following the method explained in the next section. 

How to Install Qemu on Debian 12?

For the installation of the Qemu on Debian 12, follow the below-mentioned steps. 

Step 1: Open the Terminal

To install the Qemu on Debian 12 by executing some simple commands, open the terminal with the CTRL+ALT+T shortcut key:

Step 2: Update all the Packages

To ensure the installation of the updated version of the Qemu on Debian 12, use the “update” option of the apt command to make the packages up to date:

$ sudo apt update

Step 3: Install Qemu on Debian 12

To install the Qemu on Debian 12, run the below-mentioned command:

$ sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager -y

This means that the Qemu has been successfully installed on Debian 12. 

How to Setup the Stable System on Qemu Using Debian 12?

To set up the stable distributions on Qemu, follow the steps mentioned below.

Step 1: Launch the Qemu Application

Open the Application’s menu and launch the Qemu Application:

Step 2: Create a New Machine

When the machine is launched, click on the mentioned icon in the figure below to create a new machine:

Step 3: Choose the Medium of Installation

Now choose the option following which the operating system is supposed to be installed, for example, if it is supposed to install by using the iso file, then click on the first option:

Step 4: Choose the ISO File

If you are using the iso file, then in this step, browse the location to choose the ISO file:

Step 5: Choose Memory and CPU Settings

After selecting the ISO file, assign the RAM memory and number of CPUs to the new machine:

Step 6: Assign the Storage Memory

After assigning the number of CPUs and RAM memory, now assign the hard disk memory to the machine:

Step 7: Choose a Name

Finally, click on the “Finish” button after assigning a new name to the machine:

As soon as the Finish button is pressed, the Ubuntu operating system will be launched:

Either install Ubuntu or test it by clicking on the “Try Ubuntu” button. 

How to Set up a Testing/Unstable System on Qemu?

To set up a testing or unstable system on Qemu, follow the instructions explained in this section. 

Step 1: Create a Hard Disk Image

By setting the size and format, create a virtual image using the “qemu-img” command:

$ qemu-img create debian.img 2G

Step 2: Download the Operating System

Now download the iso file of the testing or the unstable operating system. For instance, we are downloading the testing iso file of the Debian using the wget command:

$ wget  https://cdimage.debian.org/cdimage/daily-builds/daily/arch-latest/amd64/iso-cd/debian-testing-amd64-netinst.iso

Step 3: Install the Operating System

When the downloading is completed, install the operating system using the downloaded iso file:

$ qemu-system-x86_64 -hda debian.img -cdrom debian-testing-amd64-netinst.iso -boot d -m 512

Step 4: Boot the Operating System

Finally, boot the installed operating system by running the command:

$  qemu-system-x86_64 -hda debian.img -m 512

This is the way to set up the testing or unstable operating system on Debian 12 using the Qemu. 

How to Set Up the Networking on Qemu?

To set up the networking on Qemu, for example, to set the user mode networking, run the command following the below-mentioned general syntax:

$ qemu-system-<architecture> -hda mydisk.qcow2 -net user -net nic

For the bridge networking, follow the general syntax:

$ qemu-system-<architecture> -hda mydisk.qcow2 -net bridge -net nic

How to Snapshot using the Qemu?

One of the key features of the Qemu is that it supports the snapshot. To take the snapshot of the running virtual machine, snapshot by running the command:

$ qemu-img snapshot -c snapshot_name mydisk.qcow2

How to Clone the Virtual Machine on Qemu?

For the creation of the clone of the virtual machine, run the command following the next general syntax:

$ qemu-img create -f qcow2 -b mydisk.qcow2 clone.qcow2

How to Uninstall Qemu on Debian 12?

To uninstall the Qemu on Debian 12, use the apt command’s “purge” option. This option will remove and uninstall the Qemu on Debian 12 with all its configuration files:

$ sudo apt purge qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager -y

The Qemu has successfully been uninstalled from Debian 12.

Conclusion

To install the Qemu on Debian 12, open the terminal and run the command “sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager -y”. When the installation is completed, set up the Qemu either for the stable operating system or the unstable/testing operating system. This post has explained all the possible methods for the installation and setting up of the Qemu on Debian 12 with a step-by-step guide.