2012-01-30 12:00:39 +08:00
|
|
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
|
|
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
|
|
|
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
|
|
|
<!ENTITY % general-entities SYSTEM "../../general.ent">
|
|
|
|
%general-entities;
|
|
|
|
|
|
|
|
<!ENTITY qemu-kvm-download-http " ">
|
2012-02-06 04:01:53 +08:00
|
|
|
<!ENTITY qemu-kvm-download-ftp "&sourceforge-repo2;/projects/kvm/files/qemu-kvm/&qemu-kvm-version;/qemu-kvm-&qemu-kvm-version;.tar.gz">
|
2012-01-30 12:00:39 +08:00
|
|
|
<!ENTITY qemu-kvm-md5sum "00a825db46a70ba8ef9fc95da9cc7c1e">
|
|
|
|
<!ENTITY qemu-kvm-size "5.9 MB">
|
|
|
|
<!ENTITY qemu-kvm-buildsize "112 MB">
|
|
|
|
<!ENTITY qemu-kvm-time "1.3 SBU">
|
|
|
|
]>
|
|
|
|
|
|
|
|
<sect1 id="qemu-kvm" xreflabel="qemu-kvm-&qemu-kvm-version;">
|
|
|
|
<?dbhtml filename="qemu-kvm.html"?>
|
|
|
|
|
|
|
|
<sect1info>
|
2012-02-18 09:11:24 +08:00
|
|
|
<othername>$LastChangedBy$</othername>
|
|
|
|
<date>$Date$</date>
|
2012-01-30 12:00:39 +08:00
|
|
|
</sect1info>
|
|
|
|
|
|
|
|
<title>qemu-kvm-&qemu-kvm-version;</title>
|
|
|
|
|
|
|
|
<indexterm zone="qemu-kvm">
|
|
|
|
<primary sortas="a-qemu-kvm">qemu-kvm</primary>
|
|
|
|
</indexterm>
|
|
|
|
|
|
|
|
<sect2 role="package">
|
|
|
|
<title>Introduction to qemu-kvm</title>
|
|
|
|
|
|
|
|
<para><application>qemu-kvm</application> is a full virtualization solution
|
|
|
|
for Linux on x86 hardware containing virtualization extensions (Intel VT or
|
|
|
|
AMD-V).</para>
|
|
|
|
|
|
|
|
<bridgehead renderas="sect3">Package Information</bridgehead>
|
|
|
|
<itemizedlist spacing="compact">
|
|
|
|
<listitem>
|
|
|
|
<para>Download (HTTP): <ulink url="&qemu-kvm-download-http;"/></para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>Download (FTP): <ulink url="&qemu-kvm-download-ftp;"/></para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>Download MD5 sum: &qemu-kvm-md5sum;</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>Download size: &qemu-kvm-size;</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>Estimated disk space required: &qemu-kvm-buildsize;</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>Estimated build time: &qemu-kvm-time;</para>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
|
|
|
|
2012-01-31 01:10:15 +08:00
|
|
|
<bridgehead renderas="sect3">Qemu-kvm Dependencies</bridgehead>
|
2012-01-30 12:00:39 +08:00
|
|
|
|
|
|
|
<bridgehead renderas="sect4">Required</bridgehead>
|
|
|
|
<para role="required">
|
2012-03-10 00:13:13 +08:00
|
|
|
<xref linkend="pkgconfig"/>,
|
2012-02-17 22:43:28 +08:00
|
|
|
<xref linkend="python2"/>,
|
2012-01-30 12:00:39 +08:00
|
|
|
<xref linkend="sdl"/>, and
|
|
|
|
<xref linkend="x-window-system"/>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<bridgehead renderas="sect4">Optional</bridgehead>
|
|
|
|
<para role="optional">
|
|
|
|
<xref linkend="alsa"/>,
|
|
|
|
<xref linkend="attr"/>,
|
|
|
|
<xref linkend="check"/>,
|
|
|
|
<xref linkend="curl"/>,
|
|
|
|
<xref linkend="esound"/>,
|
|
|
|
<xref linkend="mesalib"/>, and
|
|
|
|
<xref linkend="cyrus-sasl"/>.
|
|
|
|
Note that this optional dependencies list is not comprehensive. See the
|
|
|
|
output of <command>./configure --help</command> for a more complete list.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para condition="html" role="usernotes">User Notes:
|
|
|
|
<ulink url="&blfs-wiki;/qemu-kvm"/></para>
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 id='qemu-kvm-prereq'>
|
|
|
|
<title>KVM Prerequsites</title>
|
|
|
|
|
|
|
|
<para>Before building <application>qemu-kvm</application>, check to see if
|
|
|
|
your processor supports Virtualization Technology (VT):</para>
|
|
|
|
|
|
|
|
<screen><userinput>egrep '^flags.*(vmx|svm)' /proc/cpuinfo</userinput></screen>
|
|
|
|
|
|
|
|
<para>If you get any output, you have VT technology (vmx for Intel
|
|
|
|
processors and svm for AMD processors). You then need to go into your
|
|
|
|
system BIOS and ensure it is enabled. After enabing, reboot back to your
|
|
|
|
LFS instance.</para>
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 role="kernel" id='qemu-kvm-kernel'>
|
|
|
|
<title>Kernel Configuration</title>
|
|
|
|
|
|
|
|
<para>Enable the following options in the kernel configuration
|
|
|
|
and recompile the kernel if necessary:</para>
|
|
|
|
|
|
|
|
<screen><literal>Virtualization: Y
|
|
|
|
Kernel-based Virtual Machine (KVM) support: M or Y
|
|
|
|
KVM for Intel processors support: M or Y
|
|
|
|
KVM for AMD processors support: M or Y</literal></screen>
|
|
|
|
|
|
|
|
<indexterm zone="qemu-kvm qemu-kvm-kernel">
|
|
|
|
<primary sortas="d-qemu-kvm">kvm-qemu</primary>
|
|
|
|
</indexterm>
|
|
|
|
|
|
|
|
<para>The Intel or AMD settings are not both required, but the one matching
|
|
|
|
your system processor is required.</para>
|
|
|
|
|
|
|
|
<para>For networking, check that the settings CONFIG_BRIDGE, CONFIG_STP,
|
|
|
|
CONFIG_TUN are enabled and <xref linkend='bridgeutils'/> is
|
|
|
|
installed.</para>
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 role="installation">
|
|
|
|
<title>Installation of qemu-kvm</title>
|
|
|
|
|
|
|
|
<para>If <application>xorg</application> is not installed in
|
|
|
|
<filename class='directory'>/usr</filename>, then the linker needs to
|
|
|
|
be told where it is. For example:</para>
|
|
|
|
|
|
|
|
<screen><userinput>export LIBRARY_PATH=/opt/xorg/lib</userinput></screen>
|
|
|
|
|
|
|
|
<para>Install <application>qemu-kvm</application> by running the following
|
|
|
|
commands:</para>
|
|
|
|
|
|
|
|
<screen><userinput>./configure --prefix=/usr &&
|
|
|
|
make</userinput></screen>
|
|
|
|
|
|
|
|
<para>Testing the results is not automated. To run individual tests, change
|
|
|
|
to the <filename class='directory'>tests/</filename> directory, and examine
|
|
|
|
the <filename>Makefile</filename>. Each test may be run individually with
|
|
|
|
<command>make run-<test name></command>.</para>
|
|
|
|
|
|
|
|
<para>Now, as the <systemitem class="username">root</systemitem> user:</para>
|
|
|
|
|
|
|
|
<screen role="root"><userinput>make install</userinput></screen>
|
|
|
|
|
|
|
|
<note><para>The main program <command>qemu-system-x86_64</command> doesn't
|
|
|
|
make a distinction between i386 and x86_64 so even on an i386 system you
|
|
|
|
should use <emphasis>qemu-system-x86_64</emphasis></para>
|
|
|
|
|
|
|
|
<para>For convenience you may want to create a symbolic link to run
|
|
|
|
<command>qemu-system-x86_64</command>:</para>
|
|
|
|
|
|
|
|
<screen><userinput>ln -sv qemu-system-x86_64 /usr/bin/qemu</userinput></screen>
|
|
|
|
</note>
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 role="configuration">
|
|
|
|
<title>Configuring qemu-kvm</title>
|
|
|
|
|
|
|
|
<para>To generate an image, run:</para>
|
|
|
|
|
|
|
|
<screen><userinput>qemu-img create -f qcow2 vdisk.img 10G</userinput></screen>
|
|
|
|
|
|
|
|
<para>Adjust the virtual disk size and image filename as desired. The
|
|
|
|
actual size of the file will be less than specified, but will expand as it
|
|
|
|
is used.</para>
|
|
|
|
|
|
|
|
<note><para>The following instructions assume you have created the optional
|
|
|
|
symbolic link, <userinput>qemu</userinput>. Additionally, you must run
|
|
|
|
<userinput>qemu</userinput> as the <systemitem
|
|
|
|
class="username">root</systemitem> user command from an X-Windows based
|
|
|
|
terminal.</para></note>
|
|
|
|
|
|
|
|
<para>To install an operating system, download an iso of your choice or use
|
|
|
|
a pre-intalled cdrom device. For the purposes of this example, we will use
|
|
|
|
Fedora 16 that is downloaded as
|
|
|
|
<filename>Fedora-16-x86_64-Live-LXDE.iso</filename> in the current
|
|
|
|
directory. Run the following:</para>
|
|
|
|
|
|
|
|
<screen><userinput>qemu -hda vdisk.img \
|
|
|
|
-cdrom Fedora-16-x86_64-Live-LXDE.iso \
|
|
|
|
-boot d \
|
|
|
|
-m 384</userinput></screen>
|
|
|
|
|
|
|
|
<para>Follow the normal installation procedures for the chosen
|
|
|
|
distribution. The -boot option specifies the boot order of drives as a string
|
|
|
|
of drive letters. Valid drive letters are: a, b (floppy 1 and 2), c (first
|
|
|
|
hard disk), d (first CD-ROM). The -m option is the amount of memory to use
|
|
|
|
for the virtual machine. If you have sufficient memory (2G or more), 1G is
|
|
|
|
a reasonable value. For computers with 512MB of RAM it's safe to use -m
|
|
|
|
192, or even -m 128 (the default).</para>
|
|
|
|
|
|
|
|
<para>To run the newly installed operating system, run:</para>
|
|
|
|
|
|
|
|
<screen><userinput>qemu vdisk.img -m 384</userinput></screen>
|
|
|
|
|
|
|
|
<para>To add networking to the instance add "-net nic -net user" to the
|
|
|
|
command above. qemu provides a DHCP server for the VM and, depending on
|
|
|
|
the client system, sets up networking though the host.</para>
|
|
|
|
|
|
|
|
<para>One problem with the above networking solution is that it does not
|
|
|
|
provide the ability to connect with the local network. To do that, there are
|
|
|
|
several additional steps that need to be done, all as the <systemitem
|
|
|
|
class="username">root</systemitem> user:</para>
|
|
|
|
|
|
|
|
<itemizedlist spacing="compact">
|
|
|
|
<listitem>
|
|
|
|
<para>Set up bridging with <xref linkend='bridgeutils'/>.</para>
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>Allow the host system to forward IP packets.</para>
|
|
|
|
|
|
|
|
<screen><userinput>sysctl -w net.ipv4.ip_forward=1</userinput></screen>
|
|
|
|
|
|
|
|
<para>To make this permanent, add the command to
|
|
|
|
<filename>/etc/syssysctl.conf:</filename></para>
|
|
|
|
|
|
|
|
<screen><userinput>cat >> /etc/sysctl.conf << EOF
|
|
|
|
net.ipv4.ip_forward=1
|
|
|
|
EOF</userinput></screen>
|
|
|
|
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>Create scripts for qemu to attach the client network
|
|
|
|
device, usually visible as tap0, to the host bridge.</para>
|
|
|
|
|
|
|
|
<screen><userinput>cat >> /etc/qemu-ifup << EOF
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
switch=br0
|
|
|
|
|
|
|
|
if [ -n "$1" ]; then
|
|
|
|
# Add new tap0 interface to bridge
|
|
|
|
/sbin/ip link set $1 up
|
|
|
|
sleep 0.5s
|
|
|
|
/usr/sbin/brctl addif $switch $1
|
|
|
|
else
|
|
|
|
echo "Error: no interface specified"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
EOF</userinput></screen>
|
|
|
|
|
|
|
|
<screen><userinput>cat >> /etc/qemu-ifdown << EOF
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
switch=br0
|
|
|
|
|
|
|
|
if [ -n "$1" ]; then
|
|
|
|
# Remove tap0 interface from bridge
|
|
|
|
/usr/sbin/brctl delif $switch $1
|
|
|
|
else
|
|
|
|
echo "Error: no interface specified"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
EOF</userinput></screen>
|
|
|
|
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>Start qemu with "-net nic -net tap" options. </para>
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>If a connection, such as ssh, from the local network to the
|
|
|
|
client VM is desired, the client should probably be configured
|
|
|
|
with a static IP address.</para>
|
|
|
|
</listitem>
|
|
|
|
|
|
|
|
</itemizedlist>
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
<sect2 role="content">
|
|
|
|
<title>Contents</title>
|
|
|
|
|
|
|
|
<segmentedlist>
|
|
|
|
<segtitle>Installed Program</segtitle>
|
|
|
|
<segtitle>Installed Libraries</segtitle>
|
|
|
|
<segtitle>Installed Directories</segtitle>
|
|
|
|
|
|
|
|
<seglistitem>
|
|
|
|
<seg>qemu-ga, qemu-img, qemu-io, qemu-nbd, qemu-system-x86_64</seg>
|
|
|
|
<seg>None</seg>
|
|
|
|
<seg>/etc/qemu, /usr/share/qemu, /usr/share/doc/qemu</seg>
|
|
|
|
</seglistitem>
|
|
|
|
</segmentedlist>
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<bridgehead renderas="sect3">Short Description</bridgehead>
|
|
|
|
<?dbfo list-presentation="list"?>
|
|
|
|
<?dbhtml list-presentation="table"?>
|
|
|
|
|
|
|
|
<varlistentry id="qemu-ga">
|
|
|
|
<term><command>qemu-ga</command></term>
|
|
|
|
<listitem>
|
|
|
|
<para>implements support for QMP (QEMU Monitor Protocol) commands and
|
|
|
|
events that terminate and originate respectively within the guest
|
|
|
|
using an agent built as part of QEMU.</para>
|
|
|
|
<indexterm zone="qemu-kvm qemu-ga">
|
|
|
|
<primary sortas="b-qemu-ga">qemu-ga</primary>
|
|
|
|
</indexterm>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry id="qemu-img">
|
|
|
|
<term><command>qemu-img</command></term>
|
|
|
|
<listitem>
|
|
|
|
<para>provides commands to manage QEMU disk images.</para>
|
|
|
|
<indexterm zone="qemu-kvm qemu-img">
|
|
|
|
<primary sortas="b-qemu-img">qemu-img</primary>
|
|
|
|
</indexterm>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry id="qemu-io">
|
|
|
|
<term><command>qemu-io</command></term>
|
|
|
|
<listitem>
|
|
|
|
<para>is a diagnostic and manipulation program for (virtual) memory
|
|
|
|
media. It is still at an early stage of development.</para>
|
|
|
|
<indexterm zone="qemu-kvm qemu-io">
|
|
|
|
<primary sortas="b-qemu-io">qemu-io</primary>
|
|
|
|
</indexterm>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry id="qemu-nbd">
|
|
|
|
<term><command>qemu-nbd</command></term>
|
|
|
|
<listitem>
|
|
|
|
<para>exports Qemu disk images using the QEMU Disk Network Block
|
|
|
|
Device (NBD) protocol.</para>
|
|
|
|
<indexterm zone="qemu-kvm qemu-nbd">
|
|
|
|
<primary sortas="b-qemu-nbd">qemu-nbd</primary>
|
|
|
|
</indexterm>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry id="qemu-system">
|
|
|
|
<term><command>qemu-system-x86_64</command></term>
|
|
|
|
<listitem>
|
|
|
|
<para>is the QEMU PC System emulator.</para>
|
|
|
|
<indexterm zone="qemu-kvm qemu-system">
|
|
|
|
<primary sortas="b-qemu-system">qemu-system-x86_64</primary>
|
|
|
|
</indexterm>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
</variablelist>
|
|
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
|
|
</sect1>
|