QEMU/Installing QEMU

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

Installing QEMU[edit]

From a repository[edit]

Most GNU/Linux distributions have package repositories that carry precompiled binaries of QEMU. This is a much simpler installation process when compared to compiling it from source. It's often best to use these repositories when installing QEMU, as you can be confident that it will install and run without problems. This table outlines the minimum commands to perform in order to install QEMU from your repository.

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 in the event that you can't install QEMU from a package repository, you can go to the QEMU website to download the latest source code and follow the instructions given.

On Windows[edit]

If you're hesitant to work with the command-line, there's a GUI front-end called QEMU Manager. However, this program has been abandoned. Its last release (7.0) was in 2010, the creator's website has disappeared, and it doesn't appear to have its source available; this means that (should you use it) you would stick with the very old 0.11 version of QEMU it provides, causing conflicts with newer builds severely. And if you need an x86 virtualization tool that isn't out of date, has a graphical interface, and works as good as QEMU, then VirtualBox is recommended.

If you're comfortable with the command-line, there are two builders providing downloads of QEMU for use with the command line. One compiles QEMU with Cygwin, and they warn that you need to download MinGW packages as a result. The other is as recent as possible with his builds and doesn't require Cygwin. His builds are linked by the QEMU website.

Building from source[edit]

The most surefire way to get QEMU working is to build it from its source. To do so, make sure you have git (and if you're on Windows, get MinGW), and enter the following commands into a terminal/command-line environment:

  1. git clone git://git.qemu-project.org/qemu.git[3]
  2. cd qemu
  3. git submodule init
  4. git submodule update --recursive[4]
  5. git submodule status --recursive
  6. git checkout stable-2.9[5]
  7. mkdir build
  8. cd build
  9. ../configure[6]
  10. make

After QEMU is installed, you may find platform-specific instructions in the documentation.

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).
  3. This is the git link provided by QEMU's download page.
  4. To prevent the problem that this solves.
  5. But don't put 2.9 if it's no longer the current stable version. If the current is higher, change it accordingly.
  6. If you want to build QEMU only for a specific target (say, only for x86 which is 32-bit) instead of for all targets, use ../configure --target-list=i386-softmmu instead.