source: postlfs/virtualization/qemu.xml@ 6f19a2c0

10.0 10.1 11.0 11.1 7.10 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 6f19a2c0 was 6f19a2c0, checked in by Bruce Dubbs <bdubbs@…>, 6 years ago

Update to qemu-2.6.0.
Update to gnome-themes-standard-3.20.2.

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

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