~kim0/serverguide/serverguide-review-ch19

« back to all changes in this revision

Viewing changes to build/serverguide/C/libvirt.html

  • Committer: Matthew East
  • Date: 2011-05-03 07:11:18 UTC
  • Revision ID: mdke@ubuntu.com-20110503071118-081aatibsr9k2yqy
Add files from ubuntu-docs natty branch, trim to use only those necessary for serverguide

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
 
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
3
<html xmlns="http://www.w3.org/1999/xhtml">
 
4
  <head xmlns="http://www.w3.org/1999/xhtml">
 
5
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 
6
    <title xmlns="">libvirt</title>
 
7
    <link rel="stylesheet" href="../../libs/ubuntu-book.css" type="text/css" />
 
8
    <link rel="home" href="index.html" title="Ubuntu Server Guide" />
 
9
    <link rel="up" href="virtualization.html" title="Chapter 19. Virtualization" />
 
10
    <link rel="prev" href="virtualization.html" title="Chapter 19. Virtualization" />
 
11
    <link rel="next" href="jeos-and-vmbuilder.html" title="JeOS and vmbuilder" />
 
12
    <link rel="copyright" href="legal.html" title="Credits and License" />
 
13
  </head>
 
14
  <body>
 
15
    <div id="round">
 
16
      <img id="topcap" alt="" src="https://help.ubuntu.com/htdocs/ubuntunew/img/cap-top.png" />
 
17
      <div id="layout" class="container clear-block">
 
18
        <script xmlns="" src="https://ssl.google-analytics.com/urchin.js" type="text/javascript"></script>
 
19
        <script xmlns="" type="text/javascript">
 
20
_uacct = "UA-1018242-8";
 
21
urchinTracker();
 
22
</script>
 
23
        <div id="header">
 
24
          <div id="logo-floater">
 
25
            <h1>
 
26
              <a href="https://help.ubuntu.com" title="Ubuntu Documentation">
 
27
                <img alt="Ubuntu" id="logo" src="https://help.ubuntu.com/htdocs/ubuntunew/img/logo.png" />
 
28
              </a>
 
29
            </h1>
 
30
          </div>
 
31
          <noscript>
 
32
            <form action="http://www.google.com/cse" id="cse-search-box">
 
33
              <div>
 
34
                <input type="hidden" name="cx" value="003883529982892832976:e2vwumte3fq" />
 
35
                <input type="hidden" name="ie" value="UTF-8" />
 
36
                <input type="text" name="q" size="27" />
 
37
                <input type="submit" name="sa" value="Search" />
 
38
              </div>
 
39
            </form>
 
40
          </noscript>
 
41
          <script>
 
42
 document.write('<form action="https://help.ubuntu.com/search.html" id="cse-search-box">');
 
43
 document.write('  <div>');
 
44
 document.write('    <input type="hidden" name="cof" value="FORID:9" />');
 
45
 document.write('    <input type="hidden" name="cx" value="003883529982892832976:e2vwumte3fq" />');
 
46
 document.write('    <input type="hidden" name="ie" value="UTF-8" />');
 
47
 document.write('    <input type="text" name="q" size="27" />');
 
48
 document.write('    <input type="submit" name="sa" value="Search" />');
 
49
 document.write('  </div>');
 
50
 document.write('</form>');
 
51
</script>
 
52
          <div id="sitename">
 
53
            <a href="https://help.ubuntu.com/">
 
54
              <img alt="Official Documentation" src="https://help.ubuntu.com/htdocs/ubuntunew/img/help-about.png" />
 
55
              <span>Official Documentation</span>
 
56
            </a>
 
57
          </div>
 
58
        </div>
 
59
        <div id="page">
 
60
          <div id="content">
 
61
            <div class="breadcrumbs"><a href="https://help.ubuntu.com/">Ubuntu Documentation</a> &gt; <a href="https://help.ubuntu.com/11.04">Ubuntu 11.04</a> &gt; <span class="breadcrumb-link"><a href="index.html">Ubuntu Server Guide</a></span> &gt; <span class="breadcrumb-link"><a href="virtualization.html">Virtualization</a></span> &gt; <span class="breadcrumb-node">libvirt</span></div>
 
62
            <div xmlns="http://www.w3.org/1999/xhtml" class="sect1" title="libvirt">
 
63
              <div class="titlepage">
 
64
                <div>
 
65
                  <div>
 
66
                    <h2 class="title" style="clear: both"><a id="libvirt"></a>libvirt</h2>
 
67
                  </div>
 
68
                </div>
 
69
              </div>
 
70
              <p>
 
71
    The <span class="application"><strong>libvirt</strong></span> library is used to interface with different
 
72
    virtualization technologies.  
 
73
    Before getting started with <span class="application"><strong>libvirt</strong></span> it is best to make sure your hardware supports the necessary 
 
74
    virtualization extensions for <span class="application"><strong>KVM</strong></span>.  Enter the following from a terminal prompt:
 
75
    </p>
 
76
              <pre class="screen">
 
77
<span class="command"><strong>kvm-ok</strong></span>
 
78
</pre>
 
79
              <p>
 
80
    A message will be printed informing you if your CPU <span class="emphasis"><em>does</em></span> or <span class="emphasis"><em>does not</em></span> support hardware virtualization.
 
81
    </p>
 
82
              <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
 
83
                <table border="0" summary="Note">
 
84
                  <tr>
 
85
                    <td rowspan="2" align="center" valign="top" width="25">
 
86
                      <img alt="[Note]" src="../../libs/admon/note.png" />
 
87
                    </td>
 
88
                    <th align="left"></th>
 
89
                  </tr>
 
90
                  <tr>
 
91
                    <td align="left" valign="top">
 
92
                      <p>
 
93
      On most computer whose processor supports virtualization, it is
 
94
      necessary to activate an option in the BIOS to enable it. 
 
95
      </p>
 
96
                    </td>
 
97
                  </tr>
 
98
                </table>
 
99
              </div>
 
100
              <div class="sect2" title="Virtual Networking">
 
101
                <div class="titlepage">
 
102
                  <div>
 
103
                    <div>
 
104
                      <h3 class="title"><a id="virtual-networking"></a>Virtual Networking</h3>
 
105
                    </div>
 
106
                  </div>
 
107
                </div>
 
108
                <p>
 
109
      There are a few different ways to allow a virtual machine access to the external network.  The default virtual network configuration is 
 
110
      <span class="emphasis"><em>usermode</em></span> networking, which uses the SLIRP protocol and traffic is NATed through the host interface to the outside network.
 
111
      </p>
 
112
                <p>
 
113
      To enable external hosts to directly access services on virtual machines a <span class="emphasis"><em>bridge</em></span> needs to be configured.  This allows
 
114
      the virtual interfaces to connect to the outside network through the physical interface, making them appear as normal hosts to the rest 
 
115
      of the network. For information on setting up a bridge see <a class="xref" href="network-configuration.html#bridging" title="Bridging">the section called “Bridging”</a>.
 
116
      </p>
 
117
              </div>
 
118
              <div class="sect2" title="Installation">
 
119
                <div class="titlepage">
 
120
                  <div>
 
121
                    <div>
 
122
                      <h3 class="title"><a id="libvirt-installation"></a>Installation</h3>
 
123
                    </div>
 
124
                  </div>
 
125
                </div>
 
126
                <p>
 
127
      To install the necessary packages, from a terminal prompt enter:
 
128
      </p>
 
129
                <pre class="screen">
 
130
<span class="command"><strong>sudo apt-get install kvm libvirt-bin</strong></span>
 
131
</pre>
 
132
                <p>
 
133
      After installing <span class="application"><strong>libvirt-bin</strong></span>, the user used to manage virtual machines will need to be added to 
 
134
      the <span class="emphasis"><em>libvirtd</em></span> group.  Doing so will grant the user access to the advanced networking options.  
 
135
      </p>
 
136
                <p>
 
137
      In a terminal enter:
 
138
      </p>
 
139
                <pre class="screen">
 
140
<span class="command"><strong>sudo adduser $USER libvirtd</strong></span>
 
141
</pre>
 
142
                <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
 
143
                  <table border="0" summary="Note">
 
144
                    <tr>
 
145
                      <td rowspan="2" align="center" valign="top" width="25">
 
146
                        <img alt="[Note]" src="../../libs/admon/note.png" />
 
147
                      </td>
 
148
                      <th align="left"></th>
 
149
                    </tr>
 
150
                    <tr>
 
151
                      <td align="left" valign="top">
 
152
                        <p>
 
153
        If the user chosen is the current user, you will need to log out and back in for the new group membership to take effect.
 
154
        </p>
 
155
                      </td>
 
156
                    </tr>
 
157
                  </table>
 
158
                </div>
 
159
                <p>
 
160
      You are now ready to install a <span class="emphasis"><em>Guest</em></span> operating system.  Installing a virtual machine follows the same
 
161
      process as installing the operating system directly on the hardware.  You either need a way to automate the installation, or 
 
162
      a keyboard and monitor will need to be attached to the physical machine.  
 
163
      </p>
 
164
                <p>
 
165
      In the case of virtual machines a Graphical User Interface (GUI) is analogous to using a physical keyboard and mouse.  Instead of installing
 
166
      a GUI the <span class="application"><strong>virt-viewer</strong></span> application can be used to connect to a virtual machine's console using <span class="application"><strong>VNC</strong></span>.  
 
167
      See <a class="xref" href="libvirt.html#libvirt-virt-viewer" title="Virtual Machine Viewer">the section called “Virtual Machine Viewer”</a> for more information.
 
168
      </p>
 
169
                <p>
 
170
      There are several ways to automate the Ubuntu installation process, for example using 
 
171
      preseeds, kickstart, etc.  Refer to the <a class="ulink" href="https://help.ubuntu.com/11.04/installation-guide/" target="_top">Ubuntu Installation Guide</a> for details.
 
172
      </p>
 
173
                <p>
 
174
      Yet another way to install an Ubuntu virtual machine is to use <span class="application"><strong>ubuntu-vm-builder</strong></span>.  <span class="application"><strong>ubuntu-vm-builder</strong></span> 
 
175
      allows you to setup advanced partitions, execute custom post-install scripts, etc.  For details see <a class="xref" href="jeos-and-vmbuilder.html" title="JeOS and vmbuilder">the section called “JeOS and vmbuilder”</a>
 
176
      </p>
 
177
              </div>
 
178
              <div class="sect2" title="virt-install">
 
179
                <div class="titlepage">
 
180
                  <div>
 
181
                    <div>
 
182
                      <h3 class="title"><a id="libvirt-virt-install"></a>virt-install</h3>
 
183
                    </div>
 
184
                  </div>
 
185
                </div>
 
186
                <p>
 
187
      <span class="application"><strong>virt-install</strong></span> is part of the <span class="application"><strong>virtinst</strong></span> package.  To install it, from a terminal prompt enter:
 
188
      </p>
 
189
                <pre class="screen">
 
190
<span class="command"><strong>sudo apt-get install virtinst</strong></span>
 
191
</pre>
 
192
                <p>
 
193
      There are several options available when using <span class="application"><strong>virt-install</strong></span>.  For example:
 
194
      </p>
 
195
                <pre class="screen">
 
196
<span class="command"><strong>sudo virt-install -n web_devel -r 256 \
 
197
--disk path=/var/lib/libvirt/images/web_devel.img,size=4 -c jeos.iso --accelerate \
 
198
--connect=qemu:///system --vnc \
 
199
--noautoconsole -v</strong></span>
 
200
</pre>
 
201
                <div class="itemizedlist">
 
202
                  <ul class="itemizedlist" type="disc">
 
203
                    <li class="listitem">
 
204
                      <p>
 
205
          <span class="emphasis"><em>-n web_devel:</em></span> the name of the new virtual machine will be <span class="emphasis"><em>web_devel</em></span> in this example.
 
206
          </p>
 
207
                    </li>
 
208
                    <li class="listitem">
 
209
                      <p>
 
210
          <span class="emphasis"><em>-r 256:</em></span> specifies the amount of memory the virtual machine will use in megabytes.
 
211
          </p>
 
212
                    </li>
 
213
                    <li class="listitem">
 
214
                      <p>
 
215
          <span class="emphasis"><em>--disk path=/var/lib/libvirt/images/web_devel.img,size=4:</em></span> indicates the path to the virtual disk 
 
216
          which can be a file, partition, or logical volume.  In this example a file named <code class="filename">web_devel.img</code> in the 
 
217
          /var/lib/libvirt/images/ directory with a size of 4 gigabytes.
 
218
          </p>
 
219
                    </li>
 
220
                    <li class="listitem">
 
221
                      <p>
 
222
          <span class="emphasis"><em>-c jeos.iso:</em></span> file to be used as a virtual CDROM.  The file can be either an ISO file or the path to the
 
223
          host's CDROM device.
 
224
          </p>
 
225
                    </li>
 
226
                    <li class="listitem">
 
227
                      <p>
 
228
          <span class="emphasis"><em>--accelerate:</em></span> enables the kernel's acceleration technologies. 
 
229
          </p>
 
230
                    </li>
 
231
                    <li class="listitem">
 
232
                      <p>
 
233
          <span class="emphasis"><em>--vnc:</em></span> exports the guest's virtual console using VNC. 
 
234
          </p>
 
235
                    </li>
 
236
                    <li class="listitem">
 
237
                      <p>
 
238
          <span class="emphasis"><em>--noautoconsole:</em></span> will not automatically connect to the virtual machine's console. 
 
239
          </p>
 
240
                    </li>
 
241
                    <li class="listitem">
 
242
                      <p>
 
243
          <span class="emphasis"><em>-v:</em></span> creates a fully virtualized guest. 
 
244
          </p>
 
245
                    </li>
 
246
                  </ul>
 
247
                </div>
 
248
                <p>
 
249
      After launching <span class="application"><strong>virt-install</strong></span> you can connect to the virtual machine's console either locally
 
250
      using a GUI or with the <span class="application"><strong>virt-viewer</strong></span> utility.
 
251
      </p>
 
252
              </div>
 
253
              <div class="sect2" title="virt-clone">
 
254
                <div class="titlepage">
 
255
                  <div>
 
256
                    <div>
 
257
                      <h3 class="title"><a id="libvirt-virt-clone"></a>virt-clone</h3>
 
258
                    </div>
 
259
                  </div>
 
260
                </div>
 
261
                <p>
 
262
      The <span class="application"><strong>virt-clone</strong></span> application can be used to copy one virtual machine to another.  For example:
 
263
      </p>
 
264
                <pre class="screen">
 
265
<span class="command"><strong>sudo virt-clone -o web_devel -n database_devel -f /path/to/database_devel.img --connect=qemu:///system</strong></span> 
 
266
</pre>
 
267
                <div class="itemizedlist">
 
268
                  <ul class="itemizedlist" type="disc">
 
269
                    <li class="listitem">
 
270
                      <p>
 
271
          <span class="emphasis"><em>-o:</em></span> original virtual machine.
 
272
          </p>
 
273
                    </li>
 
274
                    <li class="listitem">
 
275
                      <p>
 
276
          <span class="emphasis"><em>-n:</em></span> name of the new virtual machine.
 
277
          </p>
 
278
                    </li>
 
279
                    <li class="listitem">
 
280
                      <p>
 
281
          <span class="emphasis"><em>-f:</em></span> path to the file, logical volume, or partition to be used by the new virtual machine.
 
282
          </p>
 
283
                    </li>
 
284
                    <li class="listitem">
 
285
                      <p>
 
286
          <span class="emphasis"><em>--connect:</em></span> specifies which hypervisor to connect to.
 
287
          </p>
 
288
                    </li>
 
289
                  </ul>
 
290
                </div>
 
291
                <p>
 
292
      Also, use <span class="emphasis"><em>-d</em></span> or <span class="emphasis"><em>--debug</em></span> option to help troubleshoot problems with 
 
293
      <span class="application"><strong>virt-clone</strong></span>.
 
294
      </p>
 
295
                <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
 
296
                  <table border="0" summary="Note">
 
297
                    <tr>
 
298
                      <td rowspan="2" align="center" valign="top" width="25">
 
299
                        <img alt="[Note]" src="../../libs/admon/note.png" />
 
300
                      </td>
 
301
                      <th align="left"></th>
 
302
                    </tr>
 
303
                    <tr>
 
304
                      <td align="left" valign="top">
 
305
                        <p>
 
306
        Replace <span class="emphasis"><em>web_devel</em></span> and <span class="emphasis"><em>database_devel</em></span> with appropriate virtual machine names.
 
307
        </p>
 
308
                      </td>
 
309
                    </tr>
 
310
                  </table>
 
311
                </div>
 
312
              </div>
 
313
              <div class="sect2" title="Virtual Machine Management">
 
314
                <div class="titlepage">
 
315
                  <div>
 
316
                    <div>
 
317
                      <h3 class="title"><a id="libvirt-management"></a>Virtual Machine Management</h3>
 
318
                    </div>
 
319
                  </div>
 
320
                </div>
 
321
                <div class="sect3" title="virsh">
 
322
                  <div class="titlepage">
 
323
                    <div>
 
324
                      <div>
 
325
                        <h4 class="title"><a id="virsh"></a>virsh</h4>
 
326
                      </div>
 
327
                    </div>
 
328
                  </div>
 
329
                  <p>
 
330
        There are several utilities available to manage virtual machines and <span class="application"><strong>libvirt</strong></span>.  
 
331
        The <span class="application"><strong>virsh</strong></span> utility can be used from the command line.  Some examples: 
 
332
        </p>
 
333
                  <div class="itemizedlist">
 
334
                    <ul class="itemizedlist" type="disc">
 
335
                      <li class="listitem">
 
336
                        <p>
 
337
            To list running virtual machines:
 
338
            </p>
 
339
                        <pre class="screen">
 
340
<span class="command"><strong>virsh -c qemu:///system list</strong></span>
 
341
</pre>
 
342
                      </li>
 
343
                      <li class="listitem">
 
344
                        <p>
 
345
            To start a virtual machine:
 
346
            </p>
 
347
                        <pre class="screen">
 
348
<span class="command"><strong>virsh -c qemu:///system start web_devel</strong></span>
 
349
</pre>
 
350
                      </li>
 
351
                      <li class="listitem">
 
352
                        <p>
 
353
            Similarly, to start a virtual machine at boot:
 
354
            </p>
 
355
                        <pre class="screen">
 
356
<span class="command"><strong>virsh -c qemu:///system autostart web_devel</strong></span>
 
357
</pre>
 
358
                      </li>
 
359
                      <li class="listitem">
 
360
                        <p>
 
361
            Reboot a virtual machine with:
 
362
            </p>
 
363
                        <pre class="screen">
 
364
<span class="command"><strong>virsh -c qemu:///system reboot web_devel</strong></span>
 
365
</pre>
 
366
                      </li>
 
367
                      <li class="listitem">
 
368
                        <p>
 
369
            The <span class="emphasis"><em>state</em></span> of virtual machines can be saved to a file in order to be restored later.  The
 
370
            following will save the virtual machine state into a file named according to the date:
 
371
            </p>
 
372
                        <pre class="screen">
 
373
<span class="command"><strong>virsh -c qemu:///system save web_devel web_devel-022708.state</strong></span>
 
374
</pre>
 
375
                        <p>
 
376
            Once saved the virtual machine will no longer be running.
 
377
            </p>
 
378
                      </li>
 
379
                      <li class="listitem">
 
380
                        <p>
 
381
            A saved virtual machine can be restored using:
 
382
            </p>
 
383
                        <pre class="screen">
 
384
<span class="command"><strong>virsh -c qemu:///system restore web_devel-022708.state</strong></span>
 
385
</pre>
 
386
                      </li>
 
387
                      <li class="listitem">
 
388
                        <p>
 
389
            To shutdown a virtual machine do:
 
390
            </p>
 
391
                        <pre class="screen">
 
392
<span class="command"><strong>virsh -c qemu:///system shutdown web_devel</strong></span>
 
393
</pre>
 
394
                      </li>
 
395
                      <li class="listitem">
 
396
                        <p>
 
397
            A CDROM device can be mounted in a virtual machine by entering:
 
398
            </p>
 
399
                        <pre class="screen">
 
400
<span class="command"><strong>virsh -c qemu:///system attach-disk web_devel /dev/cdrom /media/cdrom</strong></span>
 
401
</pre>
 
402
                      </li>
 
403
                    </ul>
 
404
                  </div>
 
405
                  <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
 
406
                    <table border="0" summary="Note">
 
407
                      <tr>
 
408
                        <td rowspan="2" align="center" valign="top" width="25">
 
409
                          <img alt="[Note]" src="../../libs/admon/note.png" />
 
410
                        </td>
 
411
                        <th align="left"></th>
 
412
                      </tr>
 
413
                      <tr>
 
414
                        <td align="left" valign="top">
 
415
                          <p>
 
416
          In the above examples replace <span class="emphasis"><em>web_devel</em></span> with the appropriate virtual machine name, and 
 
417
          <code class="filename">web_devel-022708.state</code> with a descriptive file name.
 
418
          </p>
 
419
                        </td>
 
420
                      </tr>
 
421
                    </table>
 
422
                  </div>
 
423
                </div>
 
424
                <div class="sect3" title="Virtual Machine Manager">
 
425
                  <div class="titlepage">
 
426
                    <div>
 
427
                      <div>
 
428
                        <h4 class="title"><a id="virt-manager"></a>Virtual Machine Manager</h4>
 
429
                      </div>
 
430
                    </div>
 
431
                  </div>
 
432
                  <p>
 
433
        The <span class="application"><strong>virt-manager</strong></span> package contains a graphical utility to manage local and remote virtual machines.
 
434
        To install virt-manager enter:
 
435
        </p>
 
436
                  <pre class="screen">
 
437
<span class="command"><strong>sudo apt-get install virt-manager</strong></span>
 
438
</pre>
 
439
                  <p>
 
440
        Since <span class="application"><strong>virt-manager</strong></span> requires a Graphical User Interface (GUI) environment it is recommended to be 
 
441
        installed on a workstation or test machine instead of a production server.  To connect to the local 
 
442
        <span class="application"><strong>libvirt</strong></span> service enter:
 
443
        </p>
 
444
                  <pre class="screen">
 
445
<span class="command"><strong>virt-manager -c qemu:///system</strong></span>
 
446
</pre>
 
447
                  <p>
 
448
        You can connect to the <span class="application"><strong>libvirt</strong></span> service running on another host by entering the following in a terminal prompt:
 
449
        </p>
 
450
                  <pre class="screen">
 
451
<span class="command"><strong>virt-manager -c qemu+ssh://virtnode1.mydomain.com/system</strong></span>
 
452
</pre>
 
453
                  <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
 
454
                    <table border="0" summary="Note">
 
455
                      <tr>
 
456
                        <td rowspan="2" align="center" valign="top" width="25">
 
457
                          <img alt="[Note]" src="../../libs/admon/note.png" />
 
458
                        </td>
 
459
                        <th align="left"></th>
 
460
                      </tr>
 
461
                      <tr>
 
462
                        <td align="left" valign="top">
 
463
                          <p>
 
464
          The above example assumes that <span class="application"><strong>SSH</strong></span> connectivity between the management system and virtnode1.mydomain.com 
 
465
          has already been configured, and uses SSH keys for authentication.  SSH <span class="emphasis"><em>keys</em></span> are needed because 
 
466
          <span class="application"><strong>libvirt</strong></span> sends the password prompt to another process.  For details on configuring 
 
467
          <span class="application"><strong>SSH</strong></span> see <a class="xref" href="openssh-server.html" title="OpenSSH Server">the section called “OpenSSH Server”</a>
 
468
          </p>
 
469
                        </td>
 
470
                      </tr>
 
471
                    </table>
 
472
                  </div>
 
473
                </div>
 
474
              </div>
 
475
              <div class="sect2" title="Virtual Machine Viewer">
 
476
                <div class="titlepage">
 
477
                  <div>
 
478
                    <div>
 
479
                      <h3 class="title"><a id="libvirt-virt-viewer"></a>Virtual Machine Viewer</h3>
 
480
                    </div>
 
481
                  </div>
 
482
                </div>
 
483
                <p>
 
484
      The <span class="application"><strong>virt-viewer</strong></span> application allows you to connect to a virtual machine's console.  
 
485
      <span class="application"><strong>virt-viewer</strong></span> does require a Graphical User Interface (GUI) to interface with the virtual machine. 
 
486
      </p>
 
487
                <p>  
 
488
      To install <span class="application"><strong>virt-viewer</strong></span> from a terminal enter:
 
489
      </p>
 
490
                <pre class="screen">
 
491
<span class="command"><strong>sudo apt-get install virt-viewer</strong></span>
 
492
</pre>
 
493
                <p>
 
494
      Once a virtual machine is installed and running you can connect to the virtual machine's console by using:
 
495
      </p>
 
496
                <pre class="screen">
 
497
<span class="command"><strong>virt-viewer -c qemu:///system web_devel</strong></span>
 
498
</pre>
 
499
                <p>
 
500
      Similar to <span class="application"><strong>virt-manager</strong></span>, <span class="application"><strong>virt-viewer</strong></span> can connect to a remote host using 
 
501
      <span class="emphasis"><em>SSH</em></span> with key authentication, as well:
 
502
      </p>
 
503
                <pre class="screen">
 
504
<span class="command"><strong>virt-viewer -c qemu+ssh://virtnode1.mydomain.com/system web_devel</strong></span>
 
505
</pre>
 
506
                <p>
 
507
      Be sure to replace <span class="italic">web_devel</span> with the appropriate virtual machine name.
 
508
      </p>
 
509
                <p>
 
510
      If configured to use a <span class="emphasis"><em>bridged</em></span> network interface you can also setup <span class="application"><strong>SSH</strong></span> access
 
511
      to the virtual machine.  See <a class="xref" href="openssh-server.html" title="OpenSSH Server">the section called “OpenSSH Server”</a> and <a class="xref" href="network-configuration.html#bridging" title="Bridging">the section called “Bridging”</a> for more details.
 
512
      </p>
 
513
              </div>
 
514
              <div class="sect2" title="Resources">
 
515
                <div class="titlepage">
 
516
                  <div>
 
517
                    <div>
 
518
                      <h3 class="title"><a id="libvirt-resources"></a>Resources</h3>
 
519
                    </div>
 
520
                  </div>
 
521
                </div>
 
522
                <div class="itemizedlist">
 
523
                  <ul class="itemizedlist" type="disc">
 
524
                    <li class="listitem">
 
525
                      <p>
 
526
          See the <a class="ulink" href="http://kvm.qumranet.com/kvmwiki" target="_top">KVM</a> home page for more details.
 
527
          </p>
 
528
                    </li>
 
529
                    <li class="listitem">
 
530
                      <p>
 
531
          For more information on <span class="application"><strong>libvirt</strong></span> see the <a class="ulink" href="http://libvirt.org/" target="_top">libvirt home page</a> 
 
532
          </p>
 
533
                    </li>
 
534
                    <li class="listitem">
 
535
                      <p>
 
536
          The <a class="ulink" href="http://virt-manager.et.redhat.com/" target="_top">Virtual Machine Manager</a> site has more information on 
 
537
          <span class="application"><strong>virt-manager</strong></span> development.
 
538
          </p>
 
539
                    </li>
 
540
                    <li class="listitem">
 
541
                      <p>
 
542
          Also, stop by the <span class="emphasis"><em>#ubuntu-virt</em></span> IRC channel on <a class="ulink" href="http://freenode.net/" target="_top">freenode</a> to 
 
543
          discuss virtualization technology in Ubuntu.
 
544
          </p>
 
545
                    </li>
 
546
                    <li class="listitem">
 
547
                      <p>
 
548
          Another good resource is the <a class="ulink" href="https://help.ubuntu.com/community/KVM" target="_top">Ubuntu Wiki KVM</a> page.
 
549
          </p>
 
550
                    </li>
 
551
                  </ul>
 
552
                </div>
 
553
              </div>
 
554
            </div>
 
555
          </div>
 
556
          <div xmlns="http://www.w3.org/1999/xhtml" class="navfooter">
 
557
            <hr />
 
558
            <table width="100%" summary="Navigation footer">
 
559
              <tr>
 
560
                <td width="40%" align="left"><a accesskey="p" href="virtualization.html"><img src="../../libs/navig/prev.png" alt="Prev" /></a> </td>
 
561
                <td width="20%" align="center">
 
562
                  <a accesskey="u" href="virtualization.html">
 
563
                    <img src="../../libs/navig/up.png" alt="Up" />
 
564
                  </a>
 
565
                </td>
 
566
                <td width="40%" align="right"> <a accesskey="n" href="jeos-and-vmbuilder.html"><img src="../../libs/navig/next.png" alt="Next" /></a></td>
 
567
              </tr>
 
568
              <tr>
 
569
                <td width="40%" align="left" valign="top">Chapter 19. Virtualization </td>
 
570
                <td width="20%" align="center">
 
571
                  <a accesskey="h" href="index.html">
 
572
                    <img src="../../libs/navig/home.png" alt="Home" />
 
573
                  </a>
 
574
                </td>
 
575
                <td width="40%" align="right" valign="top"> JeOS and vmbuilder</td>
 
576
              </tr>
 
577
            </table>
 
578
          </div>
 
579
          <hr />
 
580
          <div id="footer">
 
581
            <div id="ubuntulinks">
 
582
              <p>The material in this document is available under a free license, see <a href="/legal.html">Legal</a> for details<br />
 
583
        For information on contributing see the <a href="https://wiki.ubuntu.com/DocumentationTeam">Ubuntu Documentation Team wiki page</a>. To report a problem, visit the <a href="https://bugs.launchpad.net/ubuntu/+source/ubuntu-docs">bug page for Ubuntu Documentation</a></p>
 
584
            </div>
 
585
          </div>
 
586
          <div id="bottomcap">
 
587
            <img src="https://help.ubuntu.com/htdocs/ubuntunew/img/cap-bottom.png" alt="" />
 
588
          </div>
 
589
        </div>
 
590
      </div>
 
591
    </div>
 
592
  </body>
 
593
</html>