source: postlfs/virtualization/qemu.xml@ f82ac3f

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 7.10 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 f82ac3f was f82ac3f, checked in by Bruce Dubbs <bdubbs@…>, 11 years ago

Archive unneeded packages

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