<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="http://commons.oreilly.com/wiki/skins/common/feed.css?97"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>Ubuntu Hacks/Virtualization and Emulation - Revision history</title>
		<link>http://commons.oreilly.com/wiki/index.php?title=Ubuntu_Hacks/Virtualization_and_Emulation&amp;action=history</link>
		<description>Revision history for this page on the wiki</description>
		<language>en</language>
		<generator>MediaWiki 1.11.0</generator>
		<lastBuildDate>Tue, 18 Jun 2013 08:25:28 GMT</lastBuildDate>
		<item>
			<title>Docbook2Wiki: Initial conversion from Docbook</title>
			<link>http://commons.oreilly.com/wiki/index.php?title=Ubuntu_Hacks/Virtualization_and_Emulation&amp;diff=7777&amp;oldid=prev</link>
			<description>&lt;p&gt;Initial conversion from Docbook&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 13:49, 7 March 2008&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 538:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 538:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;'''Use Ubuntu as a deployment platform for multiple virtual machines.'''&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;'''Use Ubuntu as a deployment platform for multiple virtual machines.'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;A virtual machine (VM) is a simulated computer-inside-a-computer, allowing you to boot an entire extra operating system inside your primary environment. You may already be familiar with the concept of emulation: booting Microsoft Windows within your Linux machine using VMware [[Ubuntu Hacks/Virtualization and Emulation#Split Your Machine's Personality|[Hack #92]]], running an arcade-game emulator such as MAME on your computer so you can play old-style console games on your PC, or using Virtual PC on a Macintosh to allow it to run Windows programs.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;A &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/ins&gt;virtual machine&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;'' &lt;/ins&gt;(VM) is a simulated computer-inside-a-computer, allowing you to boot an entire extra operating system inside your primary environment. You may already be familiar with the concept of emulation: booting Microsoft Windows within your Linux machine using VMware [[Ubuntu Hacks/Virtualization and Emulation#Split Your Machine's Personality|[Hack #92]]], running an arcade-game emulator such as MAME on your computer so you can play old-style console games on your PC, or using Virtual PC on a Macintosh to allow it to run Windows programs.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;These systems generally work by using both software that pretends to be hardware (emulation) and software that encapsulates and grants access to physical devices (virtualization). So, in practice, what we commonly think of as an emulator is actually a combination of emulation and virtualization. For example, if you're running an x86 emulator on an x86 system, the CPU certainly doesn't need to be emulated (so it's virtualized), but other devices, such as network adapters, may be emulated. For performance reasons, a virtualization environment such as VMware will emulate as little as possible and virtualize everything it can.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;These systems generally work by using both software that pretends to be hardware (emulation) and software that encapsulates and grants access to physical devices (virtualization). So, in practice, what we commonly think of as an emulator is actually a combination of emulation and virtualization. For example, if you're running an x86 emulator on an x86 system, the CPU certainly doesn't need to be emulated (so it's virtualized), but other devices, such as network adapters, may be emulated. For performance reasons, a virtualization environment such as VMware will emulate as little as possible and virtualize everything it can.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 544:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 544:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This scheme allows an application designed for the target hardware to run unmodified. The application itself probably won't be able to tell the difference: it just thinks it's running on whatever hardware is being emulated and virtualized by the host system.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;This scheme allows an application designed for the target hardware to run unmodified. The application itself probably won't be able to tell the difference: it just thinks it's running on whatever hardware is being emulated and virtualized by the host system.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;While this approach can be applied to single applications, it can even be applied to entire operating systems: it's possible to boot an entire extra copy of Ubuntu, for example, right inside the copy you already have running. The extra copy is a complete, self-contained virtual computer with its own IP address, kernel, users, and applications. Mainframe systems have been doing this for decades, with many virtual machines running simultaneously under the management of a hypervisor. By taking this approach, the primary operating system running directly on the hardware can be relatively simple since it doesn't need to provide any end-user services or applications itself. All it needs to do is run the hypervisor to manage the child operating systems and provide a stable environment on which they can run.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;While this approach can be applied to single applications, it can even be applied to entire operating systems: it's possible to boot an entire extra copy of Ubuntu, for example, right inside the copy you already have running. The extra copy is a complete, self-contained virtual computer with its own IP address, kernel, users, and applications. Mainframe systems have been doing this for decades, with many virtual machines running simultaneously under the management of a &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/ins&gt;hypervisor&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/ins&gt;. By taking this approach, the primary operating system running directly on the hardware can be relatively simple since it doesn't need to provide any end-user services or applications itself. All it needs to do is run the hypervisor to manage the child operating systems and provide a stable environment on which they can run.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The benefit of this approach is that the core system itself can be extremely stable, secure, and reliable, allowing mainframes to run for years or decades without any downtime at all. Once the parent OS has been installed and configured, it can be left running indefinitely and be almost immune to hackers and other external threats by being completely segregated from the network. Then any applications or services that need to be provided to end users can be installed within a virtual machine that can be backed up easily and &amp;quot;rebooted&amp;quot; at any time without affecting the underlying hardware or any other virtual machines that happen to be running alongside it. Separating services into different virtual machines is a great way to limit the impact of security problems, since a compromised web server running on one virtual machine does not give the attackers any access to mail services running in a different virtual machine, even if they're on the same physical server.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The benefit of this approach is that the core system itself can be extremely stable, secure, and reliable, allowing mainframes to run for years or decades without any downtime at all. Once the parent OS has been installed and configured, it can be left running indefinitely and be almost immune to hackers and other external threats by being completely segregated from the network. Then any applications or services that need to be provided to end users can be installed within a virtual machine that can be backed up easily and &amp;quot;rebooted&amp;quot; at any time without affecting the underlying hardware or any other virtual machines that happen to be running alongside it. Separating services into different virtual machines is a great way to limit the impact of security problems, since a compromised web server running on one virtual machine does not give the attackers any access to mail services running in a different virtual machine, even if they're on the same physical server.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 929:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 929:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;'''Give your machine split personalities by installing VMware Server, and get some virtual machines running.'''&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;'''Give your machine split personalities by installing VMware Server, and get some virtual machines running.'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Virtualization is one of the current buzzwords in the computer industry. ''Virtualization'' is where a thin software layer is installed on a computer that allows its processor and other resources to be split among several virtual machines (VMs). This allows the computer operator to run several different operating systems underneath this virtualization layer. Each virtual machine has its own set of resources and operates independently from any other virtual machines that may be running at the same time.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Virtualization is one of the current buzzwords in the computer industry. ''Virtualization'' is where a thin software layer is installed on a computer that allows its processor and other resources to be split among several &lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;''&lt;/ins&gt;virtual machines&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;'' &lt;/ins&gt;(VMs). This allows the computer operator to run several different operating systems underneath this virtualization layer. Each virtual machine has its own set of resources and operates independently from any other virtual machines that may be running at the same time.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;VMware (''http://www.vmware.com'') is one of the oldest companies in the virtualization business. It has had a Linux-based product lineup available for some time, both in the personal computer space (its Workstation product) and the server space (GSX and ESX server). Recently, however, VMware has released two new free (as in beer) products: VMware Player (''http://www.vmware.com/products/player/'') and VMware Server (''http://www.vmware.com/products/server/''). The VMware Player product allows you to &amp;quot;play,&amp;quot; or use, a premade virtual machine. The VMware Server product is much more interesting, as it allows the creation of new virtual machines, and its modular, network-enabled console lets you control the virtual machines whether they're installed on your computer or another computer on the network.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;VMware (''http://www.vmware.com'') is one of the oldest companies in the virtualization business. It has had a Linux-based product lineup available for some time, both in the personal computer space (its Workstation product) and the server space (GSX and ESX server). Recently, however, VMware has released two new free (as in beer) products: VMware Player (''http://www.vmware.com/products/player/'') and VMware Server (''http://www.vmware.com/products/server/''). The VMware Player product allows you to &amp;quot;play,&amp;quot; or use, a premade virtual machine. The VMware Server product is much more interesting, as it allows the creation of new virtual machines, and its modular, network-enabled console lets you control the virtual machines whether they're installed on your computer or another computer on the network.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:7603:newid:7777 --&gt;
&lt;/table&gt;</description>
			<pubDate>Fri, 07 Mar 2008 13:49:43 GMT</pubDate>			<dc:creator>Docbook2Wiki</dc:creator>			<comments>http://commons.oreilly.com/wiki/index.php/Talk:Ubuntu_Hacks/Virtualization_and_Emulation</comments>		</item>
		<item>
			<title>Docbook2Wiki: Initial conversion from Docbook</title>
			<link>http://commons.oreilly.com/wiki/index.php?title=Ubuntu_Hacks/Virtualization_and_Emulation&amp;diff=7603&amp;oldid=prev</link>
			<description>&lt;p&gt;Initial conversion from Docbook&lt;/p&gt;

			&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;tr&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 13:45, 7 March 2008&lt;/td&gt;
			&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 195:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 195:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;                &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;                &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt; '''                  /username/dosgames'''&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt; '''                  /username/dosgames'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt; '''               '''&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;                &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;             &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;             &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 242:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 242:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;                &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;                &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt; '''                  /PATH_TO_INSTALLER/'''&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt; '''                  /PATH_TO_INSTALLER/'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt; '''               '''&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;                &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;                '''cedega_timedemo_installer'''&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;                '''cedega_timedemo_installer'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;             &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;             &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 863:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 863:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The disk images don't have to be mounted: the &amp;lt;tt&amp;gt;file&amp;lt;/tt&amp;gt; argument tells Xen that it has to treat the target as a loopback disk image, and takes care of everything for you.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The disk images don't have to be mounted: the &amp;lt;tt&amp;gt;file&amp;lt;/tt&amp;gt; argument tells Xen that it has to treat the target as a loopback disk image, and takes care of everything for you.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/dl&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/dl&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== Boot Your Virtual Machine ===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== Boot Your Virtual Machine ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikicontent:diff:version:1.11a:oldid:4676:newid:7603 --&gt;
&lt;/table&gt;</description>
			<pubDate>Fri, 07 Mar 2008 13:45:25 GMT</pubDate>			<dc:creator>Docbook2Wiki</dc:creator>			<comments>http://commons.oreilly.com/wiki/index.php/Talk:Ubuntu_Hacks/Virtualization_and_Emulation</comments>		</item>
		<item>
			<title>Docbook2Wiki: Initial conversion from Docbook</title>
			<link>http://commons.oreilly.com/wiki/index.php?title=Ubuntu_Hacks/Virtualization_and_Emulation&amp;diff=4676&amp;oldid=prev</link>
			<description>&lt;p&gt;Initial conversion from Docbook&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Ubuntu Hacks/TOC}}&lt;br /&gt;
With all the power that today's computers have, why be content to run only one operating system on them? Thanks to modern advances in virtualization technology, you can run multiple operating systems on a single computer at near-native speeds. There are many choices for virtualization on Linux. On the proprietary end, you've got applications such as VMware, and on the open source end, you've got Xen, coLinux, and QEMU (for more information not covered in this chapter, see ''http://fabrice.bellard.free.fr/qemu/'').&lt;br /&gt;
&lt;br /&gt;
If you don't need a full-blown virtualization environment, the open source Wine suite may be just what you need: it's a call-level reimplementation of the Windows Application Programming Interfaces (APIs) that allows many Windows programs to run unmodified on Linux. With proprietary enhancements such as Cedega, Wine can even run many games!&lt;br /&gt;
&lt;br /&gt;
== Run Windows Applications ==&lt;br /&gt;
&lt;br /&gt;
'''If the Windows applications you need to run just happen to be supported by Wine, you won't need to dual-boot or run an emulator. Just run the installers and launch the programs as if they were any other Linux app.'''&lt;br /&gt;
&lt;br /&gt;
Novell, the company behind the SUSE distribution, recently ran a survey asking people which Windows applications they would most like ported to Linux. Adobe's Photoshop (number 1), Dreamweaver (3rd), and Flash (5th) all ranked very high (you can see the complete poll results here: ''http://www.novell.com/coolsolutions/feature/16917.html''). Will Adobe be porting these much-requested apps to Linux soon, in response to the survey results? Probably not. But that doesn't mean you can't run them on Linux.&lt;br /&gt;
&lt;br /&gt;
You can run all three of these applications, along with many more, thanks to Wine, an open source Windows compatibility layer. ''W''ine ''i''s ''n''ot an ''e''mulator (hence the name, in true GNU recursive style), but it does provide an alternative, 100-percent-non-Microsoft implementation of the DLLs that Windows programs use. (Wine can also use actual Windows DLLs as well.) The software has been in development for more than 12 years and just reached beta status in the fall of 2005. But Wine has been in widespread use for quite some time, and it's included in most distributions, including Ubuntu (in the universe repository [[Ubuntu Hacks/Package Management#Modify the List of Package Repositories|[Hack #60]]]).&lt;br /&gt;
&lt;br /&gt;
=== Install Wine ===&lt;br /&gt;
&lt;br /&gt;
The Wine software included with Ubuntu is frequently at least a step behind the current version, so to run the latest version you'll want to edit your ''/etc/apt/sources.list'' file and add Wine's own ''apt'' repository. You can do so manually, or with the Synaptic Package Manager.&lt;br /&gt;
&lt;br /&gt;
To add the line yourself, open Terminal and enter this command:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo nano /etc/apt/sources.list'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
After you furnish your password, the ''nano'' editor will open ''sources.list''. Enter this line at the end of the file:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;deb http://wine.sourceforge.net/apt binary/&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file (press Ctrl-O), then open Terminal again and run:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo apt-get update '''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
This will update the package cache. Now you can install Wine with the command:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo apt-get install wine'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
If you prefer to add the Wine repository and install Wine with Synaptic [[Ubuntu Hacks/Package Management#Manage Packages with Synaptic|[Hack #55]]], click System→Administration→Synaptic Package Manager and select Settings→Repositories. Then click Add, select Custom, and enter &amp;lt;tt&amp;gt;deb&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;http://wine.sourceforge.net/apt&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;binary/&amp;lt;/tt&amp;gt; in the APT Line field, as shown in [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-1|Figure 9-1]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-1&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-1. Adding the Wine repository with Synaptic'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e23856.png|Adding the Wine repository with Synaptic]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, click Add Repository, and then click Reload to update the package cache. Now search for ''wine'', highlight it, right-click the highlighted entry, and select Mark for Installation. Then click Apply, review the proposed changes, and click Apply again. Wine will proceed to download and install the latest version (0.9.10 as of this writing).&lt;br /&gt;
&lt;br /&gt;
Wine is very much a work in progress, and each new version shows improvement, even if it sometimes temporarily breaks compatibility with Windows programs that formerly worked. The newer Wine is, the better it is, unlike its vintage namesake. Overall, each new version tends to be more stable and run more Windows software than its predecessor, so it's definitely worth running the latest version.&lt;br /&gt;
&lt;br /&gt;
=== Configure Wine ===&lt;br /&gt;
&lt;br /&gt;
The first thing you will want to do with Wine is configure it. You do so by running the Wine configuration utility, ''winecfg''. In Terminal, enter:&lt;br /&gt;
&lt;br /&gt;
 $ '''winecfg'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
Running this command will create the Wine configuration directory in ''/home/username/.wine''. It will also bring up the tabbed Wine configuration interface shown in [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-2|Figure 9-2]], which lets you adjust various parameters of your Wine installation, including the version of Windows that you want Wine to behave like. It's generally fine to accept the defaults, but you may find it helpful to add a new Windows drive (via the Drives tab) that explicitly maps to your CD-ROM drive. To do so, click the Add button to create a new Windows D drive, and then click Browse to select the path to your CD-ROM (such as ''/media/cdrom0/''). Finally, click the Apply button to finish.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-2&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-2. The Wine configuration interface'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e23899.png|The Wine configuration interface]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There's one more thing you should attend to before you begin to install Windows apps, and that is to install Microsoft TrueType fonts [[Ubuntu Hacks/X11#Make Your Fonts Pretty|[Hack #53]]] (so applications running in Wine can render text correctly) and ''cabextract'', a useful tool for extracting the contents of Microsoft ''.cab'' archives. You can install both packages via ''apt'' by issuing this command in Terminal:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo apt-get install msttcorefonts cabextract'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
You can also choose to install with Synaptic by searching for the ''msttcorefonts'' package, and then installing it. Synaptic will install the ''cabextract'' package along with ''msttcorefonts''.&lt;br /&gt;
&lt;br /&gt;
=== Install a Windows Application ===&lt;br /&gt;
&lt;br /&gt;
OK, now that you have Wine, &amp;lt;tt&amp;gt;msttcorefonts&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;cabextract&amp;lt;/tt&amp;gt; installed, you can install your first Windows application. If you have it, you may as well choose Photoshop, since it is currently the most requested app for porting to Linux (actually, I think the GIMP is more than fine for most web graphics work, but I'll defer to popular opinion here).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;warning&amp;quot;&amp;gt;&lt;br /&gt;
'''Warning'''&lt;br /&gt;
&lt;br /&gt;
Wine won't always run the current version of a Windows application; often, there will be some catching up to do. So, for example, the current version of Photoshop is not likely to work with the current version of Wine (although, at some point in their respective development cycles, it may). Usually, you will run Windows apps that are a generation or two behind. This is what I did with Photoshop. Since I tend to run that application more on OS X, my Windows version (Photoshop 6.0) is older. Photoshop 6 is no slouch in terms of functionality, though, and you can use these instructions to install a more recent version. Photoshop 7 is widely reported to work well, and it's possible you'll be able to get Photoshop CS working, too.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pop the installation CD for your Windows app in your drive. Open Terminal and type the command &amp;lt;tt&amp;gt;wine&amp;lt;/tt&amp;gt;, followed by the path to the installer. For example:&lt;br /&gt;
&lt;br /&gt;
 $ '''wine &amp;quot;/media/cdrom0/Adobe Photoshop 6/Setup.exe&amp;quot;'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
That's it. If you're using an application that works with Wine, the installer will launch and install the application into the mock Windows filesystem in your ''.wine'' directory, as shown in [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-3|Figure 9-3]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-3&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-3. Installing Photoshop on Ubuntu'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e23984.png|Installing Photoshop on Ubuntu]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Run Windows Applications ===&lt;br /&gt;
&lt;br /&gt;
Now that you've installed a program, you can run it—but you have to find it first. For example, my Photoshop installation is located in the ''/home/username/.wine/drive_c/Program Files/Adobe/Photoshop 6.0/'' directory. To launch Photoshop, I simply type the following command in Terminal:&lt;br /&gt;
&lt;br /&gt;
 $ '''wine &amp;quot;c:\\Program Files\\Adobe\\Photoshop 6.0\\Photoshp.exe&amp;quot;'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
Photoshop will launch almost instantly (see [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-4|Figure 9-4]]). And this old version runs ''fast''—probably faster than it did/does on Windows. It also runs very well; I have yet to encounter any glitches.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;tip&amp;quot;&amp;gt;&lt;br /&gt;
'''Tip'''&lt;br /&gt;
&lt;br /&gt;
Whenever you have questions as to whether a particular Windows application will work with Wine, you should consult the Wine Application Database at ''http://appdb.winehq.org/''. Frank's Corner (''http://www.frankscorner.org/'') is another good resource for checking whether your application is likely to work.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-4&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-4. Photoshop running on Ubuntu'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e24026.png|Photoshop running on Ubuntu]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Wine ===&lt;br /&gt;
&lt;br /&gt;
When Wine works really well, there's no better way to run a Windows application in a Linux environment. Many people dual-boot, of course, but that is really cumbersome when all you want to do is use a particular application. Other people run Windows itself using emulation software, but that is a less well-integrated solution, more resource-intensive, and generally not as fast. Wine enables Windows apps to run at native speed (at least) and to interact seamlessly with Ubuntu. Photoshop (along with other Windows apps) can open and save files anywhere on your computer, with no special effort required (there's no need for Samba-based file sharing between Ubuntu and your Windows environment, for example). In addition to the mock C drive installed by Wine, there is a Z drive that maps to your Linux filesystem.&lt;br /&gt;
&lt;br /&gt;
Running Wine on your Ubuntu system is very straightforward. You've already seen how to install and then launch Windows applications. Some other basic Wine commands to keep in mind include:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;wine control&amp;lt;/tt&amp;gt;&lt;br /&gt;
: Some programs (such as QuickTime) install associated control-panel applets; &amp;lt;tt&amp;gt;wine&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;control&amp;lt;/tt&amp;gt; will let you access them.&lt;br /&gt;
;&amp;lt;tt&amp;gt;winefile&amp;lt;/tt&amp;gt;&lt;br /&gt;
: Running the &amp;lt;tt&amp;gt;winefile&amp;lt;/tt&amp;gt; command will bring up a graphical interface, shown in [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-5|Figure 9-5]], that enables you to view your drive configuration and locate files. You can also run programs directly from this graphical environment; simply double-click on an ''.exe'', just as in Windows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-5&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-5. Wine File, an Explorer-like graphical environment'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e24083.png|Wine File, an Explorer-like graphical environment]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;uninstaller&amp;lt;/tt&amp;gt;&lt;br /&gt;
: The &amp;lt;tt&amp;gt;uninstaller&amp;lt;/tt&amp;gt; program, shown in [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-6|Figure 9-6]], is similar to the Windows Add/Remove Programs control-panel applet. Simply highlight the program you want to remove and click Uninstall. It's that straightforward.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-6&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-6. Uninstaller gives you an easy way to remove programs'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e24109.png|Uninstaller gives you an easy way to remove programs]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can access a complete set of Wine documentation at the Wine HQ site: ''http://www.winehq.org/site/docs/wineusr-guide/index''.&lt;br /&gt;
&lt;br /&gt;
=== Running Other Windows Components ===&lt;br /&gt;
&lt;br /&gt;
In addition to various Windows applications, you may find it interesting to run various Windows components as well—notably Internet Explorer, the infamous standards-shy browser that is nevertheless used by over 80 percent of all web surfers. There are a number of ways you can install IE.&lt;br /&gt;
&lt;br /&gt;
The easiest way, by far, is to use one of the utilities that have sprung up around Wine to accomplish this very thing. The three major such utilities are WineTools (''http://www.von-thadden.de/Joachim/WineTools/''), Sidenet (''http://sidenet.ddo.jp/winetips/config.html''), and the awkwardly named IEs 4 Linux (so named because it will let you install IE 6, IE 5.5, and IE 5 all at once, if you so choose). Of the three, I recommend IEs 4 Linux (''http://www.tatanka.com.br/ies4linux/''). It is the only one that doesn't radically modify your Wine filesystem and that seems to work smoothly with the latest version of Wine.&lt;br /&gt;
&lt;br /&gt;
To install IEs 4 Linux, first download it from here: ''http://www.tatanka.com.br/'' ''ies4linux/en/instructions/''. Then open the ''tar.gz'' file and run the ''ies4linux'' program that's inside. You'll be given a choice of which version(s) of IE to install; I chose IE 6 only. IEs 4 Linux will then proceed to download the version(s) you selected; IE 6 alone is an 80 MB download. The Microsoft browser(s) will be installed in a separate, ''.ies4linux'' directory in your home directory; your ''.wine'' directory is left untouched.&lt;br /&gt;
&lt;br /&gt;
A nice, if rather bizarre touch: an Internet Explorer icon (customized with Wine glass and shown in [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-7|Figure 9-7]]) is placed on your Ubuntu desktop. You can simply double-click it to launch the security-challenged browser, which defaults, for safety's sake, to an ''about:blank'' home page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-7&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-7. Internet Explorer on the Ubuntu desktop'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e24173.png|Internet Explorer on the Ubuntu desktop]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Perhaps you don't want an IE icon on your desktop—I certainly didn't. So I removed it and used Ubuntu's Applications Menu Editor to add Internet Explorer and some other Windows apps to the Ubuntu Applications menu. The result is shown in [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-8|Figure 9-8]] (you'll find the Wine glass in ''/usr/share/icons'').&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-8&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-8. Adding Windows programs to the Applications menu'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e24185.png|Adding Windows programs to the Applications menu]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that Wine's commercial cousins, CodeWeavers' CrossOver Office [[Ubuntu Hacks/Multimedia#Buy Songs at the iTunes Music Store|[Hack #31]]] (''http://www.codeweavers.com/'') and TransGaming's Cedega [[Ubuntu Hacks/Virtualization and Emulation#Play Windows Games|[Hack #88]]] (''http://www.transgaming.com/''), can add the menu items for you.&lt;br /&gt;
&lt;br /&gt;
Thomas Pletcher&lt;br /&gt;
&lt;br /&gt;
== Play Windows Games ==&lt;br /&gt;
&lt;br /&gt;
'''Those Windows games don't have to be trapped in that partition you rarely boot into. Instead, you can use Wine or Cedega to play them.'''&lt;br /&gt;
&lt;br /&gt;
Wine (''http://www.winehq.com''), the open source Windows compatibility layer [[Ubuntu Hacks/Virtualization and Emulation#Run Windows Applications|[Hack #87]]], is well known for its ability to run many popular Windows applications, and even certain Windows components such as Internet Explorer. Wine can also run some popular Windows games, though gaming is not its primary focus. Still, if a game runs successfully in Wine, then Wine is probably the best way to play it. It is usually a fairly straightforward matter to install and play games in Wine, not to mention the fact that Wine itself is free and open source software.&lt;br /&gt;
&lt;br /&gt;
Still, there are other game-playing solutions for Linux that may often produce better results. That is certainly the case when it comes to classic, DOS-based games. For these, DOSBox (''http://dosbox.sourceforge.net'') is your best bet. DOSBox is a free and open source x86 and DOS emulator that runs on multiple platforms (including modern versions of Windows and Mac OS X, as well as Linux). It is especially good with older games.&lt;br /&gt;
&lt;br /&gt;
=== Run Blasts from the Past ===&lt;br /&gt;
&lt;br /&gt;
DOSBox is included in Ubuntu's universe repository [[Ubuntu Hacks/Package Management#Modify the List of Package Repositories|[Hack #60]]], and it is generally up-to-date. So you can simply install it by running:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo apt-get install dosbox'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
or using Synaptic [[Ubuntu Hacks/Package Management#Manage Packages with Synaptic|[Hack #55]]] or Adept [[Ubuntu Hacks/Package Management#Manage Packages with Adept|[Hack #56]]]. In either case, the SDL multimedia library dependencies will also be installed. After you've installed DOSBox, you'll need to create a new directory in your home directory and name it something like ''dosgames''. This is, of course, where you'll install those DOS classics you remember so fondly. Let's download and install a game to use with DOSBox; you'll find almost all the classic DOS games at the Abandonia site (''http://www.abandonia.com'').&lt;br /&gt;
&lt;br /&gt;
I chose a true all-time classic, the original Tetris (''http://www.abandonia.com/games/en/69/Tetris.htm''), and made a directory for it (''dosgames/Tetris''). Then I unzipped the Tetris download into the ''dosgames/Tetris'' directory. To launch DOSBox, you just type &amp;lt;tt&amp;gt;dosbox&amp;lt;/tt&amp;gt; in Terminal.&lt;br /&gt;
&lt;br /&gt;
Doing so brings up the DOSBox shell (shown in [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-9|Figure 9-9]]), where you can enter various DOS commands and launch your games. The DOSBox shell opens in the Z directory by default, so you will need to mount the C directory, which contains your games. You can do so within the DOSBox shell by typing:&lt;br /&gt;
&lt;br /&gt;
 Z:&amp;gt; '''mount''' &lt;br /&gt;
                '''c''' &lt;br /&gt;
                '''/home'''&lt;br /&gt;
                &lt;br /&gt;
 '''                  /username/dosgames'''&lt;br /&gt;
 '''               '''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
where &amp;lt;tt&amp;gt;''username''&amp;lt;/tt&amp;gt; is your username and &amp;lt;tt&amp;gt;''dosgames''&amp;lt;/tt&amp;gt; is whatever you named the directory that contains your DOSBox games. After you've mounted the C directory, you can switch to it simply by typing &amp;lt;tt&amp;gt;c:&amp;lt;/tt&amp;gt; within the shell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-9&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-9. The DOSBox shell'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e24334.png|The DOSBox shell]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now that you're in the C directory, type &amp;lt;tt&amp;gt;dir&amp;lt;/tt&amp;gt; to have a look at its contents. (See the DOSBox Wiki at ''http://dosbox.sourceforge.net/wiki/index.php?page=DOSBoxWiki'' for a DOS command reference and other useful information.) If you've installed Tetris, you should see a line like this:&lt;br /&gt;
&lt;br /&gt;
 TETRIS   &amp;lt;DIR&amp;gt;   15-03-2006   14:14&lt;br /&gt;
&lt;br /&gt;
which simply tells you that ''TETRIS'' is a directory, and gives you the time and date of its installation. Inside the ''TETRIS'' directory (change to it by typing &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;tetris&amp;lt;/tt&amp;gt;, and then look inside with &amp;lt;tt&amp;gt;dir&amp;lt;/tt&amp;gt;), you'll see one file: ''Tetris.com''. (DOS executable files have one of three extensions—''.exe'', ''.com'', or ''.bat''.) You can launch the game by typing &amp;lt;tt&amp;gt;tetris.com&amp;lt;/tt&amp;gt;. (You can also launch the game by typing &amp;lt;tt&amp;gt;TETRIS.COM&amp;lt;/tt&amp;gt;—don't worry about case sensitivity.) [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-10|Figure 9-10]] shows the game in action.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-10&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-10. Playing the original Tetris, with DOSBox'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e24395.png|Playing the original Tetris, with DOSBox]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are a few basic commands you can access if you need:&lt;br /&gt;
&lt;br /&gt;
* Ctrl-F7 decreases frameskip.&lt;br /&gt;
* Ctrl-F8 increases frameskip.&lt;br /&gt;
* Ctrl-F11 slows down the game.&lt;br /&gt;
* Ctrl-F12 speeds up the game.&lt;br /&gt;
&lt;br /&gt;
When you've finished your game, type &amp;lt;tt&amp;gt;z:&amp;lt;/tt&amp;gt; at the prompt and press Enter. This takes you back to the &amp;lt;tt&amp;gt;Z:&amp;gt;&amp;lt;/tt&amp;gt; prompt, where you can type &amp;lt;tt&amp;gt;exit&amp;lt;/tt&amp;gt; to quit the DOSBox shell.&lt;br /&gt;
&lt;br /&gt;
You're not limited to antique classics like Tetris when you use DOSBox; many more graphically advanced games are available as well. Abandonia, in addition to its very wide selection of games, is also valuable for its compatibility ratings; you can see at a glance whether an older game is compatible with DOSBox (most are). And many collections of DOS games are available on CD-ROM, including classic role-playing games such as Wizardry and Might and Magic, as well as classic text adventures from Infocom. Some of these collections are easy to find in the $9.99 bin at your local computer store. Others are a bit harder to find, so you might have to check eBay.&lt;br /&gt;
&lt;br /&gt;
=== Run Current Windows Games with Cedega ===&lt;br /&gt;
&lt;br /&gt;
Cedega (''http://www.transgaming.com'') is a commercial version of Wine—commercial to a fault, some would say. Cedega, formerly known as WineX, is basically a fork of Wine that has gone proprietary. This has generated some resistance among free software fans, and you won't find Cedega in the Ubuntu repositories. But if you're a gamer, you'll want Cedega anyway; it's generally regarded as the best way to run recent Windows titles on Linux.&lt;br /&gt;
&lt;br /&gt;
Cedega costs $5 per month, and you have to pay the first three months up front. However, there is a fully functional, two-week trial version available. I recommend you start with that; if you like it, you can convert to the paid version from the trial.&lt;br /&gt;
&lt;br /&gt;
You can download the Cedega Time Demo from ''http://www.transgaming.com/products_linux.php''. You'll find the download link near the bottom of the page, and you'll find system requirements and installation information at ''http://downloads.transgaming.com/files/timedemo_howto.html''. Pay particular attention to the video-card requirements: Cedega won't be worth your subscription cost if your system isn't up to handling current games. NVIDIA GeForce or ATI Radeon class cards are pretty much the minimum requirement; pixel shaders are only available on NVIDIA FX class cards and above. ATI Radeon 8500 or better cards will also work, but only with proprietary ATI drivers. Intel and other cards may be able to drive some games, but probably not most.&lt;br /&gt;
&lt;br /&gt;
To install the Cedega Time Demo, run the installation script with this command:&lt;br /&gt;
&lt;br /&gt;
 $ '''sh''' &lt;br /&gt;
                &lt;br /&gt;
 '''                  /PATH_TO_INSTALLER/'''&lt;br /&gt;
 '''               '''&lt;br /&gt;
                '''cedega_timedemo_installer'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
Note that the preceding command will install the Time Demo in your user directory. If you'd prefer a system-wide installation, then run the preceding command as ''root''.&lt;br /&gt;
&lt;br /&gt;
The installer will check for updates and then ask whether you want to install the Microsoft Core Fonts and the MozControl package. You must agree to the licenses for each before they are downloaded as part of the install.&lt;br /&gt;
&lt;br /&gt;
The TransGaming people will email you a registration key, which you'll need to enter during the process of installing Cedega. [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-11|Figure 9-11]] shows the Cedega registration process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-11&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-11. The Cedega demo must be registered during installation'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e24503.png|The Cedega demo must be registered during installation]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, before you play your first game with Cedega, a wizard will walk you through tests of various facets of your system. If your computer can't pass the OpenGL Direct Rendering and 3D Acceleration tests, in particular, Cedega is not going to run many games.&lt;br /&gt;
&lt;br /&gt;
After installation, you can launch the Cedega Time Demo by entering:&lt;br /&gt;
&lt;br /&gt;
 $ '''~/cedega_timedemo'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
in a Terminal. This brings up Cedega's graphical interface (see [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-12|Figure 9-12]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-12&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-12. The Cedega interface'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e24522.png|The Cedega interface]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Cedega, almost everything can be done via the GUI. There are command-line options too, though. You can read about these options and other Cedega usage tips on the Cedega How-To Guide page at ''http://downloads.transgaming.com/files/Cedega-How-To-5.0.0-2.html''. Note that the Cedega Time Demo is actually the same as the full subscription version, currently 5.1.&lt;br /&gt;
&lt;br /&gt;
To install a game with Cedega, just click the Install button and then browse to and run the installer. You can download games from a wide variety of sources (e.g., Download.com), and you can even mix and match the original Windows ''.pak'' files from CDs with open source game binaries for games like Quake I, II, or III. You can also install demos to try a game before installing the full version (see [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-13|Figure 9-13]]), but note that there can often be significant differences between the demo and the full game; both may not run. TransGaming has an extensive games database (''http://transgaming.org/gamesdb/'') you can consult.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-13&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-13. Installing the Quake III demo'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e24548.png|Installing the Quake III demo]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As noted earlier, you'll want the best graphics setup possible to take maximum advantage of Cedega and today's Windows titles. But Cedega (and Wine as well) can run some games even on underpowered machines—a title such as Delta Force 2 being a case in point (see [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-14|Figure 9-14]]).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-14&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-14. Running Delta Force 2'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e24557.png|Running Delta Force 2]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cedega, in spite of its licensing and cost issues, is regarded by many as the best way to run current Windows games on Linux. For hardcore gamers, that alone is enough to recommend it. Just be sure your system is suitably equipped, and also make sure you have the time and inclination to tweak your system to get the most out of Cedega, and today's games. Sometimes a game will run &amp;quot;out of the box,&amp;quot; but sometimes it won't. For many gamers, getting such games to work is part of the fun.&lt;br /&gt;
&lt;br /&gt;
=== Run Google Earth with Wine ===&lt;br /&gt;
&lt;br /&gt;
Modern games aren't the only visually advanced Windows applications that can be challenging to run on Linux. Because it relies on DirectX and OpenGL, a sophisticated application like Google Earth poses similar issues, and there are similar rewards for those who can get it to run.&lt;br /&gt;
&lt;br /&gt;
A HOWTO for Gentoo users for installing Google Earth with Wine was published at ''http://gentoo-wiki.com/HOWTO_Install_GoogleEarth_with_wine'', and I was able to adapt these instructions for an Ubuntu PC. Your mileage may vary: chances are some additional tweaking will be required, depending on your computer's exact configuration. But you can use the following instructions as a starting point, and, if you're lucky, they'll be all that is needed. First, of course, you must install Wine [[Ubuntu Hacks/Virtualization and Emulation#Run Windows Applications|[Hack #87]]].&lt;br /&gt;
&lt;br /&gt;
Next, you need to install the Microsoft DCOM98 (Distributed Component Object Model for Windows 98). First, run ''winecfg'' and set the Windows version to Windows 98. Then, you can download DCOM98 from here: ''http://'' ''download.microsoft.com/download/d/1/3/d13cd456-f0cf-4fb2-a17f-20afc79f8a51/'' ''DCOM98.EXE'' (or just search for the link on Google; it's probably faster!). Now, install DCOM98 with a &amp;lt;tt&amp;gt;WINEDLLOVERRIDE&amp;lt;/tt&amp;gt;, specifically:&lt;br /&gt;
&lt;br /&gt;
 $ '''WINEDLLOVERRIDES=&amp;quot;ole32=n&amp;quot; wine DCOM98.EXE'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
After you have DCOM98 installed, download the ''psapi.dll'' from ''http://www.dll-files.com/dllindex/pop.php?psapi'' and place the DLL in your ''~/.wine/drive_c/windows/system32'' directory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;warning&amp;quot;&amp;gt;&lt;br /&gt;
'''Warning'''&lt;br /&gt;
&lt;br /&gt;
Downloading these DLLs from untrusted sources can be quite dangerous, since you have no way of knowing that they have not been compromised (for example, they could be harboring a Trojan horse). The safest option is to copy them over from a working Windows system that has recently been checked for spyware, viruses, and other malware.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, download Google Earth from ''http://earth.google.com''. Before you do so, though, run ''winecfg'' again and set the Windows version to Windows XP. Also, before you install Google Earth, make sure you download the ''usp10.dll'' (Google for the download location); place this in the ''~/.wine/drive_c/windows/system32'' directory as well.&lt;br /&gt;
&lt;br /&gt;
Now, install Google Earth like so:&lt;br /&gt;
&lt;br /&gt;
 $ '''WINEDLLOVERRIDES=&amp;quot;ole32,oleaut32,rpcrt4=n&amp;quot; wine GoogleEarth.exe'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
After you've managed to install Google Earth, you reach the moment of truth: it's time to run it. Here's the command I used:&lt;br /&gt;
&lt;br /&gt;
 $ '''WINEDLLOVERRIDES=&amp;quot;ole32,usp10,msvcrt=n&amp;quot; \\'''&lt;br /&gt;
                '''  wine &amp;quot;c:\\Program Files\\Google\\Google Earth\\GoogleEarth.exe&amp;quot;'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
This ''should'' work (see [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-15|Figure 9-15]]). However, it might not work on ''your'' system, and therein lies the challenge. (If you do run into trouble getting it to work, be sure to check the HOWTO mentioned earlier in this section.) Getting Google Earth to run on Ubuntu or any Linux system is a worthy hack, and tools like Wine (along with DOSBox and Cedega, for vintage and state-of-the-art games) make it possible.&lt;br /&gt;
&lt;br /&gt;
Thomas Pletcher&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-15&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-15. Google Earth launching via Wine'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e24692.png|Google Earth launching via Wine]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Run Ubuntu Inside Windows ==&lt;br /&gt;
&lt;br /&gt;
'''If you want to avoid the confines of the emulator sandbox, give coLinux a whirl and run Ubuntu as a cooperative process alongside Windows.'''&lt;br /&gt;
&lt;br /&gt;
coLinux (Cooperative Linux), available from ''http://www.colinux.org/'', takes a unique approach to solving the same problems that emulators do. Instead of providing a completely enclosed sandbox like Virtual PC or VMware, it's a port of the Linux kernel that lets you run Linux alongside Windows. This means that you don't get a fully emulated and/or virtualized PC environment. But you do get enough to launch a Linux distribution in console mode with networking support, and from there you can use ''ssh'' to tunnel into the coLinux system and run applications on your Windows X11 server. You can get a great, free X11 setup with Cygwin (''http://www.cygwin.com''), a Windows port of many Linux tools and applications. With the combination of coLinux and Cygwin, you can get Ubuntu running alongside Windows, and without the overhead and complexity of other offerings, it runs quite fast.&lt;br /&gt;
&lt;br /&gt;
To get Ubuntu up and running with coLinux, you'll first need to install coLinux itself and choose the minimal Debian disk image that comes along with it. With some ''apt-get'' trickery, you'll be able to turn that Debian installation into an Ubuntu system.&lt;br /&gt;
&lt;br /&gt;
=== Install coLinux ===&lt;br /&gt;
&lt;br /&gt;
Download the latest installer from the coLinux web site, and run it under Windows. If you don't have WinPcap (''http://winpcap.mirror.ethereal.com/install/default.htm'') installed, you should download and install it (don't worry, the coLinux installer will remind you about this, too).&lt;br /&gt;
&lt;br /&gt;
When you run the installer, it will try to install coLinux into ''C:\\Program Files\\coLinux''. You should change this to ''C:\\coLinux'', because the default configuration files expect to find it there. Plus, paths without spaces make everyone happier.&lt;br /&gt;
&lt;br /&gt;
When you're prompted to choose a Linux distribution, select the Debian installer. This will download a small compressed file that you'll later expand to about 1 GB. Sometime during the install, you'll get a Windows Logo compatibility-testing error message about the TAP-Win32 adapter, which is necessary if you want to use networking, so you'll need to click Continue Anyway and let Windows install it.&lt;br /&gt;
&lt;br /&gt;
When installation is finished, you'll be offered the opportunity to look at the ''README'' file. I know you would normally never do this, but with software that's this complicated, I think you should.&lt;br /&gt;
&lt;br /&gt;
=== Set Up the Debian Image ===&lt;br /&gt;
&lt;br /&gt;
Now that coLinux is installed, there are a few more steps to get it configured. By now, I hope you've installed Cygwin, since you'll need to use some of the utilities from it to get things set up nicely. If not, go install it now and, when you're ready, open a Windows command prompt, then &amp;lt;tt&amp;gt;cd&amp;lt;/tt&amp;gt; to the ''C:\\coLinux'' directory. You'll need to expand the filesystem image you downloaded. It's probably compressed with ''bzip'', so you should use the ''bunzip2'' utility from Cygwin to decompress it:&lt;br /&gt;
&lt;br /&gt;
 C:\\coLinux&amp;gt;'''\\cygwin\\bin\\bunzip2 Debian-3.0r2.ext3-mit-backports.1gb.bz2'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;tip&amp;quot;&amp;gt;&lt;br /&gt;
'''Tip'''&lt;br /&gt;
&lt;br /&gt;
Consider backing up this file before you unzip it, just in case you make a horrible error while you are hacking it and want to start out with a fresh image.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, you'll need to create a swapfile. Cygwin's ''dd'' is fine for this purpose. Windows has a utility called ''fsutil'' that can also create it, so either of these commands will create a 512 MB swapfile:&lt;br /&gt;
&lt;br /&gt;
 &amp;gt; '''fsutil file createnew swap_device 536870912'''&lt;br /&gt;
 &amp;gt; '''c:\\cygwin\\bin\\dd if=/dev/zero of=swap_device bs=1M count=512'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
Now you need to work on the configuration file. Copy ''default.colinux.xml'' to ''colinux.xml'' and open ''colinux.xml'' in your favorite text editor.&lt;br /&gt;
&lt;br /&gt;
Edit this file and make sure the paths to your filesystem image (default is ''root_fs'') and swap device (default is ''swap_device'') are correct. Bump up your memory size to whatever you feel comfortable setting aside (256 MB is good, assuming you have more than 512 MB of memory and don't plan to do something memory-intensive while your coLinux system is running).&lt;br /&gt;
&lt;br /&gt;
Now it's time to get the network connection set up. Go to Control Panel→Network Connections and locate the TAP-Win32 adapter, highlighted in [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-16|Figure 9-16]]. Change its name if you'd like (the default will be something like &amp;quot;Local Area Connection 5&amp;quot;), and add its name to the network entry in ''colinux.xml''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-16&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-16. Finding the TAP adapter in Windows'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e24894.png|Finding the TAP adapter in Windows]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you need to share your Internet connection. Locate your Internet connection in the Network Connections window, right-click on it, and select Properties. Go to the Advanced tab, click &amp;quot;Allow other network users to connect through this computer's Internet connection,&amp;quot; and select the TAP adapter in the &amp;quot;Home networking connection&amp;quot; drop-down menu, as shown in [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-17|Figure 9-17]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;tip&amp;quot;&amp;gt;&lt;br /&gt;
'''Tip'''&lt;br /&gt;
&lt;br /&gt;
In Windows 2000, you will need to first boot up coLinux; then select your Local Area Connection, select the Properties tab, and choose &amp;quot;Enable Internet Connection Sharing for this Connection.&amp;quot; This is because Windows 2000 won't let you enable sharing unless the Tap interface is live at the time.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-17&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-17. Sharing your Internet connection'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e24907.png|Sharing your Internet connection]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, return to the Command Prompt and start colinux as a standalone process. You can run it as a daemon, but it's easier to debug this way. The &amp;lt;tt&amp;gt;-t NT&amp;lt;/tt&amp;gt; option uses the Windows command prompt as the console, for easier cutting and pasting, and the &amp;lt;tt&amp;gt;-c&amp;lt;/tt&amp;gt; option specifies the configuration filename:&lt;br /&gt;
&lt;br /&gt;
 C:\\coLinux&amp;gt;'''colinux-daemon.exe -t NT -c colinux.xml'''&lt;br /&gt;
 Cooperative Linux Daemon, 0.6.3&lt;br /&gt;
 Compiled on Sun Feb  5 20:25:03 2006&lt;br /&gt;
 &lt;br /&gt;
 Linux version 2.6.11-co-0.6.3 (george@CoDebianDevel) (gcc version&lt;br /&gt;
 3.4.4 20050314&lt;br /&gt;
  (prerelease) (Debian 3.4.3-13)) #1 Sun 384MB LOWMEM available.&lt;br /&gt;
  initrd enabled: start: 0xd7e10000  size: 0x001ef78a)&lt;br /&gt;
  On node 0 totalpages: 98304&lt;br /&gt;
&lt;br /&gt;
You'll see the usual messages scroll by until you get a login prompt. Log in as ''root'', with the password &amp;lt;tt&amp;gt;root&amp;lt;/tt&amp;gt;. At this point, networking won't be working, since there are some hardcoded (and incorrect) values in ''/etc/network/interfaces''. Run the command &amp;lt;tt&amp;gt;pump&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;-i&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;eth0&amp;lt;/tt&amp;gt; and check the output of &amp;lt;tt&amp;gt;ifconfig&amp;lt;/tt&amp;gt; to see if you got an IP address from Windows connection sharing. If so, you can edit (you may want to do an &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;update&amp;lt;/tt&amp;gt; and then &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;install vim&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;install&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;emacs&amp;lt;/tt&amp;gt;) ''/etc/network/interfaces'' and replace:&lt;br /&gt;
&lt;br /&gt;
 iface eth0 inet static&lt;br /&gt;
  address 192.168.254.205&lt;br /&gt;
  netmask 255.255.255.0&lt;br /&gt;
  gateway 192.168.254.1&lt;br /&gt;
&lt;br /&gt;
with:&lt;br /&gt;
&lt;br /&gt;
 iface eth0 inet dhcp&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;tip&amp;quot;&amp;gt;&lt;br /&gt;
'''Tip'''&lt;br /&gt;
&lt;br /&gt;
If you want the same address each time, you should instead replace 192.168.254.205 with the address you got from ''pump''. As long as you're not running multiple coLinux instances, you'll never need to worry about IP address collisions. If you are running multiple instances, you can always choose IP addresses in the 192.168.0.0/24 that don't conflict.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point, you can issue the command &amp;lt;tt&amp;gt;halt&amp;lt;/tt&amp;gt; inside of the coLinux distribution to shut down, start up coLinux again, and verify that networking is configured correctly on boot. Now you're ready to install Ubuntu.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;warning&amp;quot;&amp;gt;&lt;br /&gt;
'''Warning'''&lt;br /&gt;
&lt;br /&gt;
If your real network uses the same address range as that used by Windows (192.268.0.0/24), you'll have problems. If this happens, you'll need to change your physical network to use a different range of addresses.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
It's pretty easy to turn Debian into Ubuntu, but for the smoothest transition, you should make sure you've got the latest and greatest Debian system, so do an &amp;lt;tt&amp;gt;apt-get update; apt-get upgrade&amp;lt;/tt&amp;gt;. You also need to update a few things to make sure your system has the necessary versions to install Ubuntu. This should do the trick:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo apt-get install sed locales'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;tip&amp;quot;&amp;gt;&lt;br /&gt;
'''Tip'''&lt;br /&gt;
&lt;br /&gt;
For another (not quite as quick-and-dirty) approach to converting Debian to Ubuntu, see [[Ubuntu Hacks/Package Management#Convert Debian to Ubuntu|&amp;quot;Convert Debian to Ubuntu&amp;quot; [Hack #66]]].&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, edit ''/etc/apt/sources.list'', delete everything in there, and insert the following lines:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;deb http://archive.ubuntu.com/ubuntu dapper main restricted &lt;br /&gt;
deb-src http://archive.ubuntu.com/ubuntu dapper main restricted&lt;br /&gt;
&lt;br /&gt;
deb http://archive.ubuntu.com/ubuntu dapper-updates main restricted&lt;br /&gt;
deb-src http://archive.ubuntu.com/ubuntu dapper-updates main restricted &lt;br /&gt;
&lt;br /&gt;
deb http://security.ubuntu.com/ubuntu dapper-security main restricted &lt;br /&gt;
deb-src http://security.ubuntu.com/ubuntu dapper-security main restricted&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, it should theoretically be smooth sailing from here, but it probably won't be. To kick off the update, run &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;update&amp;lt;/tt&amp;gt; and then &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;dist-upgrade&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;tip&amp;quot;&amp;gt;&lt;br /&gt;
'''Tip'''&lt;br /&gt;
&lt;br /&gt;
If you see a message about configuring LILO, you can ignore it. coLinux doesn't use it.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
During the upgrade, you will almost certainly get this error:&lt;br /&gt;
&lt;br /&gt;
 E: This installation run will require temporarily removing the&lt;br /&gt;
 essential package e2fsprogs due to a Conflicts/Pre-Depends loop.&lt;br /&gt;
 This is often bad, but if you re ally want to do it, activate the&lt;br /&gt;
 APT::Force-LoopBreak option.  &lt;br /&gt;
 E: Internal Error, Could not early remove e2fsprogs&lt;br /&gt;
&lt;br /&gt;
If so, add &amp;lt;tt&amp;gt;-o&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;&amp;quot;APT::Force-Loopbreak=true&amp;quot;&amp;lt;/tt&amp;gt; to the &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;dist-upgrade&amp;lt;/tt&amp;gt; command line, as in:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo apt-get -o &amp;quot;APT::Force-Loopbreak=true&amp;quot; dist-upgrade'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
If you continue to get errors, run this command to clear things up:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo apt-get -o &amp;quot;APT::Force-Loopbreak=true&amp;quot; -f install'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
Then, run the &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;dist-upgrade&amp;lt;/tt&amp;gt; command again, and it should run to completion.&lt;br /&gt;
&lt;br /&gt;
When it's done, you must &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;install&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;ubuntu-keyring&amp;lt;/tt&amp;gt; so that ''apt-get''can verify package signatures. Now you can start ''apt-get''ting what you need. Pick out some high-level applications, since this will pull in a lot of other dependencies. I'd suggest something like:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo apt-get install firefox openoffice.org2 gnome-games'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
Do what you can to prevent Ubuntu from installing an X server, since that can only complicate things.&lt;br /&gt;
&lt;br /&gt;
=== Enabling SSH ===&lt;br /&gt;
&lt;br /&gt;
If you'd rather not work in the coLinux console, you can SSH in to your coLinux system. First, run &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;install&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;ssh&amp;lt;/tt&amp;gt;, then use &amp;lt;tt&amp;gt;ifconfig&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;eth0&amp;lt;/tt&amp;gt; to determine your IP address, which will be on the private network that Windows assigned for Internet connection sharing, such as 192.168.0.143. Fire up PuTTY or openssh (available in Cygwin) to connect to that IP address. If you're using Cygwin, you may need to set your &amp;lt;tt&amp;gt;TERM&amp;lt;/tt&amp;gt; to something other than &amp;lt;tt&amp;gt;cygwin&amp;lt;/tt&amp;gt;, such as &amp;lt;tt&amp;gt;ansi&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 bjepson@thlon ~&lt;br /&gt;
 $ '''ssh root@192.168.0.16'''&lt;br /&gt;
 Password:&lt;br /&gt;
 Last login: Fri Mar  3 23:00:31 2006 from thlon.mshome.net&lt;br /&gt;
 Linux colinux 2.6.10-co-0.6.2 #5 Sat Feb 5 10:19:16 IST 2005 i686 GNU/Linux&lt;br /&gt;
 &lt;br /&gt;
 The programs included with the Ubuntu system are free software;&lt;br /&gt;
 the exact distribution terms for each program are described in the&lt;br /&gt;
 individual files in /usr/share/doc/*/copyright.&lt;br /&gt;
 &lt;br /&gt;
 Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by&lt;br /&gt;
 applicable law.&lt;br /&gt;
 colinux:~#&lt;br /&gt;
&lt;br /&gt;
=== Running X11 Applications ===&lt;br /&gt;
&lt;br /&gt;
To run any X11 applications, you'll need to &amp;lt;tt&amp;gt;ssh&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;-X&amp;lt;/tt&amp;gt; into your coLinux system from within the Cygwin X11 environment and launch applications from there. (You will probably need to enable X11Forwarding in Ubuntu's ''/etc/ssh/sshd_config'' and restart ''sshd'' with &amp;lt;tt&amp;gt;/etc/init.d/sshd&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;restart&amp;lt;/tt&amp;gt; to get this working. You'll need to &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;xauth&amp;lt;/tt&amp;gt; as well.)&lt;br /&gt;
&lt;br /&gt;
Now you're ready to start playing. Run the &amp;lt;tt&amp;gt;adduser&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;''username''&amp;lt;/tt&amp;gt; command to add a mortal user, and then you can log out as ''root''.&lt;br /&gt;
&lt;br /&gt;
Next, start up a Cygwin shell on the Windows system, and run the Cygwin X server with the command &amp;lt;tt&amp;gt;startxwin.sh&amp;lt;/tt&amp;gt;. When the xterm appears, use &amp;lt;tt&amp;gt;ssh -X&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;''IP_ADDRESS''&amp;lt;/tt&amp;gt; to log in to your coLinux system. Replace &amp;lt;tt&amp;gt;''IP_ADDRESS''&amp;lt;/tt&amp;gt; with either the fixed private network address you assigned it or the latest one it got from DHCP (use ''ifconfig'' in the Ubuntu system to find this out). Once you're logged in, you can start running your favorite programs (see [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-18|Figure 9-18]])!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-18&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-18. Windows and Linux in perfect harmony'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e25220.png|Windows and Linux in perfect harmony]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;warning&amp;quot;&amp;gt;&lt;br /&gt;
'''Warning'''&lt;br /&gt;
&lt;br /&gt;
If you get the error &amp;quot;xterm Xt error: Can't open display: xterm: DISPLAY is not set,&amp;quot; you should log out, and try &amp;lt;tt&amp;gt;ssh -X&amp;lt;/tt&amp;gt; again, but with the &amp;lt;tt&amp;gt;-v&amp;lt;/tt&amp;gt; option, which gives you verbose details on your connection attempt and should shed light on the situation. For example, if you see an error related to xauth, that means you need to &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;xauth&amp;lt;/tt&amp;gt; on the coLinux Ubuntu system.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Brian Jepson&lt;br /&gt;
&lt;br /&gt;
== Use Xen to Host Virtual Machines ==&lt;br /&gt;
&lt;br /&gt;
'''Use Ubuntu as a deployment platform for multiple virtual machines.'''&lt;br /&gt;
&lt;br /&gt;
A virtual machine (VM) is a simulated computer-inside-a-computer, allowing you to boot an entire extra operating system inside your primary environment. You may already be familiar with the concept of emulation: booting Microsoft Windows within your Linux machine using VMware [[Ubuntu Hacks/Virtualization and Emulation#Split Your Machine's Personality|[Hack #92]]], running an arcade-game emulator such as MAME on your computer so you can play old-style console games on your PC, or using Virtual PC on a Macintosh to allow it to run Windows programs.&lt;br /&gt;
&lt;br /&gt;
These systems generally work by using both software that pretends to be hardware (emulation) and software that encapsulates and grants access to physical devices (virtualization). So, in practice, what we commonly think of as an emulator is actually a combination of emulation and virtualization. For example, if you're running an x86 emulator on an x86 system, the CPU certainly doesn't need to be emulated (so it's virtualized), but other devices, such as network adapters, may be emulated. For performance reasons, a virtualization environment such as VMware will emulate as little as possible and virtualize everything it can.&lt;br /&gt;
&lt;br /&gt;
This scheme allows an application designed for the target hardware to run unmodified. The application itself probably won't be able to tell the difference: it just thinks it's running on whatever hardware is being emulated and virtualized by the host system.&lt;br /&gt;
&lt;br /&gt;
While this approach can be applied to single applications, it can even be applied to entire operating systems: it's possible to boot an entire extra copy of Ubuntu, for example, right inside the copy you already have running. The extra copy is a complete, self-contained virtual computer with its own IP address, kernel, users, and applications. Mainframe systems have been doing this for decades, with many virtual machines running simultaneously under the management of a hypervisor. By taking this approach, the primary operating system running directly on the hardware can be relatively simple since it doesn't need to provide any end-user services or applications itself. All it needs to do is run the hypervisor to manage the child operating systems and provide a stable environment on which they can run.&lt;br /&gt;
&lt;br /&gt;
The benefit of this approach is that the core system itself can be extremely stable, secure, and reliable, allowing mainframes to run for years or decades without any downtime at all. Once the parent OS has been installed and configured, it can be left running indefinitely and be almost immune to hackers and other external threats by being completely segregated from the network. Then any applications or services that need to be provided to end users can be installed within a virtual machine that can be backed up easily and &amp;quot;rebooted&amp;quot; at any time without affecting the underlying hardware or any other virtual machines that happen to be running alongside it. Separating services into different virtual machines is a great way to limit the impact of security problems, since a compromised web server running on one virtual machine does not give the attackers any access to mail services running in a different virtual machine, even if they're on the same physical server.&lt;br /&gt;
&lt;br /&gt;
Other advantages of this setup include rapid backups, versioning, and rollbacks; live migration of running services to another host; rapid provisioning of new services; segregated system administration; and support for multiple runtime environments running simultaneously on one server.&lt;br /&gt;
&lt;br /&gt;
This technology has now started to filter down to Linux in a number of forms, including UML (User Mode Linux), VMware, and Xen. This hack focuses on Xen, a project to implement a mainframe-style hypervisor within a Linux environment, giving Linux much of the power and flexibility of the older Unix systems that inspired it. Xen's approach to virtualization is to provide a virtual architecture to which the Linux kernel can be ported. In just the same way that Linux is supported on architectures such as ia32 (386), ia64, PowerPC, AMD64, and many others, Xen defines an architecture for which the kernel can be compiled. This virtual architecture is provided by a special kernel that runs on the host machine, and virtual machines that execute on it run an otherwise unmodified kernel that has been compiled for the Xen architecture.&lt;br /&gt;
&lt;br /&gt;
The host machine is generally referred to as ''dom0'', and guest virtual machines that run on it are referred to as ''domU'' machines.&lt;br /&gt;
&lt;br /&gt;
=== Initial Host Installation ===&lt;br /&gt;
&lt;br /&gt;
The whole idea of virtualization is to run the ''dom0'' base system in a totally cut-down form with as little installed as possible. The less you have in the base system, the less there is that can go wrong. With an extremely stable base system, you can then run all your services in virtual machines.&lt;br /&gt;
&lt;br /&gt;
Start by doing a clean install of Ubuntu in server mode [[Ubuntu Hacks/Small Office/Home Office Server#Install and Configure an Ubuntu Server|[Hack #93]]] so you have as little cruft on your system as possible.&lt;br /&gt;
&lt;br /&gt;
=== Base Packages Required by Xen ===&lt;br /&gt;
&lt;br /&gt;
To run Xen and provide networking services to virtual machines, you will need to install a number of packages:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo apt-get install grub bridge-utils iproute python \\'''&lt;br /&gt;
                '''  python-twisted gcc libcurl3 libcurl3-dev zlib1g zlib1g-dev'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
=== Obtain Xen3 Binary Distribution ===&lt;br /&gt;
&lt;br /&gt;
While you can apply the Xen patches and build a kernel [[Ubuntu Hacks/Administration#Build Kernels the Ubuntu Way|[Hack #78]]], the simpler approach for now is to just grab the latest prebuilt binaries from the Xen project and install them using the provided installer. To reduce load on the Xen project infrastructure, the developers request that P2P systems such as BitTorrent be used to fetch the binaries where possible, but if you submit your email address, they will also provide you with a direct download link if you prefer. Visit ''http://www.xensource.com/xen/downloads'' for more information. For Ubuntu, the item you need to download is the Xen 3.0 Tarball. (Even if you're on a single-processor system, it's OK to download the one marked 32-bit SMP.)&lt;br /&gt;
&lt;br /&gt;
=== Extract Binary Distribution ===&lt;br /&gt;
&lt;br /&gt;
Once you've downloaded the binary distribution, just unpack it and run the provided install script:&lt;br /&gt;
&lt;br /&gt;
 $ '''tar zxf xen-3.0.1-install-[arch].tgz'''&lt;br /&gt;
 $ '''cd xen-3.0.1-install'''&lt;br /&gt;
 $ '''sudo ./install.sh'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
The install script places a number of special kernels and ''initrd'' images in ''/boot'', so assuming all went well you should now have quite a few extra items in there.&lt;br /&gt;
&lt;br /&gt;
=== Configure GRUB Bootloader ===&lt;br /&gt;
&lt;br /&gt;
GRUB is designed to automatically detect new kernels and autoconfigure them, but unfortunately it doesn't manage the Xen kernels in quite the right way, so you will need to make some manual adjustments. Start by updating the autogenerated kernel list:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo update-grub'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
You should see GRUB report your new Xen kernels in addition to any that were previously installed. Now open the GRUB configuration file (''/boot/grub/menu.lst'') in your favorite editor and look down near the bottom for all the autogenerated kernel definitions. You should find one that looks something like this:&lt;br /&gt;
&lt;br /&gt;
 title           Ubuntu, kernel 2.6-xen0&lt;br /&gt;
 root            (hd0,0)&lt;br /&gt;
 kernel          /boot/vmlinuz-2.6-xen0 root=/dev/hda1 ro quiet splash&lt;br /&gt;
 boot&lt;br /&gt;
&lt;br /&gt;
To allow the Xen kernel to boot properly, the configuration stanza needs to be restructured. It's also a good idea to put the new stanza above the list of automagically detected kernels, so look for a line that reads:&lt;br /&gt;
&lt;br /&gt;
 ### BEGIN AUTOMAGIC KERNELS LIST&lt;br /&gt;
&lt;br /&gt;
and just before it, put in an entry using the same values as the autogenerated stanza but restructured to use a &amp;lt;tt&amp;gt;module&amp;lt;/tt&amp;gt; line like the one shown here, and with the &amp;lt;tt&amp;gt;kernel&amp;lt;/tt&amp;gt; line modified as shown:&lt;br /&gt;
&lt;br /&gt;
 title           Ubuntu, kernel 2.6-xen0 static&lt;br /&gt;
 root            (hd0,0)&lt;br /&gt;
 '''kernel          /boot/xen-3.0.1.gz console=vga'''&lt;br /&gt;
                '''module          /boot/vmlinuz-2.6-xen0 root=/dev/hda1 ro console=tty0'''&lt;br /&gt;
 boot&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;static&amp;lt;/tt&amp;gt; entry in the title is just a label so that when GRUB displays a list of available kernels, you can tell which ones were added automagically and which one is your statically defined kernel.&lt;br /&gt;
&lt;br /&gt;
Now tell GRUB to update its kernel list again, just to make sure you haven't made any mistakes:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo update-grub'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
=== Xen Services ===&lt;br /&gt;
&lt;br /&gt;
Xen needs to start up a number of services at bootup, so set appropriate runlevel symlinks:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo update-rc.d xend defaults 20 21'''&lt;br /&gt;
 $ '''sudo update-rc.d xendomains defaults 21 20'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
=== Enable Networking ===&lt;br /&gt;
&lt;br /&gt;
Virtual machines you run on your host will most likely need some way to make network connections. Obviously, they don't have actual Ethernet cards installed in their virtual motherboards, so the usual solution is to have the host machine provide a virtual &amp;quot;bridge&amp;quot; from its own networking stack to the guest system. Each guest virtual machine can then be assigned its own IP address and even a virtual MAC address, with packets passing through the virtual bridge, into the host networking stack, and finally out the host's Ethernet card and onto the real network.&lt;br /&gt;
&lt;br /&gt;
To keep everything as secure as possible, it's also a good idea to implement firewalling within the ''dom0'' host to prevent external machines attacking the ''domU'' guests.&lt;br /&gt;
&lt;br /&gt;
Install the packages required to provide network connectivity and network-management services to the guest operating systems:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo apt-get install iproute bridge-utils screen ssh'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
=== Disable TLS Libraries ===&lt;br /&gt;
&lt;br /&gt;
The standard Thread Local Storage (TLS) library is incompatible with the Xen kernel, so it's necessary to either disable the library or replace it with a special Xen-friendly version before attempting to reboot with the Xen kernel. Otherwise, an emulation mode is used within Xen that reduces performance considerably.&lt;br /&gt;
&lt;br /&gt;
The simplest solution for now is to move the library aside so it's not available when the host reboots:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo mv /lib/tls /lib/tls.disabled'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
If necessary, you can always move it back later if you need it for a non-Xen kernel.&lt;br /&gt;
&lt;br /&gt;
For running heavily threaded code, you may prefer to install a ''nosegneg'' (no segmentation negotiation) version of the library.&lt;br /&gt;
&lt;br /&gt;
=== Reboot ===&lt;br /&gt;
&lt;br /&gt;
You should now be ready to reboot your ''dom0'' host with the Xen kernel, so &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;reboot&amp;lt;/tt&amp;gt; and make sure GRUB loads the correct kernel when it restarts. You can also double-check the kernel version once the machine has finished booting:&lt;br /&gt;
&lt;br /&gt;
 $ '''uname -r'''&lt;br /&gt;
 2.6.12.6-xen0&lt;br /&gt;
&lt;br /&gt;
Your ''dom0'' machine is now ready to host guest ''domU'' virtual machines, so either download a pre-prepared image or create your own [[Ubuntu Hacks/Virtualization and Emulation#Create an Ubuntu/Xen Virtual Machine|[Hack #91]]].&lt;br /&gt;
&lt;br /&gt;
== Create an Ubuntu/Xen Virtual Machine ==&lt;br /&gt;
&lt;br /&gt;
'''Install Ubuntu into a virtual-machine image and boot it using Xen.'''&lt;br /&gt;
&lt;br /&gt;
The previous hack showed you how to set up a Xen server [[Ubuntu Hacks/Virtualization and Emulation#Use Xen to Host Virtual Machines|[Hack #90]]]. To make use of your newly Xen-enabled host, you need to create some ''domU'' virtual machines to run on it. In this hack, you'll set up a basic Dapper ''virtual machine'' (VM).&lt;br /&gt;
&lt;br /&gt;
=== Prepare VM Filesystems ===&lt;br /&gt;
&lt;br /&gt;
The VM needs both root and swap filesystems. In a production environment, these would most likely be stored on some form of shared-access filesystem, such as a SAN or similar, but, to keep things simple, for now you should create them as loopback disk images on the local disk. So start by making a couple of directories to store them in:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo mkdir -p /vm/vm_base'''&lt;br /&gt;
 $ '''sudo mkdir /vm/images'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
==== Root filesystem ====&lt;br /&gt;
&lt;br /&gt;
The root filesystem will be a 2 GB image, so first use ''dd'' to create a disk image and then use ''mkfs'' to set up a filesystem in it. 2 GB should be enough space for initial testing, but if you want to vary the size, just change the &amp;lt;tt&amp;gt;count&amp;lt;/tt&amp;gt; argument, which, when multiplied by the &amp;lt;tt&amp;gt;bs&amp;lt;/tt&amp;gt; (block size) argument, determines the total disk size.&lt;br /&gt;
&lt;br /&gt;
While ''mkfs'' is running, it will complain that ''vm_base.img'' is not a special block device and ask if you want to proceed anyway. Say &amp;lt;tt&amp;gt;y&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo dd if=/dev/zero of=/vm/images/vm_base.img bs=1024k count=2000'''&lt;br /&gt;
 $ '''sudo mkfs.ext3 /vm/images/vm_base.img'''&lt;br /&gt;
                &lt;br /&gt;
&lt;br /&gt;
==== Swap filesystem ====&lt;br /&gt;
&lt;br /&gt;
You can create a 200 MB swap image in a similar way:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo dd if=/dev/zero of=/vm/images/vm_base-swap.img bs=1024k count=200'''&lt;br /&gt;
 $ '''sudo mkswap /vm/images/vm_base-swap.img'''&lt;br /&gt;
                &lt;br /&gt;
&lt;br /&gt;
==== Mount the root filesystem image ====&lt;br /&gt;
&lt;br /&gt;
Mount the root filesystem image as a loopback device, allowing it to appear as a separate volume, even though it's only an image stored on the local disk:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo mount -o loop /vm/images/vm_base.img /vm/vm_base'''&lt;br /&gt;
                &lt;br /&gt;
&lt;br /&gt;
=== Install Ubuntu into the Root Filesystem ===&lt;br /&gt;
&lt;br /&gt;
Now you have the equivalent of a blank disk just waiting to have Linux installed on it. The system you install will become the ''domU'' virtual machine that is booted by Xen. Installing into a different volume can be a tricky exercise, but luckily Debian provides an extremely useful tool called ''debootstrap'' that takes care of all the hard work for you. First, grab ''debootstrap'':&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo apt-get install debootstrap'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
Then, use it to build a new Breezy base system into the root filesystem. The installation process has been radically overhauled for Dapper, so for now it's easier to install Breezy first and ''dist-upgrade'' to Dapper afterwards:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo debootstrap --arch i386 breezy /vm/vm_base/ \\'''&lt;br /&gt;
                '''&amp;lt;nowiki&amp;gt;  http://archive.ubuntu.com/ubuntu&amp;lt;/nowiki&amp;gt;'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;tip&amp;quot;&amp;gt;&lt;br /&gt;
'''Tip'''&lt;br /&gt;
&lt;br /&gt;
If you're wondering why you're installing Breezy, it's because ''base-config'' no longer exists in Dapper (the install process has been largely rewritten into a single-stage system, and we haven't yet figured out exactly how the initial configuration takes place). A simple workaround is to do a Breezy bootstrap and then update it to Dapper.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The preceding example specifies the architecture as &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; (32-bit Intel). You may need to specify an alternative, such as &amp;lt;tt&amp;gt;powerpc&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;amd64&amp;lt;/tt&amp;gt;, depending on your system architecture.&lt;br /&gt;
&lt;br /&gt;
Running ''debootstrap'' can take quite a long time because it needs to download all the packages, and if you need to go through this process several times, you may want to set up a local package cache [[Ubuntu Hacks/Package Management#Cache Packages Locally with Apt-cacher|[Hack #61]]] or replace the mirror address with a reference to ''file:///media/cdrom'' and use an Ubuntu install CD. If you have a local ''apt-cacher'' running already, you can include the cache address like so:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo debootstrap --arch i386 breezy /vm/vm_base/  \\'''&lt;br /&gt;
                '''&amp;lt;nowiki&amp;gt;  http://localhost/apt-cacher/archive.ubuntu.com/ubuntu&amp;lt;/nowiki&amp;gt;'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
=== Configure the Virtual Machine ===&lt;br /&gt;
&lt;br /&gt;
At this point, you have a basic Ubuntu install, but it's totally unconfigured. If your host machine is running Ubuntu, you can save yourself some effort by copying in your ''/etc/apt/sources.list'' file:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo cp -a /etc/apt/sources.list /vm/vm_base/etc/apt/'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
Then edit ''/vm/vm_base/etc/apt/sources.list'' and change any references from &amp;lt;tt&amp;gt;dapper&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;breezy&amp;lt;/tt&amp;gt;, since you are starting with a base Breezy install.&lt;br /&gt;
&lt;br /&gt;
Now edit ''/vm/vm_base/etc/network/interfaces'' and set up the loopback address and a virtual eth0 interface. You will need to adjust these values to suit your own network. The address allocated to eth0 needs to be one that's not in use yet:&lt;br /&gt;
&lt;br /&gt;
 auto lo&lt;br /&gt;
 iface lo inet loopback&lt;br /&gt;
       address 127.0.0.1&lt;br /&gt;
       netmask 255.0.0.0&lt;br /&gt;
 &lt;br /&gt;
 auto eth0&lt;br /&gt;
 iface eth0 inet static&lt;br /&gt;
       address ''192.168.0.101''&lt;br /&gt;
       netmask ''255.255.255.0''&lt;br /&gt;
       gateway ''192.168.0.1''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
Edit ''/vm/vm_base/etc/hostname'' and set it to &amp;lt;tt&amp;gt;vm01&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Edit ''/vm/vm_base/etc/hosts'' and put in some basic entries:&lt;br /&gt;
&lt;br /&gt;
 127.0.0.1 localhost.localdomain   localhost  vm01&lt;br /&gt;
 &lt;br /&gt;
 # The following lines are desirable for IPv6 capable hosts&lt;br /&gt;
 ::1    ip6-localhost ip6-loopback&lt;br /&gt;
 fe00::0 ip6-localnet&lt;br /&gt;
 ff00::0 ip6-mcastprefix&lt;br /&gt;
 ff02::1 ip6-allnodes&lt;br /&gt;
 ff02::2 ip6-allrouters&lt;br /&gt;
 ff02::3 ip6-allhosts&lt;br /&gt;
&lt;br /&gt;
The VM also needs to be given a filesystem configuration. Note that this is not necessarily the same as the configuration of the host, and the volume names have nothing to do with your actual local disk. The volumes that the VM will see when it starts up are virtual volumes that will be determined by the Xen configuration, so for now just edit ''/vm/vm_base/etc/fstab'' and set it up like this:&lt;br /&gt;
&lt;br /&gt;
 /dev/hda1       /           ext3    defaults  1   2&lt;br /&gt;
 /dev/hda5       none        swap    sw        0   0&lt;br /&gt;
 /dev/pts        devpts      gid=5,mode=620    0   0&lt;br /&gt;
 none            /dev/shm    tmpfs   defaults  0   0&lt;br /&gt;
&lt;br /&gt;
=== Run Setup Within the VM Image ===&lt;br /&gt;
&lt;br /&gt;
Use ''chroot'' to switch into the root of the VM filesystem:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo chroot /vm/vm_base'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
From now on, everything you do will be within the context of the VM, so you can manually invoke the tools that are normally run in the last stages of the regular Ubuntu installer. Make sure the universe repository [[Ubuntu Hacks/Package Management#Modify the List of Package Repositories|[Hack #60]]] is enabled in ''sources.list'' (Breezy has a ''universe'' repository as well), and tell ''apt'' to update the package list and then set up locales:&lt;br /&gt;
&lt;br /&gt;
 # '''apt-get update'''&lt;br /&gt;
 # '''apt-get install localeconf'''&lt;br /&gt;
 # '''dpkg-reconfigure localeconf'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
You will then be asked a series of questions when the &amp;lt;tt&amp;gt;localeconf&amp;lt;/tt&amp;gt; package is installed and then additional questions when you reconfigure it:&lt;br /&gt;
&lt;br /&gt;
;Manage locale configuration files with debconf?&lt;br /&gt;
: Answer Yes.&lt;br /&gt;
;Replace existing locale configuration files?&lt;br /&gt;
: Answer Yes.&lt;br /&gt;
;Default system locale&lt;br /&gt;
: Select the applicable default, such as ''en_US ISO-8859-1''.&lt;br /&gt;
;Environment settings that should override the default locale&lt;br /&gt;
: Don't select any options; just select OK to proceed.&lt;br /&gt;
&lt;br /&gt;
At this point, many of the standard devices don't exist and locale generation won't be working, so mount the ''proc'' virtual filesystem and create the default devices:&lt;br /&gt;
&lt;br /&gt;
 # '''mount -t proc proc /proc'''&lt;br /&gt;
 # '''cd /dev'''&lt;br /&gt;
 # '''./MAKEDEV generic'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
When ''MAKEDEV'' finishes, run ''base-config'' to bootstrap the system:&lt;br /&gt;
&lt;br /&gt;
 # '''base-config'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
''base-config'' will ask you all the usual questions that you normally see when running the Ubuntu Breezy installer, so answer all the questions as normal, with one exception: when asked to specify an access method for ''apt'', select &amp;quot;edit sources list by hand,&amp;quot; which will then put you into the ''vim'' editor with the ''sources.list'' file open. Since it's already set up correctly, just type &amp;lt;tt&amp;gt;ZZ&amp;lt;/tt&amp;gt; to save and exit ''vim'', and let ''apt'' run through the process of verifying the repositories and installing all the base packages.&lt;br /&gt;
&lt;br /&gt;
Once the Breezy installer has finished, edit the ''/etc/apt/sources.list'' again, and this time change all references from &amp;lt;tt&amp;gt;breezy&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;dapper&amp;lt;/tt&amp;gt;. Then update the package list again and ''dist-upgrade'' to Dapper:&lt;br /&gt;
&lt;br /&gt;
 # '''apt-get update'''&lt;br /&gt;
 # '''apt-get dist-upgrade'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
You now have a basic Dapper install inside the loopback filesystem, so finally you can exit the chroot:&lt;br /&gt;
&lt;br /&gt;
 # '''exit'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
=== Get Ready to Crank Up the VM ===&lt;br /&gt;
&lt;br /&gt;
The ''domU'' virtual machine will be booted using the Xen kernel installed on the ''dom0'' host, so copy the kernel modules into its filesystem, disable TLS, and unmount the image:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo cp -dpR /lib/modules/2.6.12.6-xenU /vm/vm_base/lib/modules/'''&lt;br /&gt;
 $ '''sudo mv /vm/vm_base/lib/tls /vm/vm_base/lib/tls.disabled'''&lt;br /&gt;
 $ '''sudo umount /vm/vm_base'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
It's quite likely that ''umount'' will complain that the device is busy even though nothing is using it anymore, so ignore the warning.&lt;br /&gt;
&lt;br /&gt;
You now have one complete, functional ''domU'' virtual machine, but it's quite likely that you will ultimately want to create a few of them, so rather than boot the image you just created, it's best to treat it as a template and make copies of it to play with.&lt;br /&gt;
&lt;br /&gt;
Copy the disk image to create a new VM:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo cp -a /vm/images/vm_base.img /vm/images/vm01.img'''&lt;br /&gt;
 $ '''sudo cp -a /vm/images/vm_base-swap.img /vm/images/vm01-swap.img'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
=== Configure the VM in Xen ===&lt;br /&gt;
&lt;br /&gt;
You need to create a configuration file for each ''domU'' virtual machine so that Xen will know how to boot it. Start by copying the sample configuration file into place:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo cp /etc/xen/xmexample1 /etc/xen/vm01.conf'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
The sample config file is very well commented, and most of the defaults are fine as a starting point, so open ''/etc/xen/vm01.conf'' in your favorite editor and start working through it. Highlights to pay attention to include:&lt;br /&gt;
&lt;br /&gt;
;Kernel&lt;br /&gt;
: The &amp;lt;tt&amp;gt;kernel&amp;lt;/tt&amp;gt; parameter specifies the path to the ''domU'' kernel in the host system. Note that the ''dom0'' and ''domU'' kernels are almost identical, so you can use the ''dom0'' kernel image to boot the ''domU'' guest if you prefer. The ''domU'' kernel is basically just the ''dom0'' kernel, but with most of the modules stripped out because networking and many other services are supplied by the ''dom0'' host and the virtual machine doesn't need to manage such things itself. This makes the ''domU'' kernel about 30 percent smaller than the ''dom0'' kernel.&lt;br /&gt;
;Memory&lt;br /&gt;
: The ''dom0'' host preallocates RAM to each virtual machine using the &amp;lt;tt&amp;gt;memory&amp;lt;/tt&amp;gt; parameter in the config file, so set it to some sensible value to start with, such as 128. You need to make sure you leave enough memory for the ''dom0'' host after all the ''domU'' guests have claimed their allocated address space; so if, for example, you have 512 MB RAM in the host, you could run three guests with 128 MB allocated each and still have 128 MB available for the host.&lt;br /&gt;
;Name&lt;br /&gt;
: Each ''domU'' host needs a unique name that will be used to identify it. Set it to &amp;lt;tt&amp;gt;vm01&amp;lt;/tt&amp;gt; for now.&lt;br /&gt;
;Virtual network interfaces&lt;br /&gt;
: You can specify virtual network interface settings directly in the config file or leave a blank value to have the guest specify its own settings. For now, just leave this blank because you configured a virtual eth0 interface earlier: &amp;lt;tt&amp;gt;vif =&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;[ '' ]&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dl&amp;gt;&lt;br /&gt;
&amp;lt;dt&amp;gt;Disk&lt;br /&gt;
&amp;lt;dd&amp;gt;The ''dom0'' host exposes real filesystems to the ''domU'' guest as if they were real filesystems, so the disk parameter allows you to specify what will be seen by the guest. For now, you should use the loopback disk images that were created earlier, so if you set up the guest's ''/etc/fstab'' in the way suggested earlier, you should set the disk parameter to:&lt;br /&gt;
&lt;br /&gt;
 disk = [ 'file:/vm/images/vm01.img,hda1,w','file:/vm/images/vm01-swap. ⏎&lt;br /&gt;
 img,hda5,w' ]&lt;br /&gt;
&lt;br /&gt;
The disk images don't have to be mounted: the &amp;lt;tt&amp;gt;file&amp;lt;/tt&amp;gt; argument tells Xen that it has to treat the target as a loopback disk image, and takes care of everything for you.&lt;br /&gt;
&amp;lt;/dl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Boot Your Virtual Machine ===&lt;br /&gt;
&lt;br /&gt;
Virtual machines are managed using ''xm'', the Xen Manager, which allows you to boot, shut down, list, and migrate them to other physical hosts. Start up your newly created VM:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo xm create -c /etc/xen/vm01.conf'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
If all goes well, you will see Linux run through its boot sequence all the way up to a login prompt into your virtual machine. Log in as the user you created during the setup process and poke around. Try a few things like:&lt;br /&gt;
&lt;br /&gt;
 $ '''cat /proc/cpuinfo'''&lt;br /&gt;
 $ '''cat /proc/meminfo'''&lt;br /&gt;
 $ '''uname -r'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
It should look exactly as if you're in a totally separate machine, and the network interface will be functional, with packets bridged to the physical Ethernet through the kernel in the ''dom0'' host so you can even &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;install&amp;lt;/tt&amp;gt; some packages or do whatever else you need to do to set up the virtual machine just the way you want it.&lt;br /&gt;
&lt;br /&gt;
While your virtual machine is still running, open another terminal session onto the ''dom0'' host and try running:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo xm list'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
to see a list of currently running guests. You can also view a dynamically updated list of hosts along with resource utilization:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo xm top'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
If you want to nicely bring down a VM without logging in to it, you can do so through ''xm'':&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo xm shutdown vm01'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
When you've finished playing around in your new VM, you can either shut it down from the ''dom0'' host using ''xm'' or shut it down from inside just like any other machine using &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt; &amp;lt;tt&amp;gt;shutdown&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Create Additional Guests ===&lt;br /&gt;
&lt;br /&gt;
To create additional guests, you need to repeat a number of the previous steps. Copy the templates again:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo cp -a /vm/images/vm_base.img /vm/images/vm02.img'''&lt;br /&gt;
 $ '''sudo cp -a /vm/images/vm_base-swap.img /vm/images/vm02-swap.img'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
Mount the base image:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo mount -o loop /vm/images/vm02.img /vm/vm_base'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
Edit ''/vm/vm_base/etc/network/interfaces'', ''/vm/vm_base/etc/network/hostname'', and ''/vm/vm_base/etc/network/hosts'' to set appropriate values for the hostname and IP address.&lt;br /&gt;
&lt;br /&gt;
Unmount the base image:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo umount /vm/vm_base'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
Copy the Xen configuration:&lt;br /&gt;
&lt;br /&gt;
 $ '''sudo cp /etc/xen/vm01.conf /etc/xen/vm02.conf'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
Then edit it to change the paths to the disk images and the machine name, and you're ready to start up a second VM.&lt;br /&gt;
&lt;br /&gt;
== Split Your Machine's Personality ==&lt;br /&gt;
&lt;br /&gt;
'''Give your machine split personalities by installing VMware Server, and get some virtual machines running.'''&lt;br /&gt;
&lt;br /&gt;
Virtualization is one of the current buzzwords in the computer industry. ''Virtualization'' is where a thin software layer is installed on a computer that allows its processor and other resources to be split among several virtual machines (VMs). This allows the computer operator to run several different operating systems underneath this virtualization layer. Each virtual machine has its own set of resources and operates independently from any other virtual machines that may be running at the same time.&lt;br /&gt;
&lt;br /&gt;
VMware (''http://www.vmware.com'') is one of the oldest companies in the virtualization business. It has had a Linux-based product lineup available for some time, both in the personal computer space (its Workstation product) and the server space (GSX and ESX server). Recently, however, VMware has released two new free (as in beer) products: VMware Player (''http://www.vmware.com/products/player/'') and VMware Server (''http://www.vmware.com/products/server/''). The VMware Player product allows you to &amp;quot;play,&amp;quot; or use, a premade virtual machine. The VMware Server product is much more interesting, as it allows the creation of new virtual machines, and its modular, network-enabled console lets you control the virtual machines whether they're installed on your computer or another computer on the network.&lt;br /&gt;
&lt;br /&gt;
VMware Server is like a Swiss army knife: its uses are limited only by your imagination. Need a particularly sticky Windows application working, but still want to run Linux? If it doesn't work in Wine [[Ubuntu Hacks/Virtualization and Emulation#Run Windows Applications|[Hack #87]]], you can install VMware Server and run that application in a virtual machine. Want to test the latest Linux distribution but have only one computer? Install the new distro in a virtual machine and don't worry about your main system.&lt;br /&gt;
&lt;br /&gt;
=== Installing VMware Server ===&lt;br /&gt;
&lt;br /&gt;
VMware Server is really designed for use on a Red Hat-based Linux distribution, but it does work fine on Ubuntu. However, it requires that some packages be in place before installation, since it has to compile the VMware-specific kernel modules. VMware also has a dependency on ''inetd'', if you want to remotely connect to your virtual machines from another computer on the network.&lt;br /&gt;
&lt;br /&gt;
To install VMware, start by installing the ''build-essential'' and ''netkit-inetd'' packages. If you use the ''aptitude'' package manager, the additional recommended packages will get installed without any other intervention (be sure to replace &amp;lt;tt&amp;gt;linux-headers-386&amp;lt;/tt&amp;gt; with the appropriate package for your architecture, such as &amp;lt;tt&amp;gt;linux-headers-686&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;linux-headers-k7&amp;lt;/tt&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
 bill@lexington:~$ '''sudo aptitude install build-essential \\'''&lt;br /&gt;
                '''  linux-headers-386 netkit-inetd'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
Next, get VMware Server from the download page (''http://www.vmware.com/download/server/''). You'll need to register on the site, and VMware will send you a serial number to activate your VMware Server installation. Ensure that you get the ''.tar.gz'' package, and not the ''rpm'' variant. Optionally, you can download the web interface and Windows console program separately. Once you've downloaded the package, untar it by running this command:&lt;br /&gt;
&lt;br /&gt;
 bill@lexington:~$ '''tar zxvf VMware-server-e.x.p-22088.tar.gz'''&lt;br /&gt;
             &lt;br /&gt;
&lt;br /&gt;
Then start VMware installer and answer the questions it asks. In most cases, you can accept the defaults. At the end of the installer, you will be prompted for your serial number. This was emailed to you by VMware after you registered, so check your mail for it:&lt;br /&gt;
&lt;br /&gt;
 bill@lexington:~/vmware-server-distrib$ '''sudo ./vmware-install.pl'''&lt;br /&gt;
 Password:&lt;br /&gt;
 Creating a new installer database using the tar3 format.&lt;br /&gt;
 &lt;br /&gt;
 Installing the content of the package.&lt;br /&gt;
 &lt;br /&gt;
 In which directory do you want to install the binary files?&lt;br /&gt;
 [/usr/bin]&lt;br /&gt;
 &lt;br /&gt;
 What is the directory that contains the init directories (rc0.d/ to rc6.d/)?&lt;br /&gt;
 [/etc]&lt;br /&gt;
 &lt;br /&gt;
 What is the directory that contains the init scripts?&lt;br /&gt;
 [/etc/init.d]&lt;br /&gt;
 &lt;br /&gt;
 In which directory do you want to install the daemon files?&lt;br /&gt;
 [/usr/sbin]&lt;br /&gt;
 &lt;br /&gt;
 In which directory do you want to install the library files?&lt;br /&gt;
 [/usr/lib/vmware]&lt;br /&gt;
 &lt;br /&gt;
 The path &amp;quot;/usr/lib/vmware&amp;quot; does not exist currently. This program is going to create it, including needed parent directories. Is this what&lt;br /&gt;
 you want? [yes]&lt;br /&gt;
 &lt;br /&gt;
 In which directory do you want to install the manual files?&lt;br /&gt;
 [/usr/share/man]&lt;br /&gt;
 &lt;br /&gt;
 In which directory do you want to install the documentation files?&lt;br /&gt;
 [/usr/share/doc/vmware]&lt;br /&gt;
 &lt;br /&gt;
 The path &amp;quot;/usr/share/doc/vmware&amp;quot; does not exist currently. This program is going to create it, including needed parent directories. Is this what you want? [yes]&lt;br /&gt;
 &lt;br /&gt;
 The installation of VMware Server e.x.p build-22088 for Linux completed&lt;br /&gt;
 successfully. You can decide to remove this software from your system at any&lt;br /&gt;
 time by invoking the following command: &amp;quot;/usr/bin/vmware-uninstall.pl&amp;quot;.&lt;br /&gt;
 &lt;br /&gt;
 Before running VMware Server for the first time, you need to configure it by&lt;br /&gt;
 invoking the following command: &amp;quot;/usr/bin/vmware-config.pl&amp;quot;. Do you want this program to invoke the command for you now? [yes]&lt;br /&gt;
 &lt;br /&gt;
 ... lots of output truncated ...&lt;br /&gt;
 &lt;br /&gt;
 The configuration of VMware Server e.x.p build-22088 for Linux for this running kernel completed successfully.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;tip&amp;quot;&amp;gt;&lt;br /&gt;
'''Tip'''&lt;br /&gt;
&lt;br /&gt;
See the VMware documentation for a detailed explanation of each installation and configuration option.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Running VMware Server ===&lt;br /&gt;
&lt;br /&gt;
Once this process is over, the VMware installer will have added a VMware Server entry to your Applications→System Tools menu (see [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-19|Figure 9-19]]). Click on this entry to start the VMware console.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-19&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-19. Starting the VMware console'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e26506.png|Starting the VMware console]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The VMware console is where you will create, manage, and interact with your virtual machines. Once the console starts, it will ask you if you want to connect to your locally installed VMware Server instance or connect over the network to another VMware server. Select &amp;quot;Local host,&amp;quot; as shown in [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-20|Figure 9-20]], and then click Connect.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-20&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-20. Connecting to a VMware Server'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e26515.png|Connecting to a VMware Server]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you've successfully connected to the VMware Server, you'll be presented with a screen in the console with various options (see [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-21|Figure 9-21]]). You're going to create a new virtual machine, so click &amp;quot;Create a new virtual machine.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-21&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-21. The main console window'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e26530.png|The main console window]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The New Virtual Machine wizard will start up. Select Next to move past the splash screen. The wizard will ask you if you'd like to use a typical or custom virtual machine configuration; select Typical and click on Next. Now you get to the meat of the wizard: what type of operating system you'd like to install (see [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-22|Figure 9-22]]). Select the guest OS family that you want to install in your new virtual machine and choose the version. Click Next to move on.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-22&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-22. Choosing your VM's operating system'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e26539.png|Choosing your VM's operating system]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point, you'll be prompted to name the new virtual machine and select a location to store its files. The defaults are usually fine here, unless you'd like to name the system something more descriptive. When you've named your machine, click on Next, and you'll be asked to select the type of networking you want for your virtual machine (see [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-23|Figure 9-23]]). There are several different types of network options: ''bridged networking'', where your virtual machine will appear as another host on your LAN; ''network address translation'', where your VM will be &amp;quot;firewalled&amp;quot; behind your host machine; and ''host-only'', where your VM can communicate only with the host computer. In this example, you'll select &amp;quot;Bridged networking.&amp;quot; Click on Next to continue.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-23&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-23. Selecting VM networking types'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e26557.png|Selecting VM networking types]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final screen, shown in [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-24|Figure 9-24]], lets you select how large you want the virtual machine's hard disk to be. We usually uncheck the &amp;quot;Allocate all disk space now&amp;quot; and &amp;quot;Split disk into 2GB files&amp;quot; boxes. If the &amp;quot;Allocate all disk space now&amp;quot; checkbox is selected, VMware Server will consume the amount of space specified in &amp;quot;Disk size&amp;quot; upon virtual-machine creation. If that box is unchecked, the virtual machine's disk will grow dynamically, so as you install the OS and add applications, the disk will gradually get larger. The only real reason to check that box is for performance reasons, as it is faster than dynamic allocation; otherwise, leave it unchecked. Click on Finish to complete the New Virtual Machine Wizard.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-24&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-24. Specifying VM disk size'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e26573.png|Specifying VM disk size]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point, your virtual machine is ready to be powered up for the first time and begin its OS installation. You can perform any tweaking to the virtual machine in the console here, prior to OS installation. All the items in the right pane are clickable and adjustable, such as the amount of RAM you want to dedicate to the VM and what installation media or mount point you wish to use. One cool thing about the VMware console is that you can install your virtual machine from a CD in your server, a CD in your client, or straight from an ''.iso'' image (select VM→Removable Devices→CD-ROM 1→Edit). All those installation options really make life easy and give you options when you're installing a virtual machine.&lt;br /&gt;
&lt;br /&gt;
All that remains at this point is to click the Power On button in the toolbar and watch your virtual machine boot for the first time. It will go through a virtual BIOS and POST check (see [[Ubuntu Hacks/Virtualization and Emulation#IDFigure9-25|Figure 9-25]]), and then it'll begin installing from whatever boot media you selected. You'll need to click in the console window to &amp;quot;capture&amp;quot; your mouse and keyboard for use in VMware (to get back to your main OS, press Ctrl and Alt on your keyboard at the same time).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&amp;quot;IDFigure9-25&amp;quot;&amp;gt;&lt;br /&gt;
'''Figure 9-25. First boot'''&lt;br /&gt;
&lt;br /&gt;
[[Image:Ubuntu Hacks_d1e26593.png|First boot]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you start using VMware, you'll find new uses and ways to leverage virtual machines that you never thought possible. We've even used a virtual machine to kick-start other physical Linux boxes!&lt;/div&gt;</description>
			<pubDate>Fri, 07 Mar 2008 00:39:29 GMT</pubDate>			<dc:creator>Docbook2Wiki</dc:creator>			<comments>http://commons.oreilly.com/wiki/index.php/Talk:Ubuntu_Hacks/Virtualization_and_Emulation</comments>		</item>
	</channel>
</rss>