How to create optimized virtual machines with Quickemu on Linux

Quickemu is a free and open source project which allows us to quickly launch Linux, macOS, and Windows optimized virtual machines. The project is hosted on GitHub, and is basically a wrapper around QEMU and some other tools.

In this tutorial we learn how to install Quickemu, and how to use it to create optimized virtual machines on the most used Linux distributions.

In this tutorial you will learn:

  • How to install Quickemu on the most used Linux distributions
  • How to use Quickemu to create optimized virtual machines
  • How to create and manage virtual machines snapshots
How to quickly create optimized virtual machines with Quickemu on Linux
How to quickly create optimized virtual machines with Quickemu on Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Distribution agnostic
Software Quickemu
Other Root privileges to install software dependencies
Conventions # – requires given linux-commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux-commands to be executed as a regular non-privileged user

Installation

Quickemu is basically a wrapper around Qemu and a series of other tools: its main goal is to quickly run optimized virtual machines without requiring elevated privileges. It supports several Linux distributions, but also closed source operating systems such as Windows (versions 8, 10 and 11) and macOS (High-sierra, Mojave, Catalina, Big Sur, Monterey, and Ventura).



Before we can use Quickemu, we must install its dependencies. How to do it, depends on the distribution we are using. On Fedora, for example, we would run the following command:

$ sudo dnf install qemu bash coreutils edk2-tools grep jq lsb procps python3 genisoimage usbutils util-linux sed spice-gtk-tools swtpm wget xdg-user-dirs xrandr unzip

If we are running Debian or one of its many derivatives, Ubuntu included, instead:

$ sudo apt install qemu bash coreutils ovmf grep jq lsb-base procps python3 genisoimage usbutils util-linux sed spice-client-gtk libtss2-tcti-swtpm0 wget xdg-user-dirs zsync unzip

To obtain Quickemu, we must clone the project repository, which is hosted on GitHub:

$ git clone --filter=blob:none https://github.com/wimpysworld/quickemu

Using the Ubuntu PPA

Talking about Ubuntu, if we are using the distribution made in Canonical, we also have the convenient option to install the software from the project official PPA (Personal Package Archive). To add the PPA to the system software sources, we run:

$ sudo add-apt-repository ppa:flexiondotorg/quickemu

To synchronize the repositories and install the “quickemu” package together with the required dependencies, we execute the following command:

$ sudo apt update && sudo apt install quickemu

The use of Quickemu revolves around two scripts: quickemu and quickget. If we installed the tool from the Ubuntu PPA, we will be able to invoke the scripts just like any other executable. If we obtained Quickemu directly from GitHub, instead, we need to specify their position, or manually copy them under one of the directories in our PATH. In the rest of this tutorial, I will assume this has already been accomplished.

Creating and running a virtual machine

Creating and running a virtual machine with Quickemu is a very simple tasks. We don’t even have to worry about downloading installation images, since the quickget script will take care of this for us. Let’s see an example. Suppose we want to create a virtual Fedora system. All we have to do is to launch the following command:

$ quickget fedora



Since we didn’t specify what version of Fedora we want to base our virtual machine on, the script shows us the supported ones:

ERROR! You must specify a release.
 - Releases: 38 39
 - Editions: Workstation Budgie Cinnamon i3 KDE LXDE LXQt Mate Xfce Silverblue Sericea Kinoite Sway Server Onyx

Now, to base our virtual machine on the Mate spin of Fedora 39, we would run:

$ quickget fedora 39 Mate

The script automatically downloads the appropriate ISO, verify its checksum, and create a configuration file for the virtual machine. The file is created in the current working directory, named after the distribution release and version (“fedora-39-mate.conf”, in this case). It contains information about the ISO and the VM disk:

#! --vm
guest_os="linux"
disk_img="fedora-39-Mate/disk.qcow2"
iso="fedora-39-Mate/Fedora-MATE_Compiz-Live-x86_64-39-1.5.iso"

To start the virtual machine, we launch the quickemu script and pass the configuration file as argument to the --vm option:

$ quickemu --vm fedora-39-Mate.conf

After a few seconds, we should see the QEMU window with the virtualized system:The GRUB menu of the virtualized Fedora system installer

The GRUB menu of the virtualized Fedora system installer

Creating and managing snapshots

By using the quickemu script, we can easily create, delete and apply virtual machine snapshots. To take a snapshot of an inactive virtual machine, all we have to do is to use the --snapshot option together with the “create” subcommand, and pass a tag as argument. In the example below we create a snapshot called “snapshot0”:

$ quickemu --vm fedora-39-Mate.conf --snapshot create "snapshot0"

To restore the snapshot, we use the “apply” subcommand:

$ quickemu --vm fedora-39-Mate.conf --snapshot apply "snapshot0"



To delete a snapshot, instead, we use the “delete” subcommand. We run:

$ quickemu --vm fedora-39-Mate.conf --snapshot delete "snapshot0"

Finally, to retrieve the list of the available snapshots, we use the “info” subcommand:

$ quickemu --vm fedora-39-Mate.conf --snapshot info

Removing a virtual machine

Once we are done working with a virtual machine, to delete its configuration and all related files and directories, we can use the --delete-vm option:

$ ./quickemu --delete-vm --vm fedora-39-Mate.conf

Closing thoughts

In this tutorial, we took a look at Quickemu, a very handy free and open source wrapper around QEMU which let us quickly launch and manage optimized virtual machines on Linux. Here we just took a look at the basic functionalities of the tool; it is possible to tweak virtual machines by specifying the sound card model, the display viewer, the keyboard type, and other parameters. Just take a look at the help page to retrieve the complete list of the available options.



Comments and Discussions
Linux Forum