source: postlfs/virtualization/qemu-systemd.xml@ d654425

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

Update to gjs-1.43.3
Update to libsecret-0.18.3
Update to sqlite-3.8.11.1
Update to nss-3.19.3
Update to gsettings-desktop-schemas-3.16.1
Update to firefox-40.0.2
Added some short descriptions by Denis.

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

  • Property mode set to 100644
File size: 16.3 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 "2fab3ea4460de9b57192e5b8b311f221">
10 <!ENTITY qemu-size "24 MB">
11 <!ENTITY qemu-buildsize "291 MB">
12 <!ENTITY qemu-time "1.4 SBU">
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="gtk2"/>,
82 <xref linkend="gtk3"/>,
83 <xref linkend="libusb"/>,
84 <xref linkend="lzo"/>,
85 <xref linkend="nss"/> (for libcacard.so),
86 <xref linkend="mesalib"/>, 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 --docdir=/usr/share/doc/qemu-&qemu-version; \
156 --target-list=x86_64-softmmu &amp;&amp;
157make</userinput></screen>
158
159 <para>To run the built in tests, run <command>make V=1 check</command>.</para>
160
161 <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
162
163<screen role="root"><userinput>make install &amp;&amp;
164[ -e /usr/lib/libcacard.so ] &amp;&amp; chmod -v 755 /usr/lib/libcacard.so</userinput></screen>
165
166 <para>
167 You will need a dedicated group that will contain users (other than root)
168 allowed to access the KVM device. Create this group by running the following
169 command as the <systemitem class="username">root</systemitem> user:
170 </para>
171
172<screen role="root"><userinput>groupadd -g 61 kvm</userinput></screen>
173
174 <para>
175 Add any users that might use the KVM device to that group:
176 </para>
177
178<screen role="root"><userinput>usermod -a -G kvm <replaceable>&lt;username&gt;</replaceable></userinput></screen>
179
180 <para>
181 You will also need to add a Udev rule so that the KVM device gets correct
182 permissions:
183 </para>
184
185<screen role="root"><userinput>cat > /lib/udev/rules.d/65-kvm.rules &lt;&lt; "EOF"
186<literal>KERNEL=="kvm", GROUP="kvm", MODE="0660"</literal>
187EOF</userinput></screen>
188
189 <note><!--<para>The main program <command>qemu-system-x86_64</command> doesn't
190 make a distinction between i386 and x86_64 so even on an i386 system you
191 should use <emphasis>qemu-system-x86_64</emphasis></para>
192 -->
193
194 <para>For convenience you may want to create a symbolic link to run
195 <command>qemu-system-x86_64</command>:</para>
196
197 <screen role="root"><userinput>ln -sv qemu-system-x86_64 /usr/bin/qemu</userinput></screen>
198 </note>
199
200 </sect2>
201
202 <sect2 role="commands">
203 <title>Command Explanations</title>
204
205 <para><parameter>--target-list=x86_64-softmmu</parameter>: This switch
206 limits the build target to the x86_64 architecture. For other
207 hardware emulation see the --target-list list in <command>configure</command>'s
208 help output. Omitting this option will build all architectures.</para>
209
210 <para>
211 <option>--audio-drv-list=alsa</option>: This switch sets the audio driver
212 to ALSA. For other drivers see the --audio-drv-list list in
213 <command>configure</command>'s help output. The default audio driver is
214 OSS.
215 </para>
216
217 </sect2>
218
219 <sect2 role="configuration">
220 <title>Configuring qemu</title>
221
222 <para>To generate an image, run:</para>
223
224 <screen><userinput>qemu-img create -f qcow2 vdisk.img 10G</userinput></screen>
225
226 <para>Adjust the virtual disk size and image filename as desired. The
227 actual size of the file will be less than specified, but will expand as it
228 is used.</para>
229
230 <note><para>The following instructions assume you have created the optional
231 symbolic link, <userinput>qemu</userinput>. Additionally, you must run
232 <userinput>qemu</userinput> from an X Window System based terminal.</para></note>
233
234 <para>To install an operating system, download an iso of your choice or use
235 a pre-installed cdrom device. For the purposes of this example, use
236 Fedora 16 that is downloaded as
237 <filename>Fedora-16-x86_64-Live-LXDE.iso</filename> in the current
238 directory. Run the following:</para>
239
240<screen><userinput>qemu -enable-kvm -hda vdisk.img \
241 -cdrom Fedora-16-x86_64-Live-LXDE.iso \
242 -boot d \
243 -m 384</userinput></screen>
244
245 <para>Follow the normal installation procedures for the chosen
246 distribution. The -boot option specifies the boot order of drives as a
247 string of drive letters. Valid drive letters are: a, b (floppy 1 and 2), c
248 (first hard disk), d (first CD-ROM). The -m option is the amount of memory
249 to use for the virtual machine. If you have sufficient memory (2G or
250 more), 1G is a reasonable value. For computers with 512MB of RAM it's safe
251 to use -m 192, or even -m 128 (the default). The -enable-kvm option allows
252 for hardware acceleeration. Without this switch, the emulation is
253 relatively slow.</para>
254
255 <para>To run the newly installed operating system, run:</para>
256
257<screen><userinput>qemu -enable-kvm vdisk.img -m 384</userinput></screen>
258
259 <para>To add networking to the instance add "-net nic -net user" to the
260 command above. qemu provides a DHCP server for the VM and, depending on
261 the client system, sets up networking though the host.</para>
262
263 <para>One problem with the above networking solution is that it does not
264 provide the ability to connect with the local network. To do that, there are
265 several additional steps that need to be done, all as the <systemitem
266 class="username">root</systemitem> user:</para>
267
268 <itemizedlist spacing="compact">
269 <listitem>
270 <para>Set up bridging using <xref linkend="network-bridge"/>.</para>
271 </listitem>
272
273 <listitem>
274 <para>Allow the host system to forward IP packets.</para>
275
276<screen role="root"><userinput>sysctl -w net.ipv4.ip_forward=1</userinput></screen>
277
278 <para>To make this permanent, add the command to
279 <filename>/etc/sysctl.d/60-net-forward.conf:</filename></para>
280
281<screen role="root"><userinput>cat &gt;&gt; /etc/sysctl.d/60-net-forward.conf &lt;&lt; "EOF"
282net.ipv4.ip_forward=1
283EOF</userinput></screen>
284
285 </listitem>
286
287 <listitem>
288 <para>Allow the network connection when running as a part of the
289 kvm group:</para>
290
291<screen role="root"><userinput>chgrp kvm /usr/libexec/qemu-bridge-helper &amp;&amp;
292chmod 4750 /usr/libexec/qemu-bridge-helper</userinput></screen>
293
294 </listitem>
295
296 <listitem>
297 <para>Set up a required configuration file:</para>
298
299<screen role="root"><userinput>echo 'allow br0' &gt; /etc/qemu/bridge.conf</userinput></screen>
300
301 </listitem>
302
303<!--
304 <listitem>
305 <para>Create scripts for qemu to attach the client network
306 device, usually visible as tap0, to the host bridge.</para>
307
308<screen role="root"><userinput>cat &gt; /etc/qemu-ifup &lt;&lt; "EOF"
309#!/bin/bash
310
311switch=br0
312
313if [ -n "$1" ]; then
314 # Add new tap0 interface to bridge
315 /usr/sbin/brctl addif $switch $1
316else
317 echo "Error: no interface specified"
318 exit 1
319fi
320
321exit 0
322EOF
323
324chmod +x /etc/qemu-ifup</userinput></screen>
325
326<screen role="root"><userinput>cat &gt; /etc/qemu-ifdown &lt;&lt; "EOF"
327#!/bin/bash
328
329switch=br0
330
331if [ -n "$1" ]; then
332 # Remove tap0 interface from bridge
333 /usr/sbin/brctl delif $switch $1
334else
335 echo "Error: no interface specified"
336 exit 1
337fi
338
339exit 0
340EOF
341
342chmod +x /etc/qemu-ifdown</userinput></screen>
343
344 </listitem>
345 </itemizedlist>
346
347 <note><para>The backslashes in the above script are for convenience
348 for cut/paste operations. The backslashes should <emphasis>not</emphasis>
349 appear in the final scripts.</para></note>
350
351 <itemizedlist spacing="compact"> -->
352 <listitem>
353 <!--<para>Start qemu with "-net nic -net tap" options. </para>-->
354 <para>Start qemu with "-net nic -net bridge" options. </para>
355 </listitem>
356
357 <listitem>
358 <para>If a connection, such as ssh, from the local network to the
359 client VM is desired, the client should be configured
360 with a static IP address.</para>
361 </listitem>
362
363 </itemizedlist>
364
365 </sect2>
366
367 <sect2 role="content">
368 <title>Contents</title>
369
370 <segmentedlist>
371 <segtitle>Installed Programs</segtitle>
372 <segtitle>Installed Library</segtitle>
373 <segtitle>Installed Directories</segtitle>
374
375 <seglistitem>
376 <seg>
377 qemu-ga,
378 qemu-img,
379 qemu-io,
380 qemu-nbd,
381 qemu-system-x86_64,
382 virtfs-proxy-helper, and
383 vscclient
384 </seg>
385 <seg>libcacard.so</seg>
386 <seg>
387 /etc/qemu,
388 /usr/include/cacard,
389 /usr/lib/qemu,
390 /usr/share/qemu, and
391 /usr/share/doc/qemu-&qemu-version;
392 </seg>
393 </seglistitem>
394 </segmentedlist>
395
396 <variablelist>
397 <bridgehead renderas="sect3">Short Description</bridgehead>
398 <?dbfo list-presentation="list"?>
399 <?dbhtml list-presentation="table"?>
400
401 <varlistentry id="qemu-ga">
402 <term><command>qemu-ga</command></term>
403 <listitem>
404 <para>implements support for QMP (QEMU Monitor Protocol) commands and
405 events that terminate and originate respectively within the guest
406 using an agent built as part of QEMU.</para>
407 <indexterm zone="qemu qemu-ga">
408 <primary sortas="b-qemu-ga">qemu-ga</primary>
409 </indexterm>
410 </listitem>
411 </varlistentry>
412
413 <varlistentry id="qemu-img">
414 <term><command>qemu-img</command></term>
415 <listitem>
416 <para>provides commands to manage QEMU disk images.</para>
417 <indexterm zone="qemu qemu-img">
418 <primary sortas="b-qemu-img">qemu-img</primary>
419 </indexterm>
420 </listitem>
421 </varlistentry>
422
423 <varlistentry id="qemu-io">
424 <term><command>qemu-io</command></term>
425 <listitem>
426 <para>is a diagnostic and manipulation program for (virtual) memory
427 media. It is still at an early stage of development.</para>
428 <indexterm zone="qemu qemu-io">
429 <primary sortas="b-qemu-io">qemu-io</primary>
430 </indexterm>
431 </listitem>
432 </varlistentry>
433
434 <varlistentry id="qemu-nbd">
435 <term><command>qemu-nbd</command></term>
436 <listitem>
437 <para>exports Qemu disk images using the QEMU Disk Network Block
438 Device (NBD) protocol.</para>
439 <indexterm zone="qemu qemu-nbd">
440 <primary sortas="b-qemu-nbd">qemu-nbd</primary>
441 </indexterm>
442 </listitem>
443 </varlistentry>
444
445 <varlistentry id="qemu-system">
446 <term><command>qemu-system-x86_64</command></term>
447 <listitem>
448 <para>is the QEMU PC System emulator.</para>
449 <indexterm zone="qemu qemu-system">
450 <primary sortas="b-qemu-system">qemu-system-x86_64</primary>
451 </indexterm>
452 </listitem>
453 </varlistentry>
454
455 <varlistentry id="virtfs-proxy-helper">
456 <term><command>virtfs-proxy-helper</command></term>
457 <listitem>
458 <para>creates a socket pair or a named socket. QEMU and proxy helper
459 communicate using this socket. QEMU proxy fs driver sends
460 filesystem request to proxy helper and receives the response
461 from it.</para>
462 <indexterm zone="qemu virtfs-proxy-helper">
463 <primary sortas="b-virtfs-proxy-helper">virtfs-proxy-helper</primary>
464 </indexterm>
465 </listitem>
466 </varlistentry>
467
468 <varlistentry id="vscclient">
469 <term><command>vscclient</command></term>
470 <listitem>
471 <para>implements a sockets interface to the virtual CCID reader
472 on the guest.</para>
473 <indexterm zone="qemu vscclient">
474 <primary sortas="b-vscclient">vscclient</primary>
475 </indexterm>
476 </listitem>
477 </varlistentry>
478
479 <varlistentry id="libcacard">
480 <term><filename class="libraryfile">libcacard.so</filename></term>
481 <listitem>
482 <para>is the Virtual Smart Card Emulator library.</para>
483 <indexterm zone="qemu libcacard">
484 <primary sortas="c-libcacard">libcacard.so</primary>
485 </indexterm>
486 </listitem>
487 </varlistentry>
488
489 </variablelist>
490
491 </sect2>
492
493</sect1>
Note: See TracBrowser for help on using the repository browser.