source: postlfs/virtualization/qemu-systemd.xml@ 54789f3

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

Update to LVM-2.02.420 (merged from trunk r16816).
Update to fuse-2.9.5 (merged from trunk r16814).
Update to gptfdisk-1.0.1 (merged from trunk r16553).
Update to xfsprogs-4.3.0 (merged from trunk r16376).
Update to JOE-4.1 (merged from trunk r16385).
Update to nano-2.5.1 (merged from trunk r16799).
Update to tcsh-6.19.00 (merged from trunk r16332).
Update to zsh-5.2 (merged from trunk r16706).
Update to qemu-2.5.0 (merged from trunk r16773).

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

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