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

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

Update to dhcpcd-6.11.0
Update to qemu-2.5.11
Update to gnutls
Above merged from trunk r17359
GCC6 tags

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/branches/systemd@17360 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 "f5ff0e71398b9e428b4f177001ba4285">
10 <!ENTITY qemu-size "24 MB">
11 <!ENTITY qemu-buildsize "442 MB (with tests)">
12 <!ENTITY qemu-time "2.9 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>
184 To run the built in tests, run <command>make V=1 check</command>.
185 </para>
186
187 <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
188
189<screen role="root"><userinput>make install</userinput></screen>
190
191 <para>
192 You will need a dedicated group that will contain users (other than root)
193 allowed to access the KVM device. Create this group by running the following
194 command as the <systemitem class="username">root</systemitem> user:
195 </para>
196
197<screen role="root"><userinput>groupadd -g 61 kvm</userinput></screen>
198
199 <para>
200 Add any users that might use the KVM device to that group:
201 </para>
202
203<screen role="root"><userinput>usermod -a -G kvm <replaceable>&lt;username&gt;</replaceable></userinput></screen>
204
205 <para>
206 You will also need to add a Udev rule so that the KVM device gets correct
207 permissions:
208 </para>
209
210<screen role="root"><userinput>cat > /lib/udev/rules.d/65-kvm.rules &lt;&lt; "EOF"
211<literal>KERNEL=="kvm", GROUP="kvm", MODE="0660"</literal>
212EOF</userinput></screen>
213
214 <note>
215 <para>For convenience you may want to create a symbolic link to run
216 The installed program. For instance:</para>
217
218<screen role="root"><userinput>ln -sv qemu-system-`uname -m` /usr/bin/qemu</userinput></screen>
219 </note>
220
221 </sect2>
222
223 <sect2 role="commands">
224 <title>Command Explanations</title>
225
226 <para>
227 <parameter>--audio-drv-list=alsa</parameter>: 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.
249 (either locally or over ssh).</para></note>
250
251 <para>To install an operating system, download an iso of your choice or use
252 a pre-installed cdrom device. For the purposes of this example, use
253 Fedora 16 that is downloaded as
254 <filename>Fedora-16-x86_64-Live-LXDE.iso</filename> in the current
255 directory. Run the following:</para>
256
257<screen><userinput>qemu -enable-kvm -hda vdisk.img \
258 -cdrom Fedora-16-x86_64-Live-LXDE.iso \
259 -boot d \
260 -m 384</userinput></screen>
261
262 <para>Follow the normal installation procedures for the chosen
263 distribution. The -boot option specifies the boot order of drives as a
264 string of drive letters. Valid drive letters are: a, b (floppy 1 and 2), c
265 (first hard disk), d (first CD-ROM). The -m option is the amount of memory
266 to use for the virtual machine. If you have sufficient memory (2G or
267 more), 1G is a reasonable value. For computers with 512MB of RAM it's safe
268 to use -m 192, or even -m 128 (the default). The -enable-kvm option allows
269 for hardware acceleeration. Without this switch, the emulation is
270 relatively slow.</para>
271
272 <para>To run the newly installed operating system, run:</para>
273
274<screen><userinput>qemu -enable-kvm vdisk.img -m 384</userinput></screen>
275
276 <para>You may have a problem with <parameter>--enable-kvm</parameter>. Also,
277 you may want to define audio and video drivers, the number of cpu cores, and
278 the number of threads. An alternative command to install the operating system is (see qemu
279 man page for parameters definitions):</para>
280
281<screen><userinput>qemu -enable-kvm \
282 -cdrom /home/fernando/ISO/linuxmint-17.1-mate-32bit.iso \
283 -boot order=d \
284 -m 1G,slots=3,maxmem=4G \
285 -machine smm=off \
286 -soundhw es1370 \
287 -cpu host \
288 -smp cores=4,threads=2 \
289 -vga std \
290 vdisk.img</userinput></screen>
291
292 <para>One parameter not appearing in the qemu man page is
293 <parameter>-machine smm=off</parameter>, and it used to allow
294 <parameter>-enable-kvm</parameter> in some systems. In order to run the
295 machine, you can alternatively issue:</para>
296
297<screen><userinput>qemu -enable-kvm \
298 -machine smm=off \
299 -boot order=d \
300 -m 1G,slots=3,maxmem=4G \
301 -soundhw es1370 \
302 -cpu host \
303 -smp cores=4,threads=2 \
304 -vga vmware \
305 -hda vdisk.img</userinput></screen>
306
307 <para>Sometimes, you want the machine to have different screen sizes than
308 the ones natively offered by the virtual graphics card. The example below is
309 for the qemu vmware graphics card, which uses
310 <xref linkend="xorg-vmware-driver"/> and is set to give the maximum screen size
311 of 1600x900. As the <systemitem class="username">root</systemitem> user,
312 issue the following:</para>
313
314<screen role="root"><userinput>cat &gt; /usr/share/X11/xorg.conf.d/20-vmware.conf &lt;&lt; "EOF"
315<literal>Section "Monitor"
316 Identifier "Monitor0"
317 # cvt 1600 900
318 # 1600x900 59.95 Hz (CVT 1.44M9) hsync:55.99 kHz; pclk: 118.25 MHz
319 Modeline "1600x900" 118.25 1600 1696 1856 2112 900 903 908 934 -hysnc +vsync
320 Option "PreferredMode" "1600x900"
321 HorizSync 1-200
322 VertRefresh 1-200
323EndSection
324
325Section "Device"
326 Identifier "VMWare SVGA II Adapter"
327 Option "Monitor" "Default"
328 Driver "vmware"
329EndSection
330
331Section "Screen"
332 Identifier "Default Screen"
333 Device "VMWare SVGA II Adapter"
334 Monitor "Monitor0"
335
336 SubSection "Display"
337 Depth 24
338 Modes "1600x900" "1440x900" "1366x768" "1280x720" "800x480"
339 EndSubSection
340EndSection </literal>
341EOF </userinput></screen>
342
343 <para>New sizes will be available besides the native ones. You need to
344 restart X in order to have the new sizes available.</para>
345
346 <para><!--To add networking to the instance add "-net nic -net user" to the
347 command above.--> qemu provides a DHCP server for the VM and, depending on
348 the client system, sets up networking though the host.</para>
349
350 <para>One problem with the above networking solution is that it does not
351 provide the ability to connect with the local network. To do that, there are
352 several additional steps that need to be done, all as the <systemitem
353 class="username">root</systemitem> user:</para>
354
355 <itemizedlist spacing="compact">
356 <listitem>
357 <para>Set up bridging using <xref linkend="bridgeutils"/>.</para>
358 </listitem>
359
360 <listitem>
361 <para>Allow the host system to forward IP packets.</para>
362
363<screen role="root"><userinput>sysctl -w net.ipv4.ip_forward=1</userinput></screen>
364
365 <para>To make this permanent, add the command to
366 <filename>/etc/sysctl.d/60-net-forward.conf:</filename></para>
367
368<screen role="root"><userinput>cat &gt;&gt; /etc/sysctl.d/60-net-forward.conf &lt;&lt; "EOF"
369net.ipv4.ip_forward=1
370EOF</userinput></screen>
371
372 </listitem>
373
374 <listitem>
375 <para>Allow the network connection when running as a part of the
376 kvm group:</para>
377
378<screen role="root"><userinput>chgrp kvm /usr/libexec/qemu-bridge-helper &amp;&amp;
379chmod 4750 /usr/libexec/qemu-bridge-helper</userinput></screen>
380
381 </listitem>
382
383 <listitem>
384 <para>Set up a required configuration file:</para>
385
386<screen role="root"><userinput>echo 'allow br0' &gt; /etc/qemu/bridge.conf</userinput></screen>
387
388 </listitem>
389
390<!--
391 <listitem>
392 <para>Create scripts for qemu to attach the client network
393 device, usually visible as tap0, to the host bridge.</para>
394
395<screen role="root"><userinput>cat &gt; /etc/qemu-ifup &lt;&lt; "EOF"
396#!/bin/bash
397
398switch=br0
399
400if [ -n "$1" ]; then
401 # Add new tap0 interface to bridge
402 /usr/sbin/brctl addif $switch $1
403else
404 echo "Error: no interface specified"
405 exit 1
406fi
407
408exit 0
409EOF
410
411chmod +x /etc/qemu-ifup</userinput></screen>
412
413<screen role="root"><userinput>cat &gt; /etc/qemu-ifdown &lt;&lt; "EOF"
414#!/bin/bash
415
416switch=br0
417
418if [ -n "$1" ]; then
419 # Remove tap0 interface from bridge
420 /usr/sbin/brctl delif $switch $1
421else
422 echo "Error: no interface specified"
423 exit 1
424fi
425
426exit 0
427EOF
428
429chmod +x /etc/qemu-ifdown</userinput></screen>
430
431 </listitem>
432 </itemizedlist>
433
434 <note><para>The backslashes in the above script are for convenience
435 for cut/paste operations. The backslashes should <emphasis>not</emphasis>
436 appear in the final scripts.</para></note>
437
438 <itemizedlist spacing="compact"> -->
439 <listitem>
440 <!--<para>Start qemu with "-net nic -net tap" options. </para>-->
441 <para>Start qemu with "-net nic -net bridge" options. </para>
442 </listitem>
443
444 <listitem>
445 <para>If a connection, such as ssh, from the local network to the
446 client VM is desired, the client should be configured
447 with a static IP address.</para>
448 </listitem>
449
450 </itemizedlist>
451
452 </sect2>
453
454 <sect2 role="content">
455 <title>Contents</title>
456
457 <segmentedlist>
458 <segtitle>Installed Programs</segtitle>
459 <segtitle>Installed Library</segtitle>
460 <segtitle>Installed Directories</segtitle>
461
462 <seglistitem>
463 <seg>
464 ivshmem-client,
465 ivshmem-server,
466 qemu (symlink),
467 qemu-ga,
468 qemu-img,
469 qemu-io,
470 qemu-nbd,
471 qemu-system-&lt;arch&gt;,
472 virtfs-proxy-helper, and
473 vscclient
474 </seg>
475 <seg>libcacard.so</seg>
476 <seg>
477 /etc/qemu, and
478 /usr/share/doc/qemu-&qemu-version;
479 </seg>
480 </seglistitem>
481 </segmentedlist>
482
483 <variablelist>
484 <bridgehead renderas="sect3">Short Description</bridgehead>
485 <?dbfo list-presentation="list"?>
486 <?dbhtml list-presentation="table"?>
487
488 <varlistentry id="qemu-ga">
489 <term><command>qemu-ga</command></term>
490 <listitem>
491 <para>implements support for QMP (QEMU Monitor Protocol) commands and
492 events that terminate and originate respectively within the guest
493 using an agent built as part of QEMU.</para>
494 <indexterm zone="qemu qemu-ga">
495 <primary sortas="b-qemu-ga">qemu-ga</primary>
496 </indexterm>
497 </listitem>
498 </varlistentry>
499
500 <varlistentry id="qemu-img">
501 <term><command>qemu-img</command></term>
502 <listitem>
503 <para>provides commands to manage QEMU disk images.</para>
504 <indexterm zone="qemu qemu-img">
505 <primary sortas="b-qemu-img">qemu-img</primary>
506 </indexterm>
507 </listitem>
508 </varlistentry>
509
510 <varlistentry id="qemu-io">
511 <term><command>qemu-io</command></term>
512 <listitem>
513 <para>is a diagnostic and manipulation program for (virtual) memory
514 media. It is still at an early stage of development.</para>
515 <indexterm zone="qemu qemu-io">
516 <primary sortas="b-qemu-io">qemu-io</primary>
517 </indexterm>
518 </listitem>
519 </varlistentry>
520
521 <varlistentry id="qemu-nbd">
522 <term><command>qemu-nbd</command></term>
523 <listitem>
524 <para>exports Qemu disk images using the QEMU Disk Network Block
525 Device (NBD) protocol.</para>
526 <indexterm zone="qemu qemu-nbd">
527 <primary sortas="b-qemu-nbd">qemu-nbd</primary>
528 </indexterm>
529 </listitem>
530 </varlistentry>
531
532 <varlistentry id="qemu-system">
533 <term><command>qemu-system-x86_64</command></term>
534 <listitem>
535 <para>is the QEMU PC System emulator.</para>
536 <indexterm zone="qemu qemu-system">
537 <primary sortas="b-qemu-system">qemu-system-x86_64</primary>
538 </indexterm>
539 </listitem>
540 </varlistentry>
541
542 <varlistentry id="virtfs-proxy-helper">
543 <term><command>virtfs-proxy-helper</command></term>
544 <listitem>
545 <para>creates a socket pair or a named socket. QEMU and proxy helper
546 communicate using this socket. QEMU proxy fs driver sends
547 filesystem request to proxy helper and receives the response
548 from it.</para>
549 <indexterm zone="qemu virtfs-proxy-helper">
550 <primary sortas="b-virtfs-proxy-helper">virtfs-proxy-helper</primary>
551 </indexterm>
552 </listitem>
553 </varlistentry>
554
555 <varlistentry id="vscclient">
556 <term><command>vscclient</command></term>
557 <listitem>
558 <para>implements a sockets interface to the virtual CCID reader
559 on the guest.</para>
560 <indexterm zone="qemu vscclient">
561 <primary sortas="b-vscclient">vscclient</primary>
562 </indexterm>
563 </listitem>
564 </varlistentry>
565
566 <varlistentry id="libcacard">
567 <term><filename class="libraryfile">libcacard.so</filename></term>
568 <listitem>
569 <para>is the Virtual Smart Card Emulator library.</para>
570 <indexterm zone="qemu libcacard">
571 <primary sortas="c-libcacard">libcacard.so</primary>
572 </indexterm>
573 </listitem>
574 </varlistentry>
575
576 </variablelist>
577
578 </sect2>
579
580</sect1>
Note: See TracBrowser for help on using the repository browser.