source: postlfs/virtualization/qemu.xml@ 920f21a

systemd-13485
Last change on this file since 920f21a was 54aaa89, checked in by Douglas R. Reno <renodr@…>, 8 years ago

Sync to trunk r17213
Added entity for GNOME-3.20

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/branches/systemd@17328 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 19.2 KB
Line 
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-download-http "http://wiki.qemu.org/download/qemu-&qemu-version;.tar.bz2">
8 <!ENTITY qemu-download-ftp " ">
9 <!ENTITY qemu-md5sum "42e73182dea8b9213fa7050e168a4615">
10 <!ENTITY qemu-size "24 MB">
11 <!ENTITY qemu-buildsize "397 MB (with tests)">
12 <!ENTITY qemu-time "2.8 SBU (with tests)">
13]>
14
15<sect1 id="qemu" xreflabel="qemu-&qemu-version;">
16 <?dbhtml filename="qemu.html"?>
17
18 <sect1info>
19 <othername>$LastChangedBy$</othername>
20 <date>$Date$</date>
21 </sect1info>
22
23 <title>qemu-&qemu-version;</title>
24
25 <indexterm zone="qemu">
26 <primary sortas="a-qemu">qemu</primary>
27 </indexterm>
28
29 <sect2 role="package">
30 <title>Introduction to qemu</title>
31
32 <para><application>qemu</application> is a full virtualization solution
33 for Linux on x86 hardware containing virtualization extensions (Intel VT or
34 AMD-V).</para>
35
36 &lfs77_checked;
37
38 <bridgehead renderas="sect3">Package Information</bridgehead>
39 <itemizedlist spacing="compact">
40 <listitem>
41 <para>Download (HTTP): <ulink url="&qemu-download-http;"/></para>
42 </listitem>
43 <listitem>
44 <para>Download (FTP): <ulink url="&qemu-download-ftp;"/></para>
45 </listitem>
46 <listitem>
47 <para>Download MD5 sum: &qemu-md5sum;</para>
48 </listitem>
49 <listitem>
50 <para>Download size: &qemu-size;</para>
51 </listitem>
52 <listitem>
53 <para>Estimated disk space required: &qemu-buildsize;</para>
54 </listitem>
55 <listitem>
56 <para>Estimated build time: &qemu-time;</para>
57 </listitem>
58 </itemizedlist>
59
60 <bridgehead renderas="sect3">Qemu Dependencies</bridgehead>
61
62 <bridgehead renderas="sect4">Required</bridgehead>
63 <para role="required">
64 <xref linkend="glib2"/>,
65 <xref linkend="python2"/>, and
66 <xref linkend="x-window-system"/>
67 </para>
68
69 <bridgehead renderas="sect4">Recommended</bridgehead>
70 <para role="recommended">
71 <xref linkend="sdl"/>
72 </para>
73
74 <bridgehead renderas="sect4">Optional</bridgehead>
75 <para role="optional">
76 <xref linkend="alsa"/>,
77 <xref linkend="bluez"/>,
78 <xref linkend="check"/>,
79 <xref linkend="curl"/>,
80 <xref linkend="cyrus-sasl"/>,
81 <xref linkend="gnutls"/>,
82 <xref linkend="gtk2"/>,
83 <xref linkend="gtk3"/>,
84 <xref linkend="libusb"/>,
85 <xref linkend="libgcrypt"/>,
86 <xref linkend="lzo"/>,
87 <xref linkend="nettle"/>,
88 <xref linkend="nss"/> (for libcacard.so),
89 <xref linkend="mesa"/>,
90 <xref linkend="sdl"/>, and
91 <xref linkend="vte"/>
92 <ulink url="http://www.libssh2.org">libssh2</ulink>
93 </para>
94
95 <note>
96 <para>
97 This optional dependencies list is not comprehensive. See the output of
98 <command>./configure --help</command> for a more complete list.
99 </para>
100 </note>
101
102 <para condition="html" role="usernotes">User Notes:
103 <ulink url="&blfs-wiki;/qemu"/></para>
104
105 </sect2>
106
107 <sect2 id='qemu-prereq'>
108 <title>KVM Prerequisites</title>
109
110 <para>Before building <application>qemu</application>, check to see if
111 your processor supports Virtualization Technology (VT):</para>
112
113 <screen><userinput>egrep '^flags.*(vmx|svm)' /proc/cpuinfo</userinput></screen>
114
115 <para>If you get any output, you have VT technology (vmx for Intel
116 processors and svm for AMD processors). You then need to go into your
117 system BIOS and ensure it is enabled. After enabing, reboot back to your
118 LFS instance.</para>
119
120 </sect2>
121
122 <sect2 role="kernel" id='qemu-kernel'>
123 <title>Kernel Configuration</title>
124
125 <para>Enable the following options in the kernel configuration and
126 recompile the kernel if necessary:</para>
127
128<screen><literal>[*] Virtualization: ---&gt; [CONFIG_VIRTUALIZATION]
129 &lt;*/M&gt; Kernel-based Virtual Machine (KVM) support [CONFIG_KVM]
130 &lt;*/M&gt; KVM for Intel processors support [CONFIG_KVM_INTEL]
131 &lt;*/M&gt; KVM for AMD processors support [CONFIG_KVM_AMD]</literal></screen>
132
133 <indexterm zone="qemu qemu-kernel">
134 <primary sortas="d-qemu">qemu</primary>
135 </indexterm>
136
137 <para>The Intel or AMD settings are not both required, but the one matching
138 your system processor is required.</para>
139
140 <para>For networking, check that <xref linkend='bridgeutils'/> is installed
141 and the following options in the kernel configuration are enabled:</para>
142
143<screen><literal>[*] Networking support ---&gt; [CONFIG_NET]
144 Networking options ---&gt;
145 &lt;*/M&gt; 802.1d Ethernet Bridging [CONFIG_BRIDGE]
146Device Drivers ---&gt;
147 [*] Network device support ---&gt; [CONFIG_NETDEVICES]
148 &lt;*/M&gt; Universal TUN/TAP device driver support [CONFIG_TUN]</literal></screen>
149
150 </sect2>
151
152 <sect2 role="installation">
153 <title>Installation of qemu</title>
154
155 <para>Install <application>qemu</application> by running the following
156 commands:</para>
157
158 <note><para>Qemu is capable of running many targets. The build process
159 is also capable of building multiple targets at one time in a
160 comma delimited list assigned to <option>--target-list</option>. Run
161 <command>./configure --help</command> to get a complete list of
162 available targets.</para></note>
163
164<screen><userinput>if [ $(uname -m) = i686 ]; then
165 QEMU_ARCH=i386-softmmu
166else
167 QEMU_ARCH=x86_64-softmmu
168fi
169
170mkdir -vp build &amp;&amp;
171cd build &amp;&amp;
172
173../configure --prefix=/usr \
174 --sysconfdir=/etc \
175 --target-list=$QEMU_ARCH \
176 --audio-drv-list=alsa \
177 --docdir=/usr/share/doc/qemu-&qemu-version; &amp;&amp;
178
179unset QEMU_ARCH &amp;&amp;
180
181make</userinput></screen>
182
183 <para>To run the built in tests, run <command>make V=1 check</command>.
184 One test is known to fail.</para>
185
186 <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
187
188<screen role="root"><userinput>make install</userinput></screen>
189
190 <para>
191 You will need a dedicated group that will contain users (other than root)
192 allowed to access the KVM device. Create this group by running the following
193 command as the <systemitem class="username">root</systemitem> user:
194 </para>
195
196<screen role="root"><userinput>groupadd -g 61 kvm</userinput></screen>
197
198 <para>
199 Add any users that might use the KVM device to that group:
200 </para>
201
202<screen role="root"><userinput>usermod -a -G kvm <replaceable>&lt;username&gt;</replaceable></userinput></screen>
203
204 <para>
205 You will also need to add a Udev rule so that the KVM device gets correct
206 permissions:
207 </para>
208
209<screen role="root"><userinput>cat > /lib/udev/rules.d/65-kvm.rules &lt;&lt; "EOF"
210<literal>KERNEL=="kvm", GROUP="kvm", MODE="0660"</literal>
211EOF</userinput></screen>
212
213 <note>
214 <para>For convenience you may want to create a symbolic link to run
215 The installed program. For instance:</para>
216
217<screen role="root"><userinput>ln -sv qemu-system-`uname -m` /usr/bin/qemu</userinput></screen>
218 </note>
219
220 </sect2>
221
222 <sect2 role="commands">
223 <title>Command Explanations</title>
224
225 <para>
226 <parameter>--audio-drv-list=alsa</parameter>: This switch sets the audio driver
227 to ALSA. For other drivers see the --audio-drv-list list in
228 <command>configure</command>'s help output. The default audio driver is
229 OSS.
230 </para>
231
232 </sect2>
233
234 <sect2 role="configuration">
235 <title>Configuring qemu</title>
236
237 <para>To generate an image, run:</para>
238
239 <screen><userinput>qemu-img create -f qcow2 vdisk.img 10G</userinput></screen>
240
241 <para>Adjust the virtual disk size and image filename as desired. The
242 actual size of the file will be less than specified, but will expand as it
243 is used.</para>
244
245 <note><para>The following instructions assume you have created the optional
246 symbolic link, <userinput>qemu</userinput>. Additionally, you must run
247 <userinput>qemu</userinput> from an X Window System based terminal.
248 (either locally or over ssh).</para></note>
249
250 <para>To install an operating system, download an iso of your choice or use
251 a pre-installed cdrom device. For the purposes of this example, use
252 Fedora 16 that is downloaded as
253 <filename>Fedora-16-x86_64-Live-LXDE.iso</filename> in the current
254 directory. Run the following:</para>
255
256<screen><userinput>qemu -enable-kvm -hda vdisk.img \
257 -cdrom Fedora-16-x86_64-Live-LXDE.iso \
258 -boot d \
259 -m 384</userinput></screen>
260
261 <para>Follow the normal installation procedures for the chosen
262 distribution. The -boot option specifies the boot order of drives as a
263 string of drive letters. Valid drive letters are: a, b (floppy 1 and 2), c
264 (first hard disk), d (first CD-ROM). The -m option is the amount of memory
265 to use for the virtual machine. If you have sufficient memory (2G or
266 more), 1G is a reasonable value. For computers with 512MB of RAM it's safe
267 to use -m 192, or even -m 128 (the default). The -enable-kvm option allows
268 for hardware acceleeration. Without this switch, the emulation is
269 relatively slow.</para>
270
271 <para>To run the newly installed operating system, run:</para>
272
273<screen><userinput>qemu -enable-kvm vdisk.img -m 384</userinput></screen>
274
275 <para>You may have a problem with <parameter>--enable-kvm</parameter>. Also,
276 you may want to define audio and video drivers, the number of cpu cores, and
277 the number of threads. An alternative command to install the operating system is (see qemu
278 man page for parameters definitions):</para>
279
280<screen><userinput>qemu -enable-kvm \
281 -cdrom /home/fernando/ISO/linuxmint-17.1-mate-32bit.iso \
282 -boot order=d \
283 -m 1G,slots=3,maxmem=4G \
284 -machine smm=off \
285 -soundhw es1370 \
286 -cpu host \
287 -smp cores=4,threads=2 \
288 -vga std \
289 vdisk.img</userinput></screen>
290
291 <para>One parameter not appearing in the qemu man page is
292 <parameter>-machine smm=off</parameter>, and it used to allow
293 <parameter>-enable-kvm</parameter> in some systems. In order to run the
294 machine, you can alternatively issue:</para>
295
296<screen><userinput>qemu -enable-kvm \
297 -machine smm=off \
298 -boot order=d \
299 -m 1G,slots=3,maxmem=4G \
300 -soundhw es1370 \
301 -cpu host \
302 -smp cores=4,threads=2 \
303 -vga vmware \
304 -hda vdisk.img</userinput></screen>
305
306 <para>Sometimes, you want the machine to have different screen sizes than
307 the ones natively offered by the virtual graphics card. The example below is
308 for the qemu vmware graphics card, which uses
309 <xref linkend="xorg-vmware-driver"/> and is set to give the maximum screen size
310 of 1600x900. As the <systemitem class="username">root</systemitem> user,
311 issue the following:</para>
312
313<screen role="root"><userinput>cat &gt; /usr/share/X11/xorg.conf.d/20-vmware.conf &lt;&lt; "EOF"
314<literal>Section "Monitor"
315 Identifier "Monitor0"
316 # cvt 1600 900
317 # 1600x900 59.95 Hz (CVT 1.44M9) hsync:55.99 kHz; pclk: 118.25 MHz
318 Modeline "1600x900" 118.25 1600 1696 1856 2112 900 903 908 934 -hysnc +vsync
319 Option "PreferredMode" "1600x900"
320 HorizSync 1-200
321 VertRefresh 1-200
322EndSection
323
324Section "Device"
325 Identifier "VMWare SVGA II Adapter"
326 Option "Monitor" "Default"
327 Driver "vmware"
328EndSection
329
330Section "Screen"
331 Identifier "Default Screen"
332 Device "VMWare SVGA II Adapter"
333 Monitor "Monitor0"
334
335 SubSection "Display"
336 Depth 24
337 Modes "1600x900" "1440x900" "1366x768" "1280x720" "800x480"
338 EndSubSection
339EndSection </literal>
340EOF </userinput></screen>
341
342 <para>New sizes will be available besides the native ones. You need to
343 restart X in order to have the new sizes available.</para>
344
345 <para><!--To add networking to the instance add "-net nic -net user" to the
346 command above.--> qemu provides a DHCP server for the VM and, depending on
347 the client system, sets up networking though the host.</para>
348
349 <para>One problem with the above networking solution is that it does not
350 provide the ability to connect with the local network. To do that, there are
351 several additional steps that need to be done, all as the <systemitem
352 class="username">root</systemitem> user:</para>
353
354 <itemizedlist spacing="compact">
355 <listitem>
356 <para>Set up bridging using <xref linkend="bridgeutils"/>.</para>
357 </listitem>
358
359 <listitem>
360 <para>Allow the host system to forward IP packets.</para>
361
362<screen role="root"><userinput>sysctl -w net.ipv4.ip_forward=1</userinput></screen>
363
364 <para>To make this permanent, add the command to
365 <filename>/etc/sysctl.d/60-net-forward.conf:</filename></para>
366
367<screen role="root"><userinput>cat &gt;&gt; /etc/sysctl.d/60-net-forward.conf &lt;&lt; "EOF"
368net.ipv4.ip_forward=1
369EOF</userinput></screen>
370
371 </listitem>
372
373 <listitem>
374 <para>Allow the network connection when running as a part of the
375 kvm group:</para>
376
377<screen role="root"><userinput>chgrp kvm /usr/libexec/qemu-bridge-helper &amp;&amp;
378chmod 4750 /usr/libexec/qemu-bridge-helper</userinput></screen>
379
380 </listitem>
381
382 <listitem>
383 <para>Set up a required configuration file:</para>
384
385<screen role="root"><userinput>echo 'allow br0' &gt; /etc/qemu/bridge.conf</userinput></screen>
386
387 </listitem>
388
389<!--
390 <listitem>
391 <para>Create scripts for qemu to attach the client network
392 device, usually visible as tap0, to the host bridge.</para>
393
394<screen role="root"><userinput>cat &gt; /etc/qemu-ifup &lt;&lt; "EOF"
395#!/bin/bash
396
397switch=br0
398
399if [ -n "$1" ]; then
400 # Add new tap0 interface to bridge
401 /usr/sbin/brctl addif $switch $1
402else
403 echo "Error: no interface specified"
404 exit 1
405fi
406
407exit 0
408EOF
409
410chmod +x /etc/qemu-ifup</userinput></screen>
411
412<screen role="root"><userinput>cat &gt; /etc/qemu-ifdown &lt;&lt; "EOF"
413#!/bin/bash
414
415switch=br0
416
417if [ -n "$1" ]; then
418 # Remove tap0 interface from bridge
419 /usr/sbin/brctl delif $switch $1
420else
421 echo "Error: no interface specified"
422 exit 1
423fi
424
425exit 0
426EOF
427
428chmod +x /etc/qemu-ifdown</userinput></screen>
429
430 </listitem>
431 </itemizedlist>
432
433 <note><para>The backslashes in the above script are for convenience
434 for cut/paste operations. The backslashes should <emphasis>not</emphasis>
435 appear in the final scripts.</para></note>
436
437 <itemizedlist spacing="compact"> -->
438 <listitem>
439 <!--<para>Start qemu with "-net nic -net tap" options. </para>-->
440 <para>Start qemu with "-net nic -net bridge" options. </para>
441 </listitem>
442
443 <listitem>
444 <para>If a connection, such as ssh, from the local network to the
445 client VM is desired, the client should be configured
446 with a static IP address.</para>
447 </listitem>
448
449 </itemizedlist>
450
451 </sect2>
452
453 <sect2 role="content">
454 <title>Contents</title>
455
456 <segmentedlist>
457 <segtitle>Installed Programs</segtitle>
458 <segtitle>Installed Library</segtitle>
459 <segtitle>Installed Directories</segtitle>
460
461 <seglistitem>
462 <seg>
463 ivshmem-client,
464 ivshmem-server,
465 qemu (symlink),
466 qemu-ga,
467 qemu-img,
468 qemu-io,
469 qemu-nbd,
470 qemu-system-&lt;arch&gt;,
471 virtfs-proxy-helper, and
472 vscclient
473 </seg>
474 <seg>libcacard.so</seg>
475 <seg>
476 /etc/qemu, and
477 /usr/share/doc/qemu-&qemu-version;
478 </seg>
479 </seglistitem>
480 </segmentedlist>
481
482 <variablelist>
483 <bridgehead renderas="sect3">Short Description</bridgehead>
484 <?dbfo list-presentation="list"?>
485 <?dbhtml list-presentation="table"?>
486
487 <varlistentry id="qemu-ga">
488 <term><command>qemu-ga</command></term>
489 <listitem>
490 <para>implements support for QMP (QEMU Monitor Protocol) commands and
491 events that terminate and originate respectively within the guest
492 using an agent built as part of QEMU.</para>
493 <indexterm zone="qemu qemu-ga">
494 <primary sortas="b-qemu-ga">qemu-ga</primary>
495 </indexterm>
496 </listitem>
497 </varlistentry>
498
499 <varlistentry id="qemu-img">
500 <term><command>qemu-img</command></term>
501 <listitem>
502 <para>provides commands to manage QEMU disk images.</para>
503 <indexterm zone="qemu qemu-img">
504 <primary sortas="b-qemu-img">qemu-img</primary>
505 </indexterm>
506 </listitem>
507 </varlistentry>
508
509 <varlistentry id="qemu-io">
510 <term><command>qemu-io</command></term>
511 <listitem>
512 <para>is a diagnostic and manipulation program for (virtual) memory
513 media. It is still at an early stage of development.</para>
514 <indexterm zone="qemu qemu-io">
515 <primary sortas="b-qemu-io">qemu-io</primary>
516 </indexterm>
517 </listitem>
518 </varlistentry>
519
520 <varlistentry id="qemu-nbd">
521 <term><command>qemu-nbd</command></term>
522 <listitem>
523 <para>exports Qemu disk images using the QEMU Disk Network Block
524 Device (NBD) protocol.</para>
525 <indexterm zone="qemu qemu-nbd">
526 <primary sortas="b-qemu-nbd">qemu-nbd</primary>
527 </indexterm>
528 </listitem>
529 </varlistentry>
530
531 <varlistentry id="qemu-system">
532 <term><command>qemu-system-x86_64</command></term>
533 <listitem>
534 <para>is the QEMU PC System emulator.</para>
535 <indexterm zone="qemu qemu-system">
536 <primary sortas="b-qemu-system">qemu-system-x86_64</primary>
537 </indexterm>
538 </listitem>
539 </varlistentry>
540
541 <varlistentry id="virtfs-proxy-helper">
542 <term><command>virtfs-proxy-helper</command></term>
543 <listitem>
544 <para>creates a socket pair or a named socket. QEMU and proxy helper
545 communicate using this socket. QEMU proxy fs driver sends
546 filesystem request to proxy helper and receives the response
547 from it.</para>
548 <indexterm zone="qemu virtfs-proxy-helper">
549 <primary sortas="b-virtfs-proxy-helper">virtfs-proxy-helper</primary>
550 </indexterm>
551 </listitem>
552 </varlistentry>
553
554 <varlistentry id="vscclient">
555 <term><command>vscclient</command></term>
556 <listitem>
557 <para>implements a sockets interface to the virtual CCID reader
558 on the guest.</para>
559 <indexterm zone="qemu vscclient">
560 <primary sortas="b-vscclient">vscclient</primary>
561 </indexterm>
562 </listitem>
563 </varlistentry>
564
565 <varlistentry id="libcacard">
566 <term><filename class="libraryfile">libcacard.so</filename></term>
567 <listitem>
568 <para>is the Virtual Smart Card Emulator library.</para>
569 <indexterm zone="qemu libcacard">
570 <primary sortas="c-libcacard">libcacard.so</primary>
571 </indexterm>
572 </listitem>
573 </varlistentry>
574
575 </variablelist>
576
577 </sect2>
578
579</sect1>
Note: See TracBrowser for help on using the repository browser.