source: postlfs/virtualization/qemu.xml@ bfdd32ae

10.0 10.1 11.0 11.1 7.10 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind lazarus nosym perl-modules qt5new trunk upgradedb xry111/intltool xry111/test-20220226
Last change on this file since bfdd32ae was bfdd32ae, checked in by Bruce Dubbs <bdubbs@…>, 7 years ago

Update to stunnel-5.26.
Update to qemu-2.4.1.
Update to libassuan-2.4.0.
Update to xkbcomp-1.3.1.

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@16614 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 17.1 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 "a895e93ec1dafc34bc64ed676f0d55a6">
10 <!ENTITY qemu-size "24 MB">
11 <!ENTITY qemu-buildsize "303 MB (additional 91 MB for tests)">
12 <!ENTITY qemu-time "1.7 SBU (additional 1.0 SBU for 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 &lfs78_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="gtk2"/>,
82 <xref linkend="gtk3"/>,
83 <xref linkend="libusb"/>,
84 <xref linkend="lzo"/>,
85 <xref linkend="nss"/> (for libcacard.so),
86 <xref linkend="mesa"/>, and
87 <xref linkend="vte"/>
88 </para>
89
90 <note>
91 <para>
92 This optional dependencies list is not comprehensive. See the output of
93 <command>./configure --help</command> for a more complete list.
94 </para>
95 </note>
96
97 <para condition="html" role="usernotes">User Notes:
98 <ulink url="&blfs-wiki;/qemu"/></para>
99
100 </sect2>
101
102 <sect2 id='qemu-prereq'>
103 <title>KVM Prerequisites</title>
104
105 <para>Before building <application>qemu</application>, check to see if
106 your processor supports Virtualization Technology (VT):</para>
107
108 <screen><userinput>egrep '^flags.*(vmx|svm)' /proc/cpuinfo</userinput></screen>
109
110 <para>If you get any output, you have VT technology (vmx for Intel
111 processors and svm for AMD processors). You then need to go into your
112 system BIOS and ensure it is enabled. After enabing, reboot back to your
113 LFS instance.</para>
114
115 </sect2>
116
117 <sect2 role="kernel" id='qemu-kernel'>
118 <title>Kernel Configuration</title>
119
120 <para>Enable the following options in the kernel configuration and
121 recompile the kernel if necessary:</para>
122
123<screen><literal>[*] Virtualization: ---&gt; [CONFIG_VIRTUALIZATION]
124 &lt;*/M&gt; Kernel-based Virtual Machine (KVM) support [CONFIG_KVM]
125 &lt;*/M&gt; KVM for Intel processors support [CONFIG_KVM_INTEL]
126 &lt;*/M&gt; KVM for AMD processors support [CONFIG_KVM_AMD]</literal></screen>
127
128 <indexterm zone="qemu qemu-kernel">
129 <primary sortas="d-qemu">qemu</primary>
130 </indexterm>
131
132 <para>The Intel or AMD settings are not both required, but the one matching
133 your system processor is required.</para>
134
135 <para>For networking, check that <xref linkend='bridgeutils'/> is installed
136 and the following options in the kernel configuration are enabled:</para>
137
138<screen><literal>[*] Networking support ---&gt; [CONFIG_NET]
139 Networking options ---&gt;
140 &lt;*/M&gt; 802.1d Ethernet Bridging [CONFIG_BRIDGE]
141Device Drivers ---&gt;
142 [*] Network device support ---&gt; [CONFIG_NETDEVICES]
143 &lt;*/M&gt; Universal TUN/TAP device driver support [CONFIG_TUN]</literal></screen>
144
145 </sect2>
146
147 <sect2 role="installation">
148 <title>Installation of qemu</title>
149
150 <para>Install <application>qemu</application> by running the following
151 commands:</para>
152
153<screen><userinput>./configure --prefix=/usr \
154 --sysconfdir=/etc \
155 --libexecdir=/usr/lib/qemu \
156 $([ $(uname -m) = i686 ] &amp;&amp;
157 echo --target-list=i386-softmmu) \
158 $([ $(uname -m) = x86_64 ] &amp;&amp;
159 echo --target-list=x86_64-softmmu) \
160 --docdir=/usr/share/doc/qemu-&qemu-version; &amp;&amp;
161make</userinput></screen>
162
163 <para>To run the built in tests, run <command>make V=1 -k check</command>.
164 One test is known to fail.</para>
165
166 <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
167
168<screen role="root"><userinput>make install &amp;&amp;
169[ -e /usr/lib/libcacard.so ] &amp;&amp;
170chmod -v 755 /usr/lib/libcacard.so</userinput></screen>
171
172 <para>
173 You will need a dedicated group that will contain users (other than root)
174 allowed to access the KVM device. Create this group by running the
175 following command as the
176 <systemitem class="username">root</systemitem> user:
177 </para>
178
179<screen role="root"><userinput>groupadd -g 61 kvm</userinput></screen>
180
181 <para>
182 Add any users that might use the KVM device to that group:
183 </para>
184
185<screen role="root"><userinput>usermod -a -G kvm <replaceable>&lt;username&gt;</replaceable></userinput></screen>
186
187 <para>
188 You will also need to add a Udev rule so that the KVM device gets correct
189 permissions:
190 </para>
191
192<screen role="root"><userinput>cat > /lib/udev/rules.d/65-kvm.rules &lt;&lt; "EOF"
193<literal>KERNEL=="kvm", GROUP="kvm", MODE="0660"</literal>
194EOF</userinput></screen>
195
196 <note><!--<para>The main program <command>qemu-system-x86_64</command> doesn't
197 make a distinction between i386 and x86_64 so even on an i386 system you
198 should use <emphasis>qemu-system-x86_64</emphasis></para>
199 -->
200
201 <para>For convenience you may want to create a symbolic link to run
202 <command>qemu-system-x86_64</command>:</para>
203
204 <screen role="root"><userinput>ln -sv qemu-system-x86_64 /usr/bin/qemu</userinput></screen>
205 </note>
206
207 </sect2>
208
209 <sect2 role="commands">
210 <title>Command Explanations</title>
211
212 <para><parameter>$([ $(uname -m) = i686 ] &amp;&amp;
213 echo --target-list=i386-softmmu)</parameter>: This switch
214 tests and, if true, limits the build target to the i386 architecture. For
215 other hardware emulation see the --target-list list in
216 <command>configure</command>'s help output. Omitting the target option will
217 build all architectures.</para>
218
219 <para><parameter>$([ $(uname -m) = x86_64 ] &amp;&amp;
220 echo --target-list=x86_64-softmmu)</parameter>: This switch
221 tests and, if true, limits the build target to the x86_64 architecture. For
222 other hardware emulation see the --target-list list in
223 <command>configure</command>'s help output. Omitting the target option will
224 build all architectures.</para>
225
226 <para>
227 <option>--audio-drv-list=alsa</option>: This switch sets the audio driver
228 to ALSA. For other drivers see the --audio-drv-list list in
229 <command>configure</command>'s help output. The default audio driver is
230 OSS.
231 </para>
232
233 </sect2>
234
235 <sect2 role="configuration">
236 <title>Configuring qemu</title>
237
238 <para>To generate an image, run:</para>
239
240 <screen><userinput>qemu-img create -f qcow2 vdisk.img 10G</userinput></screen>
241
242 <para>Adjust the virtual disk size and image filename as desired. The
243 actual size of the file will be less than specified, but will expand as it
244 is used.</para>
245
246 <note><para>The following instructions assume you have created the optional
247 symbolic link, <userinput>qemu</userinput>. Additionally, you must run
248 <userinput>qemu</userinput> from an X Window System based terminal.</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 acceleration. 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>To add networking to the instance add "-net nic -net user" to the
276 command above. qemu provides a DHCP server for the VM and, depending on
277 the client system, sets up networking though the host.</para>
278
279 <para>One problem with the above networking solution is that it does not
280 provide the ability to connect with the local network. To do that, there are
281 several additional steps that need to be done, all as the <systemitem
282 class="username">root</systemitem> user:</para>
283
284 <itemizedlist spacing="compact">
285 <listitem>
286 <para>Set up bridging with <xref linkend='bridgeutils'/>.</para>
287 </listitem>
288
289 <listitem>
290 <para>Allow the host system to forward IP packets.</para>
291
292<screen role="root"><userinput>sysctl -w net.ipv4.ip_forward=1</userinput></screen>
293
294 <para>To make this permanent, add the command to
295 <filename>/etc/sysctl.conf:</filename></para>
296
297<screen role="root"><userinput>cat &gt;&gt; /etc/sysctl.conf &lt;&lt; EOF
298net.ipv4.ip_forward=1
299EOF</userinput></screen>
300
301 </listitem>
302
303 <listitem>
304 <para>Allow the network connection when running as a part of the
305 kvm group:</para>
306
307<screen role="root"><userinput>chgrp kvm /usr/libexec/qemu-bridge-helper &amp;&amp;
308chmod 4750 /usr/libexec/qemu-bridge-helper</userinput></screen>
309
310 </listitem>
311
312 <listitem>
313 <para>Set up a required configuration file:</para>
314
315<screen role="root"><userinput>echo 'allow br0' &gt; /etc/qemu/bridge.conf</userinput></screen>
316
317 </listitem>
318
319<!--
320 <listitem>
321 <para>Create scripts for qemu to attach the client network
322 device, usually visible as tap0, to the host bridge.</para>
323
324<screen role="root"><userinput>cat &gt; /etc/qemu-ifup &lt;&lt; EOF
325#!/bin/bash
326
327switch=br0
328
329if [ -n "\$1" ]; then
330 # Add new tap0 interface to bridge
331 /sbin/ip link set \$1 up
332 sleep 0.5s
333 /usr/sbin/brctl addif \$switch \$1
334else
335 echo "Error: no interface specified"
336 exit 1
337fi
338
339exit 0
340EOF
341
342chmod +x /etc/qemu-ifup</userinput></screen>
343
344<screen role="root"><userinput>cat &gt; /etc/qemu-ifdown &lt;&lt; EOF
345#!/bin/bash
346
347switch=br0
348
349if [ -n "\$1" ]; then
350 # Remove tap0 interface from bridge
351 /usr/sbin/brctl delif \$switch \$1
352else
353 echo "Error: no interface specified"
354 exit 1
355fi
356
357exit 0
358EOF
359
360chmod +x /etc/qemu-ifdown</userinput></screen>
361
362 </listitem>
363 </itemizedlist>
364
365 <note><para>The backslashes in the above script are for convenience
366 for cut/paste operations. The backslashes should <emphasis>not</emphasis>
367 appear in the final scripts.</para></note>
368
369 <itemizedlist spacing="compact"> -->
370 <listitem>
371 <!--<para>Start qemu with "-net nic -net tap" options. </para>-->
372 <para>Start qemu with "-net nic -net bridge" options. </para>
373 </listitem>
374
375 <listitem>
376 <para>If a connection, such as ssh, from the local network to the
377 client VM is desired, the client should be configured
378 with a static IP address.</para>
379 </listitem>
380
381 </itemizedlist>
382
383 </sect2>
384
385 <sect2 role="content">
386 <title>Contents</title>
387
388 <segmentedlist>
389 <segtitle>Installed Programs</segtitle>
390 <segtitle>Installed Library</segtitle>
391 <segtitle>Installed Directories</segtitle>
392
393 <seglistitem>
394 <seg>
395 qemu-ga,
396 qemu-img,
397 qemu-io,
398 qemu-nbd,
399 qemu-system-x86_64,
400 virtfs-proxy-helper, and
401 vscclient
402 </seg>
403 <seg>libcacard.so</seg>
404 <seg>
405 /etc/qemu,
406 /usr/include/cacard,
407 /usr/lib/qemu,
408 /usr/share/qemu, and
409 /usr/share/doc/qemu-&qemu-version;
410 </seg>
411 </seglistitem>
412 </segmentedlist>
413
414 <variablelist>
415 <bridgehead renderas="sect3">Short Description</bridgehead>
416 <?dbfo list-presentation="list"?>
417 <?dbhtml list-presentation="table"?>
418
419 <varlistentry id="qemu-ga">
420 <term><command>qemu-ga</command></term>
421 <listitem>
422 <para>implements support for QMP (QEMU Monitor Protocol) commands and
423 events that terminate and originate respectively within the guest
424 using an agent built as part of QEMU.</para>
425 <indexterm zone="qemu qemu-ga">
426 <primary sortas="b-qemu-ga">qemu-ga</primary>
427 </indexterm>
428 </listitem>
429 </varlistentry>
430
431 <varlistentry id="qemu-img">
432 <term><command>qemu-img</command></term>
433 <listitem>
434 <para>provides commands to manage QEMU disk images.</para>
435 <indexterm zone="qemu qemu-img">
436 <primary sortas="b-qemu-img">qemu-img</primary>
437 </indexterm>
438 </listitem>
439 </varlistentry>
440
441 <varlistentry id="qemu-io">
442 <term><command>qemu-io</command></term>
443 <listitem>
444 <para>is a diagnostic and manipulation program for (virtual) memory
445 media. It is still at an early stage of development.</para>
446 <indexterm zone="qemu qemu-io">
447 <primary sortas="b-qemu-io">qemu-io</primary>
448 </indexterm>
449 </listitem>
450 </varlistentry>
451
452 <varlistentry id="qemu-nbd">
453 <term><command>qemu-nbd</command></term>
454 <listitem>
455 <para>exports Qemu disk images using the QEMU Disk Network Block
456 Device (NBD) protocol.</para>
457 <indexterm zone="qemu qemu-nbd">
458 <primary sortas="b-qemu-nbd">qemu-nbd</primary>
459 </indexterm>
460 </listitem>
461 </varlistentry>
462
463 <varlistentry id="qemu-system">
464 <term><command>qemu-system-x86_64</command></term>
465 <listitem>
466 <para>is the QEMU PC System emulator.</para>
467 <indexterm zone="qemu qemu-system">
468 <primary sortas="b-qemu-system">qemu-system-x86_64</primary>
469 </indexterm>
470 </listitem>
471 </varlistentry>
472
473 <varlistentry id="virtfs-proxy-helper">
474 <term><command>virtfs-proxy-helper</command></term>
475 <listitem>
476 <para>creates a socket pair or a named socket. QEMU and proxy helper
477 communicate using this socket. QEMU proxy fs driver sends
478 filesystem request to proxy helper and receives the response
479 from it.</para>
480 <indexterm zone="qemu virtfs-proxy-helper">
481 <primary sortas="b-virtfs-proxy-helper">virtfs-proxy-helper</primary>
482 </indexterm>
483 </listitem>
484 </varlistentry>
485
486 <varlistentry id="vscclient">
487 <term><command>vscclient</command></term>
488 <listitem>
489 <para>implements a sockets interface to the virtual CCID reader
490 on the guest.</para>
491 <indexterm zone="qemu vscclient">
492 <primary sortas="b-vscclient">vscclient</primary>
493 </indexterm>
494 </listitem>
495 </varlistentry>
496
497 <varlistentry id="libcacard">
498 <term><filename class="libraryfile">libcacard.so</filename></term>
499 <listitem>
500 <para>is the Virtual Smart Card Emulator library.</para>
501 <indexterm zone="qemu libcacard">
502 <primary sortas="c-libcacard">libcacard.so</primary>
503 </indexterm>
504 </listitem>
505 </varlistentry>
506
507 </variablelist>
508
509 </sect2>
510
511</sect1>
Note: See TracBrowser for help on using the repository browser.