Install QEMU on Ubuntu 22.04

The QEMU official website has provided tutorial on how to install it. According to the website, we just need to execute sudo apt-get install qemu on Ubuntu to install QEMU. However, I got an error and failed to fix it. So I decided to install QEMU from the source code. This blog will take QEMU 7.2.0 version as an example to introduce the installation process.

  1. Download the source code and unzip it

    1
    2
    3
    $ wget https://download.qemu.org/qemu-7.2.0.tar.xz
    $ tar xvJf qemu-7.2.0.tar.xz
    $ cd qemu-7.2.0
  2. Preprocessing before compilation

    1
    $ ./configure
  3. Handle error

    After executing the command above, an error like this may be reported:

    The reason for the error is that the system lacks the dependencies required by QEMU. Run the following command to install dependencies:

    1
    2
    3
    4
    $ sudo apt-get install ninja-build
    $ sudo apt-get install zlib1g zlib1g-dev
    $ sudo apt-get install libglib2.0-dev
    $ sudo apt-get install libpixman-1-dev

    run the command again:

    1
    $ ./configure
  4. Use make to compile the source code

    1
    $ make

    After typing the command above, the compilation process begins and will last for some time. Please wait patiently.

  5. Install

    1
    $ sudo make install
  6. Verify that the installation is successful

    1
    $ qemu-

    Enter qemu- and press TAB twice. If the output similar to the following appears, the installation is successful.


Install QEMU on Ubuntu 22.04
https://arcsin2.cloud/en/2023/03/03/Install QEMU on Ubuntu 22.04/
Author
arcsin2
Posted on
March 3, 2023
Licensed under