source: postlfs/virtualization/qemu.xml@ 54f740f

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 7.10 7.4 7.5 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gnome kde5-13430 kde5-14269 kde5-14686 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts krejzi/svn lazarus lxqt nosym perl-modules plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition systemd-11177 systemd-13485 trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since 54f740f was 54f740f, checked in by Igor Živković <igor@…>, 11 years ago

capitalization consistency and cleanup

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

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