<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.heepy.net/index.php?action=history&amp;feed=atom&amp;title=KVM_virtual_machines_in_ubuntu</id>
	<title>KVM virtual machines in ubuntu - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.heepy.net/index.php?action=history&amp;feed=atom&amp;title=KVM_virtual_machines_in_ubuntu"/>
	<link rel="alternate" type="text/html" href="https://www.heepy.net/index.php?title=KVM_virtual_machines_in_ubuntu&amp;action=history"/>
	<updated>2026-05-10T17:43:24Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.2</generator>
	<entry>
		<id>https://www.heepy.net/index.php?title=KVM_virtual_machines_in_ubuntu&amp;diff=109&amp;oldid=prev</id>
		<title>Morris at 22:35, 11 September 2009</title>
		<link rel="alternate" type="text/html" href="https://www.heepy.net/index.php?title=KVM_virtual_machines_in_ubuntu&amp;diff=109&amp;oldid=prev"/>
		<updated>2009-09-11T22:35:23Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Install the packages: &lt;br /&gt;
&lt;br /&gt;
 aptitude install ubuntu-virt-server virt-manager kvm python-vm-builder python-virtinst virt-viewer virt-top virt-goodies&lt;br /&gt;
&lt;br /&gt;
Make sure virtualization is enabled in host machine's BIOS; it usually isn't.&lt;br /&gt;
&lt;br /&gt;
If you don't want the default network config of a private network with a local dhcp server, get rid of libvirt's default nat setup:&lt;br /&gt;
&lt;br /&gt;
 virsh -c qemu:///system&lt;br /&gt;
 # net-destroy default&lt;br /&gt;
 # net-edit default&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use bridging to a local interface, make it look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;network&amp;gt;&lt;br /&gt;
  &amp;lt;name&amp;gt;default&amp;lt;/name&amp;gt;&lt;br /&gt;
  &amp;lt;uuid&amp;gt;18eb5edc-7b46-0f44-ac24-33028d540251&amp;lt;/uuid&amp;gt;&lt;br /&gt;
  &amp;lt;bridge name='virbr0' stp='on' forwardDelay='0' /&amp;gt;&lt;br /&gt;
&amp;lt;/network&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run (in virsh): &lt;br /&gt;
 # net-start default&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If there isn't a default storage pool defined already (I think the gui &amp;quot;virt-manager&amp;quot; will make one if it doesn't exist?) &lt;br /&gt;
you can import an xml configuration using &amp;quot;virsh pool-define whatever.xml&amp;quot; of which an example is here:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;pool type='dir'&amp;gt;&lt;br /&gt;
  &amp;lt;name&amp;gt;default&amp;lt;/name&amp;gt;&lt;br /&gt;
  &amp;lt;capacity&amp;gt;0&amp;lt;/capacity&amp;gt;&lt;br /&gt;
  &amp;lt;allocation&amp;gt;0&amp;lt;/allocation&amp;gt;&lt;br /&gt;
  &amp;lt;available&amp;gt;0&amp;lt;/available&amp;gt;&lt;br /&gt;
  &amp;lt;source&amp;gt;&lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
  &amp;lt;target&amp;gt;&lt;br /&gt;
    &amp;lt;path&amp;gt;/var/lib/libvirt/images&amp;lt;/path&amp;gt;&lt;br /&gt;
    &amp;lt;permissions&amp;gt;&lt;br /&gt;
      &amp;lt;mode&amp;gt;0700&amp;lt;/mode&amp;gt;&lt;br /&gt;
      &amp;lt;owner&amp;gt;0&amp;lt;/owner&amp;gt;&lt;br /&gt;
      &amp;lt;group&amp;gt;0&amp;lt;/group&amp;gt;&lt;br /&gt;
    &amp;lt;/permissions&amp;gt;&lt;br /&gt;
  &amp;lt;/target&amp;gt;&lt;br /&gt;
&amp;lt;/pool&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use the virt-manager gui to create a VM, or do it on the command &lt;br /&gt;
line with virt-install to have an initial configuration created for you.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# virt-install \&lt;br /&gt;
        --connect qemu:///system \&lt;br /&gt;
        -n testvm3 /&lt;br /&gt;
        -r 512 /&lt;br /&gt;
        --disk path=/var/lib/libvirt/images/testvm3.img,size=30 /&lt;br /&gt;
        --cdrom /home/eric/ubuntu-9.04-server-amd64.iso /&lt;br /&gt;
        --network bridge:br0 /&lt;br /&gt;
        --vnc /&lt;br /&gt;
        --accelerate --hvm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will try to spawn a console for the vm so you can do the install. You can &lt;br /&gt;
also manipulate configs and create new VMs directly with virsh commands. &lt;br /&gt;
&lt;br /&gt;
Dump the config of an existing vm: &lt;br /&gt;
&lt;br /&gt;
 virsh -c qemu:///system dumpxml testvm &amp;gt; testvm.xml&lt;br /&gt;
&lt;br /&gt;
edit testvm.xml to suit, for example, have it point to a disk image you've&lt;br /&gt;
already put in place, etc. Make sure to change name, vnc port, etc. If you&lt;br /&gt;
just remove the uuid definition, it will generate a new one for you.  Then, &lt;br /&gt;
&lt;br /&gt;
 virsh -c qemu:///system create testvm.xml&lt;br /&gt;
&lt;br /&gt;
This will configure, create, and start the new VM. &lt;br /&gt;
&lt;br /&gt;
To use existing disk with virt-install:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
virt-install --connect=qemu:///system --name blah --ram 256 --os-type=linux \&lt;br /&gt;
        --import --disk vol=default/blah.img ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Note:'''&lt;br /&gt;
The default network device emulation is rtl8139, which appears to not support vlan tags. &lt;br /&gt;
If you try to pass tagged packets through it, the host system will see your packets with&lt;br /&gt;
the tags stripped off. If you use e1000 emulation instead, by adding&lt;br /&gt;
 &amp;lt;model type='e1000'/&amp;gt;&lt;br /&gt;
to the &amp;quot;interface&amp;quot; section of the VM xml config, vlan tags will pass through to the host.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Incantations]]&lt;/div&gt;</summary>
		<author><name>Morris</name></author>
	</entry>
</feed>