source: postlfs/virtualization/qemu.xml@ a5070e6

systemd-11177
Last change on this file since a5070e6 was a5070e6, checked in by Krejzi <krejzi@…>, 11 years ago

Sync dev and systemd branches.

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

  • Property mode set to 100644
File size: 12.7 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 "b56e73bdcfdb214d5c68e13111aca96f">
10 <!ENTITY qemu-size "11.4 MB">
11 <!ENTITY qemu-buildsize "186 MB">
12 <!ENTITY qemu-time "2.0 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 &lfs73_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">Additional Downloads</bridgehead>
61 <itemizedlist spacing='compact'>
62 <listitem>
63 <para>Required Patch: <ulink
64 url="&patch-root;/qemu-&qemu-version;-fixes-1.patch"/></para>
65 </listitem>
66 </itemizedlist>
67-->
68 <bridgehead renderas="sect3">Qemu Dependencies</bridgehead>
69
70 <bridgehead renderas="sect4">Required</bridgehead>
71 <para role="required">
72 <xref linkend="glib2"/>,
73 <xref linkend="python2"/>,
74 <xref linkend="sdl"/>, and
75 <xref linkend="x-window-system"/>
76 </para>
77
78 <bridgehead renderas="sect4">Optional</bridgehead>
79 <para role="optional">
80 <xref linkend="alsa"/>,
81 <xref linkend="check"/>,
82 <xref linkend="curl"/>,
83 <xref linkend="esound"/>,
84 <xref linkend="mesalib"/>, and
85 <xref linkend="cyrus-sasl"/>.
86 Note that this optional dependencies list is not comprehensive. See the
87 output of <command>./configure --help</command> for a more complete list.
88 </para>
89
90 <para condition="html" role="usernotes">User Notes:
91 <ulink url="&blfs-wiki;/qemu"/></para>
92
93 </sect2>
94
95 <sect2 id='qemu-prereq'>
96 <title>KVM Prerequsites</title>
97
98 <para>Before building <application>qemu</application>, check to see if
99 your processor supports Virtualization Technology (VT):</para>
100
101 <screen><userinput>egrep '^flags.*(vmx|svm)' /proc/cpuinfo</userinput></screen>
102
103 <para>If you get any output, you have VT technology (vmx for Intel
104 processors and svm for AMD processors). You then need to go into your
105 system BIOS and ensure it is enabled. After enabing, reboot back to your
106 LFS instance.</para>
107
108 </sect2>
109
110 <sect2 role="kernel" id='qemu-kernel'>
111 <title>Kernel Configuration</title>
112
113 <para>Enable the following options in the kernel configuration
114 and recompile the kernel if necessary:</para>
115
116<screen><literal>Virtualization: Y
117 Kernel-based Virtual Machine (KVM) support: M or Y
118 KVM for Intel processors support: M or Y
119 KVM for AMD processors support: M or Y</literal></screen>
120
121 <indexterm zone="qemu qemu-kernel">
122 <primary sortas="d-qemu">qemu</primary>
123 </indexterm>
124
125 <para>The Intel or AMD settings are not both required, but the one matching
126 your system processor is required.</para>
127
128 <para>For networking, check that the settings CONFIG_BRIDGE, CONFIG_STP,
129 CONFIG_TUN are enabled and <xref linkend='bridgeutils'/> is
130 installed.</para>
131
132 </sect2>
133
134 <sect2 role="installation">
135 <title>Installation of qemu</title>
136
137 <para>If <application>xorg</application> is not installed in
138 <filename class='directory'>/usr</filename>, then the linker needs to
139 be told where it is. For example:</para>
140
141<screen><userinput>export LIBRARY_PATH=/opt/xorg/lib</userinput></screen>
142
143 <para>Install <application>qemu</application> by running the following
144 commands:</para>
145
146<screen><userinput>./configure --prefix=/usr \
147 --sysconfdir=/etc \
148 --target-list=x86_64-softmmu &amp;&amp;
149make</userinput></screen>
150
151 <para>To run the built in tests, run <command>make V=1 check</command>.</para>
152
153 <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
154
155<screen role="root"><userinput>make install</userinput></screen>
156
157 <note><!--<para>The main program <command>qemu-system-x86_64</command> doesn't
158 make a distinction between i386 and x86_64 so even on an i386 system you
159 should use <emphasis>qemu-system-x86_64</emphasis></para>
160 -->
161
162 <para>For convenience you may want to create a symbolic link to run
163 <command>qemu-system-x86_64</command>:</para>
164
165 <screen><userinput>ln -sv qemu-system-x86_64 /usr/bin/qemu</userinput></screen>
166 </note>
167
168 </sect2>
169
170 <sect2 role="commands">
171 <title>Command Explanations</title>
172
173 <para><parameter>--target-list=x86_64-softmmu</parameter>: This option
174 limits the build target to the x86_64 architecture. For other
175 hardware emulation see the --target-list list in <command>configure</command>'s
176 help output. Omitting this option will build all architectures.</para>
177
178 </sect2>
179
180
181
182 <sect2 role="configuration">
183 <title>Configuring qemu</title>
184
185 <para>To generate an image, run:</para>
186
187 <screen><userinput>qemu-img create -f qcow2 vdisk.img 10G</userinput></screen>
188
189 <para>Adjust the virtual disk size and image filename as desired. The
190 actual size of the file will be less than specified, but will expand as it
191 is used.</para>
192
193 <note><para>The following instructions assume you have created the optional
194 symbolic link, <userinput>qemu</userinput>. Additionally, you must run
195 <userinput>qemu</userinput> from an X-Windows based terminal.</para></note>
196
197 <para>To install an operating system, download an iso of your choice or use
198 a pre-intalled cdrom device. For the purposes of this example, use
199 Fedora 16 that is downloaded as
200 <filename>Fedora-16-x86_64-Live-LXDE.iso</filename> in the current
201 directory. Run the following:</para>
202
203<screen><userinput>qemu -enable-kvm -hda vdisk.img \
204 -cdrom Fedora-16-x86_64-Live-LXDE.iso \
205 -boot d \
206 -m 384</userinput></screen>
207
208 <para>Follow the normal installation procedures for the chosen
209 distribution. The -boot option specifies the boot order of drives as a
210 string of drive letters. Valid drive letters are: a, b (floppy 1 and 2), c
211 (first hard disk), d (first CD-ROM). The -m option is the amount of memory
212 to use for the virtual machine. If you have sufficient memory (2G or
213 more), 1G is a reasonable value. For computers with 512MB of RAM it's safe
214 to use -m 192, or even -m 128 (the default). The -enable-kvm option allows
215 for hardware acceleeration. Without this switch, the emulation is
216 relatively slow.</para>
217
218 <para>To run the newly installed operating system, run:</para>
219
220<screen><userinput>qemu -enable-kvm vdisk.img -m 384</userinput></screen>
221
222 <para>To add networking to the instance add "-net nic -net user" to the
223 command above. qemu provides a DHCP server for the VM and, depending on
224 the client system, sets up networking though the host.</para>
225
226 <para>One problem with the above networking solution is that it does not
227 provide the ability to connect with the local network. To do that, there are
228 several additional steps that need to be done, all as the <systemitem
229 class="username">root</systemitem> user:</para>
230
231 <itemizedlist spacing="compact">
232 <listitem>
233 <para>Set up bridging with <xref linkend='bridgeutils'/>.</para>
234 </listitem>
235
236 <listitem>
237 <para>Allow the host system to forward IP packets.</para>
238
239<screen><userinput>sysctl -w net.ipv4.ip_forward=1</userinput></screen>
240
241 <para>To make this permanent, add the command to
242 <filename>/etc/syssysctl.conf:</filename></para>
243
244<screen><userinput>cat &gt;&gt; /etc/sysctl.conf &lt;&lt; EOF
245net.ipv4.ip_forward=1
246EOF</userinput></screen>
247
248 </listitem>
249
250 <listitem>
251 <para>Create scripts for qemu to attach the client network
252 device, usually visible as tap0, to the host bridge.</para>
253
254<screen><userinput>cat &gt;&gt; /etc/qemu-ifup &lt;&lt; EOF
255#!/bin/bash
256
257switch=br0
258
259if [ -n "\$1" ]; then
260 # Add new tap0 interface to bridge
261 /sbin/ip link set \$1 up
262 sleep 0.5s
263 /usr/sbin/brctl addif \$switch \$1
264else
265 echo "Error: no interface specified"
266 exit 1
267fi
268
269exit 0
270EOF
271
272chmod +x /etc/qemu-ifup</userinput></screen>
273
274<screen><userinput>cat &gt;&gt; /etc/qemu-ifdown &lt;&lt; EOF
275#!/bin/bash
276
277switch=br0
278
279if [ -n "\$1" ]; then
280 # Remove tap0 interface from bridge
281 /usr/sbin/brctl delif \$switch \$1
282else
283 echo "Error: no interface specified"
284 exit 1
285fi
286
287exit 0
288EOF
289
290chmod +x /etc/qemu-ifdown</userinput></screen>
291
292 </listitem>
293 </itemizedlist>
294
295 <note><para>The backslashes in the abouve script are for convenience
296 for cut/paste operations. The backslashes should <emphasis>not</emphasis>
297 appear in the final scripts.</para></note>
298
299 <itemizedlist spacing="compact">
300 <listitem>
301 <para>Start qemu with "-net nic -net tap" options. </para>
302 </listitem>
303
304 <listitem>
305 <para>If a connection, such as ssh, from the local network to the
306 client VM is desired, the client should probably be configured
307 with a static IP address.</para>
308 </listitem>
309
310 </itemizedlist>
311
312 </sect2>
313
314 <sect2 role="content">
315 <title>Contents</title>
316
317 <segmentedlist>
318 <segtitle>Installed Program</segtitle>
319 <segtitle>Installed Libraries</segtitle>
320 <segtitle>Installed Directories</segtitle>
321
322 <seglistitem>
323 <seg>qemu-ga, qemu-img, qemu-io, qemu-nbd, qemu-system-x86_64</seg>
324 <seg>None</seg>
325 <seg>/etc/qemu, /usr/share/qemu, /usr/share/doc/qemu</seg>
326 </seglistitem>
327 </segmentedlist>
328
329 <variablelist>
330 <bridgehead renderas="sect3">Short Description</bridgehead>
331 <?dbfo list-presentation="list"?>
332 <?dbhtml list-presentation="table"?>
333
334 <varlistentry id="qemu-ga">
335 <term><command>qemu-ga</command></term>
336 <listitem>
337 <para>implements support for QMP (QEMU Monitor Protocol) commands and
338 events that terminate and originate respectively within the guest
339 using an agent built as part of QEMU.</para>
340 <indexterm zone="qemu qemu-ga">
341 <primary sortas="b-qemu-ga">qemu-ga</primary>
342 </indexterm>
343 </listitem>
344 </varlistentry>
345
346 <varlistentry id="qemu-img">
347 <term><command>qemu-img</command></term>
348 <listitem>
349 <para>provides commands to manage QEMU disk images.</para>
350 <indexterm zone="qemu qemu-img">
351 <primary sortas="b-qemu-img">qemu-img</primary>
352 </indexterm>
353 </listitem>
354 </varlistentry>
355
356 <varlistentry id="qemu-io">
357 <term><command>qemu-io</command></term>
358 <listitem>
359 <para>is a diagnostic and manipulation program for (virtual) memory
360 media. It is still at an early stage of development.</para>
361 <indexterm zone="qemu qemu-io">
362 <primary sortas="b-qemu-io">qemu-io</primary>
363 </indexterm>
364 </listitem>
365 </varlistentry>
366
367 <varlistentry id="qemu-nbd">
368 <term><command>qemu-nbd</command></term>
369 <listitem>
370 <para>exports Qemu disk images using the QEMU Disk Network Block
371 Device (NBD) protocol.</para>
372 <indexterm zone="qemu qemu-nbd">
373 <primary sortas="b-qemu-nbd">qemu-nbd</primary>
374 </indexterm>
375 </listitem>
376 </varlistentry>
377
378 <varlistentry id="qemu-system">
379 <term><command>qemu-system-x86_64</command></term>
380 <listitem>
381 <para>is the QEMU PC System emulator.</para>
382 <indexterm zone="qemu qemu-system">
383 <primary sortas="b-qemu-system">qemu-system-x86_64</primary>
384 </indexterm>
385 </listitem>
386 </varlistentry>
387
388 </variablelist>
389
390 </sect2>
391
392</sect1>
Note: See TracBrowser for help on using the repository browser.