QEMU/Installing QEMU

From Wikibooks, open books for an open world
Jump to: navigation, search

Installing QEMU[edit]

Most GNU/Linux distributions have simple installation processes based on package repositories. It is often best to use the repository approach for installing QEMU, as you can be confident that it will just install and run. Here are some examples:

Distribution Install command
Fedora [1] yum install qemu
Debian [2] apt-get install qemu qemu-kvm libvirt-bin
SUSE yast -i qemu
Gentoo emerge -av app-emulation/qemu
Arch sudo pacman -S qemu
Mac (Homebrew) brew install qemu

If you can't install QEMU from a package repository, go to the QEMU website and download the latest source code and follow the instructions given.

For Microsoft Windows, you can install a GUI front-end to QEMU called QEMU Manager, or get a vanilla QEMU installer.

QEMU from source[edit]

The most surefire way to get QEMU working is to build QEMU from its source. To do so, enter the following commands in a command line environment:

  1. git clone git://git.qemu-project.org/qemu.git (The git link here is provided by the QEMU download page)
  2. cd qemu
  3. git submodule init
  4. git submodule update --recursive (Credit for steps 3,4 and 5)
  5. git submodule status --recursive
  6. git checkout stable-2.6 (As of writing this, the stable branch version is 2.6. Change 2.6 to the number of current stable version when you are applying these steps)
  7. mkdir build
  8. cd build
  9. ../configure (If you want to build QEMU only for a specific target (say, only for 32-bit x86) instead of for all targets, use ../configure --target-list=i386-softmmu instead)
  10. make

NOTE: All these steps should work seamlessly on all platforms, except for the step 9 on Windows. To get step 9 working on Windows, you need MinGW or a similar solution. That is, to get this working on Windows, you need MinGW (or a similar solution).

You may find platform specific instructions on compiling QEMU from source here.

Installing QEMU-KVM[edit]

QEMU by itself isn't very fast, as it does a lot of emulation even when running on the hardware compatible with the guest operating system. To make it perform better, QEMU has a kernel module called KVM that allows much of the guest OS's code to run directly on the host processor when running on x86 or x86-64 processors with virtualisation extensions under GNU/Linux. For example, if the host is x86 GNU/Linux and the guest is Windows XP, then KVM can run most of the Windows XP code directly on the processor without emulation.

QEMU-KVM requires a GNU/Linux or BSD Unix host, and a CPU with virtualisation extensions -- either Intel VT or AMD-V. To determine whether your CPU has this support on GNU/Linux, run the following command from a shell:

egrep '(vmx|svm)' /proc/cpuinfo

If you get nothing back, your CPU does not support the required virtualisation extensions.

Many modern GNU/Linux distros have simple installation processes based on package repositories. It is often best to use the repository approach for installing QEMU-KVM, as you can be confident that QEMU-KVM will just install and run. Here are some common GNU/Linux distros and their QEMU-KVM install commands:

Distribution Install command
Fedora [1] yum install @virtualization or yum install qemu-kvm
Debian [2] apt-get install kvm qemu-kvm libvirt-bin
SUSE yast -i kvm

More details are available on the KVM website. If you can't install QEMU-KVM from a package repository, go to the QEMU-KVM website and download the latest source code and follow the instructions given.

Notes[edit]

  1. a b Also valid for other RPM-based distributions (e.g. RedHat, CentOS).
  2. a b Also valid for other dpkg-based distributions (e.g. Ubuntu, Mepis, Mint).