[d28198d3] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 |
|
---|
| 7 | <!ENTITY qemu-kvm-download-http " ">
|
---|
[e4decda] | 8 | <!ENTITY qemu-kvm-download-ftp "&sourceforge-repo2;/projects/kvm/files/qemu-kvm/&qemu-kvm-version;/qemu-kvm-&qemu-kvm-version;.tar.gz">
|
---|
[d28198d3] | 9 | <!ENTITY qemu-kvm-md5sum "00a825db46a70ba8ef9fc95da9cc7c1e">
|
---|
| 10 | <!ENTITY qemu-kvm-size "5.9 MB">
|
---|
| 11 | <!ENTITY qemu-kvm-buildsize "112 MB">
|
---|
| 12 | <!ENTITY qemu-kvm-time "1.3 SBU">
|
---|
| 13 | ]>
|
---|
| 14 |
|
---|
| 15 | <sect1 id="qemu-kvm" xreflabel="qemu-kvm-&qemu-kvm-version;">
|
---|
| 16 | <?dbhtml filename="qemu-kvm.html"?>
|
---|
| 17 |
|
---|
| 18 | <sect1info>
|
---|
[c4a1934a] | 19 | <othername>$LastChangedBy$</othername>
|
---|
| 20 | <date>$Date$</date>
|
---|
[d28198d3] | 21 | </sect1info>
|
---|
| 22 |
|
---|
| 23 | <title>qemu-kvm-&qemu-kvm-version;</title>
|
---|
| 24 |
|
---|
| 25 | <indexterm zone="qemu-kvm">
|
---|
| 26 | <primary sortas="a-qemu-kvm">qemu-kvm</primary>
|
---|
| 27 | </indexterm>
|
---|
| 28 |
|
---|
| 29 | <sect2 role="package">
|
---|
| 30 | <title>Introduction to qemu-kvm</title>
|
---|
| 31 |
|
---|
| 32 | <para><application>qemu-kvm</application> is a full virtualization solution
|
---|
| 33 | for Linux on x86 hardware containing virtualization extensions (Intel VT or
|
---|
| 34 | AMD-V).</para>
|
---|
| 35 |
|
---|
| 36 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 37 | <itemizedlist spacing="compact">
|
---|
| 38 | <listitem>
|
---|
| 39 | <para>Download (HTTP): <ulink url="&qemu-kvm-download-http;"/></para>
|
---|
| 40 | </listitem>
|
---|
| 41 | <listitem>
|
---|
| 42 | <para>Download (FTP): <ulink url="&qemu-kvm-download-ftp;"/></para>
|
---|
| 43 | </listitem>
|
---|
| 44 | <listitem>
|
---|
| 45 | <para>Download MD5 sum: &qemu-kvm-md5sum;</para>
|
---|
| 46 | </listitem>
|
---|
| 47 | <listitem>
|
---|
| 48 | <para>Download size: &qemu-kvm-size;</para>
|
---|
| 49 | </listitem>
|
---|
| 50 | <listitem>
|
---|
| 51 | <para>Estimated disk space required: &qemu-kvm-buildsize;</para>
|
---|
| 52 | </listitem>
|
---|
| 53 | <listitem>
|
---|
| 54 | <para>Estimated build time: &qemu-kvm-time;</para>
|
---|
| 55 | </listitem>
|
---|
| 56 | </itemizedlist>
|
---|
| 57 |
|
---|
[20c59bd] | 58 | <bridgehead renderas="sect3">Qemu-kvm Dependencies</bridgehead>
|
---|
[d28198d3] | 59 |
|
---|
| 60 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
| 61 | <para role="required">
|
---|
[d8ea1fb] | 62 | <xref linkend="pkgconfig"/>,
|
---|
[4716d52] | 63 | <xref linkend="python2"/>,
|
---|
[d28198d3] | 64 | <xref linkend="sdl"/>, and
|
---|
| 65 | <xref linkend="x-window-system"/>
|
---|
| 66 | </para>
|
---|
| 67 |
|
---|
| 68 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
| 69 | <para role="optional">
|
---|
| 70 | <xref linkend="alsa"/>,
|
---|
| 71 | <xref linkend="attr"/>,
|
---|
| 72 | <xref linkend="check"/>,
|
---|
| 73 | <xref linkend="curl"/>,
|
---|
| 74 | <xref linkend="esound"/>,
|
---|
| 75 | <xref linkend="mesalib"/>, and
|
---|
| 76 | <xref linkend="cyrus-sasl"/>.
|
---|
| 77 | Note that this optional dependencies list is not comprehensive. See the
|
---|
| 78 | output of <command>./configure --help</command> for a more complete list.
|
---|
| 79 | </para>
|
---|
| 80 |
|
---|
| 81 | <para condition="html" role="usernotes">User Notes:
|
---|
| 82 | <ulink url="&blfs-wiki;/qemu-kvm"/></para>
|
---|
| 83 |
|
---|
| 84 | </sect2>
|
---|
| 85 |
|
---|
| 86 | <sect2 id='qemu-kvm-prereq'>
|
---|
| 87 | <title>KVM Prerequsites</title>
|
---|
| 88 |
|
---|
| 89 | <para>Before building <application>qemu-kvm</application>, check to see if
|
---|
| 90 | your processor supports Virtualization Technology (VT):</para>
|
---|
| 91 |
|
---|
| 92 | <screen><userinput>egrep '^flags.*(vmx|svm)' /proc/cpuinfo</userinput></screen>
|
---|
| 93 |
|
---|
| 94 | <para>If you get any output, you have VT technology (vmx for Intel
|
---|
| 95 | processors and svm for AMD processors). You then need to go into your
|
---|
| 96 | system BIOS and ensure it is enabled. After enabing, reboot back to your
|
---|
| 97 | LFS instance.</para>
|
---|
| 98 |
|
---|
| 99 | </sect2>
|
---|
| 100 |
|
---|
| 101 | <sect2 role="kernel" id='qemu-kvm-kernel'>
|
---|
| 102 | <title>Kernel Configuration</title>
|
---|
| 103 |
|
---|
| 104 | <para>Enable the following options in the kernel configuration
|
---|
| 105 | and recompile the kernel if necessary:</para>
|
---|
| 106 |
|
---|
| 107 | <screen><literal>Virtualization: Y
|
---|
| 108 | Kernel-based Virtual Machine (KVM) support: M or Y
|
---|
| 109 | KVM for Intel processors support: M or Y
|
---|
| 110 | KVM for AMD processors support: M or Y</literal></screen>
|
---|
| 111 |
|
---|
| 112 | <indexterm zone="qemu-kvm qemu-kvm-kernel">
|
---|
| 113 | <primary sortas="d-qemu-kvm">kvm-qemu</primary>
|
---|
| 114 | </indexterm>
|
---|
| 115 |
|
---|
| 116 | <para>The Intel or AMD settings are not both required, but the one matching
|
---|
| 117 | your system processor is required.</para>
|
---|
| 118 |
|
---|
| 119 | <para>For networking, check that the settings CONFIG_BRIDGE, CONFIG_STP,
|
---|
| 120 | CONFIG_TUN are enabled and <xref linkend='bridgeutils'/> is
|
---|
| 121 | installed.</para>
|
---|
| 122 |
|
---|
| 123 | </sect2>
|
---|
| 124 |
|
---|
| 125 | <sect2 role="installation">
|
---|
| 126 | <title>Installation of qemu-kvm</title>
|
---|
| 127 |
|
---|
| 128 | <para>If <application>xorg</application> is not installed in
|
---|
| 129 | <filename class='directory'>/usr</filename>, then the linker needs to
|
---|
| 130 | be told where it is. For example:</para>
|
---|
| 131 |
|
---|
| 132 | <screen><userinput>export LIBRARY_PATH=/opt/xorg/lib</userinput></screen>
|
---|
| 133 |
|
---|
| 134 | <para>Install <application>qemu-kvm</application> by running the following
|
---|
| 135 | commands:</para>
|
---|
| 136 |
|
---|
| 137 | <screen><userinput>./configure --prefix=/usr &&
|
---|
| 138 | make</userinput></screen>
|
---|
| 139 |
|
---|
| 140 | <para>Testing the results is not automated. To run individual tests, change
|
---|
| 141 | to the <filename class='directory'>tests/</filename> directory, and examine
|
---|
| 142 | the <filename>Makefile</filename>. Each test may be run individually with
|
---|
| 143 | <command>make run-<test name></command>.</para>
|
---|
| 144 |
|
---|
| 145 | <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
|
---|
| 146 |
|
---|
| 147 | <screen role="root"><userinput>make install</userinput></screen>
|
---|
| 148 |
|
---|
| 149 | <note><para>The main program <command>qemu-system-x86_64</command> doesn't
|
---|
| 150 | make a distinction between i386 and x86_64 so even on an i386 system you
|
---|
| 151 | should use <emphasis>qemu-system-x86_64</emphasis></para>
|
---|
| 152 |
|
---|
| 153 | <para>For convenience you may want to create a symbolic link to run
|
---|
| 154 | <command>qemu-system-x86_64</command>:</para>
|
---|
| 155 |
|
---|
| 156 | <screen><userinput>ln -sv qemu-system-x86_64 /usr/bin/qemu</userinput></screen>
|
---|
| 157 | </note>
|
---|
| 158 |
|
---|
| 159 | </sect2>
|
---|
| 160 |
|
---|
| 161 | <sect2 role="configuration">
|
---|
| 162 | <title>Configuring qemu-kvm</title>
|
---|
| 163 |
|
---|
| 164 | <para>To generate an image, run:</para>
|
---|
| 165 |
|
---|
| 166 | <screen><userinput>qemu-img create -f qcow2 vdisk.img 10G</userinput></screen>
|
---|
| 167 |
|
---|
| 168 | <para>Adjust the virtual disk size and image filename as desired. The
|
---|
| 169 | actual size of the file will be less than specified, but will expand as it
|
---|
| 170 | is used.</para>
|
---|
| 171 |
|
---|
| 172 | <note><para>The following instructions assume you have created the optional
|
---|
| 173 | symbolic link, <userinput>qemu</userinput>. Additionally, you must run
|
---|
| 174 | <userinput>qemu</userinput> as the <systemitem
|
---|
| 175 | class="username">root</systemitem> user command from an X-Windows based
|
---|
| 176 | terminal.</para></note>
|
---|
| 177 |
|
---|
| 178 | <para>To install an operating system, download an iso of your choice or use
|
---|
| 179 | a pre-intalled cdrom device. For the purposes of this example, we will use
|
---|
| 180 | Fedora 16 that is downloaded as
|
---|
| 181 | <filename>Fedora-16-x86_64-Live-LXDE.iso</filename> in the current
|
---|
| 182 | directory. Run the following:</para>
|
---|
| 183 |
|
---|
| 184 | <screen><userinput>qemu -hda vdisk.img \
|
---|
| 185 | -cdrom Fedora-16-x86_64-Live-LXDE.iso \
|
---|
| 186 | -boot d \
|
---|
| 187 | -m 384</userinput></screen>
|
---|
| 188 |
|
---|
| 189 | <para>Follow the normal installation procedures for the chosen
|
---|
| 190 | distribution. The -boot option specifies the boot order of drives as a string
|
---|
| 191 | of drive letters. Valid drive letters are: a, b (floppy 1 and 2), c (first
|
---|
| 192 | hard disk), d (first CD-ROM). The -m option is the amount of memory to use
|
---|
| 193 | for the virtual machine. If you have sufficient memory (2G or more), 1G is
|
---|
| 194 | a reasonable value. For computers with 512MB of RAM it's safe to use -m
|
---|
| 195 | 192, or even -m 128 (the default).</para>
|
---|
| 196 |
|
---|
| 197 | <para>To run the newly installed operating system, run:</para>
|
---|
| 198 |
|
---|
| 199 | <screen><userinput>qemu vdisk.img -m 384</userinput></screen>
|
---|
| 200 |
|
---|
| 201 | <para>To add networking to the instance add "-net nic -net user" to the
|
---|
| 202 | command above. qemu provides a DHCP server for the VM and, depending on
|
---|
| 203 | the client system, sets up networking though the host.</para>
|
---|
| 204 |
|
---|
| 205 | <para>One problem with the above networking solution is that it does not
|
---|
| 206 | provide the ability to connect with the local network. To do that, there are
|
---|
| 207 | several additional steps that need to be done, all as the <systemitem
|
---|
| 208 | class="username">root</systemitem> user:</para>
|
---|
| 209 |
|
---|
| 210 | <itemizedlist spacing="compact">
|
---|
| 211 | <listitem>
|
---|
| 212 | <para>Set up bridging with <xref linkend='bridgeutils'/>.</para>
|
---|
| 213 | </listitem>
|
---|
| 214 |
|
---|
| 215 | <listitem>
|
---|
| 216 | <para>Allow the host system to forward IP packets.</para>
|
---|
| 217 |
|
---|
| 218 | <screen><userinput>sysctl -w net.ipv4.ip_forward=1</userinput></screen>
|
---|
| 219 |
|
---|
| 220 | <para>To make this permanent, add the command to
|
---|
| 221 | <filename>/etc/syssysctl.conf:</filename></para>
|
---|
| 222 |
|
---|
| 223 | <screen><userinput>cat >> /etc/sysctl.conf << EOF
|
---|
| 224 | net.ipv4.ip_forward=1
|
---|
| 225 | EOF</userinput></screen>
|
---|
| 226 |
|
---|
| 227 | </listitem>
|
---|
| 228 |
|
---|
| 229 | <listitem>
|
---|
| 230 | <para>Create scripts for qemu to attach the client network
|
---|
| 231 | device, usually visible as tap0, to the host bridge.</para>
|
---|
| 232 |
|
---|
| 233 | <screen><userinput>cat >> /etc/qemu-ifup << EOF
|
---|
| 234 | #!/bin/bash
|
---|
| 235 |
|
---|
| 236 | switch=br0
|
---|
| 237 |
|
---|
| 238 | if [ -n "$1" ]; then
|
---|
| 239 | # Add new tap0 interface to bridge
|
---|
| 240 | /sbin/ip link set $1 up
|
---|
| 241 | sleep 0.5s
|
---|
| 242 | /usr/sbin/brctl addif $switch $1
|
---|
| 243 | else
|
---|
| 244 | echo "Error: no interface specified"
|
---|
| 245 | exit 1
|
---|
| 246 | fi
|
---|
| 247 |
|
---|
| 248 | exit 0
|
---|
| 249 | EOF</userinput></screen>
|
---|
| 250 |
|
---|
| 251 | <screen><userinput>cat >> /etc/qemu-ifdown << EOF
|
---|
| 252 | #!/bin/bash
|
---|
| 253 |
|
---|
| 254 | switch=br0
|
---|
| 255 |
|
---|
| 256 | if [ -n "$1" ]; then
|
---|
| 257 | # Remove tap0 interface from bridge
|
---|
| 258 | /usr/sbin/brctl delif $switch $1
|
---|
| 259 | else
|
---|
| 260 | echo "Error: no interface specified"
|
---|
| 261 | exit 1
|
---|
| 262 | fi
|
---|
| 263 |
|
---|
| 264 | exit 0
|
---|
| 265 | EOF</userinput></screen>
|
---|
| 266 |
|
---|
| 267 | </listitem>
|
---|
| 268 |
|
---|
| 269 | <listitem>
|
---|
| 270 | <para>Start qemu with "-net nic -net tap" options. </para>
|
---|
| 271 | </listitem>
|
---|
| 272 |
|
---|
| 273 | <listitem>
|
---|
| 274 | <para>If a connection, such as ssh, from the local network to the
|
---|
| 275 | client VM is desired, the client should probably be configured
|
---|
| 276 | with a static IP address.</para>
|
---|
| 277 | </listitem>
|
---|
| 278 |
|
---|
| 279 | </itemizedlist>
|
---|
| 280 |
|
---|
| 281 | </sect2>
|
---|
| 282 |
|
---|
| 283 | <sect2 role="content">
|
---|
| 284 | <title>Contents</title>
|
---|
| 285 |
|
---|
| 286 | <segmentedlist>
|
---|
| 287 | <segtitle>Installed Program</segtitle>
|
---|
| 288 | <segtitle>Installed Libraries</segtitle>
|
---|
| 289 | <segtitle>Installed Directories</segtitle>
|
---|
| 290 |
|
---|
| 291 | <seglistitem>
|
---|
| 292 | <seg>qemu-ga, qemu-img, qemu-io, qemu-nbd, qemu-system-x86_64</seg>
|
---|
| 293 | <seg>None</seg>
|
---|
| 294 | <seg>/etc/qemu, /usr/share/qemu, /usr/share/doc/qemu</seg>
|
---|
| 295 | </seglistitem>
|
---|
| 296 | </segmentedlist>
|
---|
| 297 |
|
---|
| 298 | <variablelist>
|
---|
| 299 | <bridgehead renderas="sect3">Short Description</bridgehead>
|
---|
| 300 | <?dbfo list-presentation="list"?>
|
---|
| 301 | <?dbhtml list-presentation="table"?>
|
---|
| 302 |
|
---|
| 303 | <varlistentry id="qemu-ga">
|
---|
| 304 | <term><command>qemu-ga</command></term>
|
---|
| 305 | <listitem>
|
---|
| 306 | <para>implements support for QMP (QEMU Monitor Protocol) commands and
|
---|
| 307 | events that terminate and originate respectively within the guest
|
---|
| 308 | using an agent built as part of QEMU.</para>
|
---|
| 309 | <indexterm zone="qemu-kvm qemu-ga">
|
---|
| 310 | <primary sortas="b-qemu-ga">qemu-ga</primary>
|
---|
| 311 | </indexterm>
|
---|
| 312 | </listitem>
|
---|
| 313 | </varlistentry>
|
---|
| 314 |
|
---|
| 315 | <varlistentry id="qemu-img">
|
---|
| 316 | <term><command>qemu-img</command></term>
|
---|
| 317 | <listitem>
|
---|
| 318 | <para>provides commands to manage QEMU disk images.</para>
|
---|
| 319 | <indexterm zone="qemu-kvm qemu-img">
|
---|
| 320 | <primary sortas="b-qemu-img">qemu-img</primary>
|
---|
| 321 | </indexterm>
|
---|
| 322 | </listitem>
|
---|
| 323 | </varlistentry>
|
---|
| 324 |
|
---|
| 325 | <varlistentry id="qemu-io">
|
---|
| 326 | <term><command>qemu-io</command></term>
|
---|
| 327 | <listitem>
|
---|
| 328 | <para>is a diagnostic and manipulation program for (virtual) memory
|
---|
| 329 | media. It is still at an early stage of development.</para>
|
---|
| 330 | <indexterm zone="qemu-kvm qemu-io">
|
---|
| 331 | <primary sortas="b-qemu-io">qemu-io</primary>
|
---|
| 332 | </indexterm>
|
---|
| 333 | </listitem>
|
---|
| 334 | </varlistentry>
|
---|
| 335 |
|
---|
| 336 | <varlistentry id="qemu-nbd">
|
---|
| 337 | <term><command>qemu-nbd</command></term>
|
---|
| 338 | <listitem>
|
---|
| 339 | <para>exports Qemu disk images using the QEMU Disk Network Block
|
---|
| 340 | Device (NBD) protocol.</para>
|
---|
| 341 | <indexterm zone="qemu-kvm qemu-nbd">
|
---|
| 342 | <primary sortas="b-qemu-nbd">qemu-nbd</primary>
|
---|
| 343 | </indexterm>
|
---|
| 344 | </listitem>
|
---|
| 345 | </varlistentry>
|
---|
| 346 |
|
---|
| 347 | <varlistentry id="qemu-system">
|
---|
| 348 | <term><command>qemu-system-x86_64</command></term>
|
---|
| 349 | <listitem>
|
---|
| 350 | <para>is the QEMU PC System emulator.</para>
|
---|
| 351 | <indexterm zone="qemu-kvm qemu-system">
|
---|
| 352 | <primary sortas="b-qemu-system">qemu-system-x86_64</primary>
|
---|
| 353 | </indexterm>
|
---|
| 354 | </listitem>
|
---|
| 355 | </varlistentry>
|
---|
| 356 |
|
---|
| 357 | </variablelist>
|
---|
| 358 |
|
---|
| 359 | </sect2>
|
---|
| 360 |
|
---|
| 361 | </sect1>
|
---|