<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>All About LAMP &#187; Xen</title>
	<atom:link href="http://allaboutlamp.com/tag/xen/feed/" rel="self" type="application/rss+xml" />
	<link>http://allaboutlamp.com</link>
	<description>Create web applications with Linux, Apache, MySQL, PHP and other open source technologies</description>
	<lastBuildDate>Sun, 08 Jan 2012 15:45:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to Setup Virtual Machines using Xen</title>
		<link>http://allaboutlamp.com/2009/12/how-to-setup-virtual-machines-using-xen/</link>
		<comments>http://allaboutlamp.com/2009/12/how-to-setup-virtual-machines-using-xen/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 09:33:00 +0000</pubDate>
		<dc:creator>Daniel Lam</dc:creator>
				<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[guest domain]]></category>
		<category><![CDATA[host domain]]></category>
		<category><![CDATA[lenny]]></category>
		<category><![CDATA[Xen]]></category>
		<category><![CDATA[xen-tools]]></category>

		<guid isPermaLink="false">http://allaboutlamp.com/?p=134</guid>
		<description><![CDATA[Xen is a great open source platform to create multiple virtual machines in one 
physical machine. This article describes how to setup a Xen host domain in a PC 
and how to create a Xen guest domain on it.
]]></description>
			<content:encoded><![CDATA[<p><!-- Title<br />
How to Setup Virtual Machines using Xen?<br />
--></p>
<p><span style="text-decoration: underline;"><strong>Overview</strong></span></p>
<p>Xen is a great open source platform to create multiple virtual machines in one physical machine. This article describes how to setup a Xen host domain in a PC and how to create a Xen guest domain on it.</p>
<p><span style="text-decoration: underline;"><strong>Context</strong></span></p>
<p>This article is for those who are new to Xen and with basic unix knowledge. It aims to provide easy-to-follow instructions for readers to start experimenting with Xen, as well as explaining the key concepts behind the setup. </p>
<p>Debian 5.0 Lenny is used as the operating system for the Xen host and guest domains in these instructions. Setup for other operating systems may be similar but are not covered in this article.</p>
<p><span style="text-decoration: underline;"><strong>Solution</strong></span></p>
<p>Virtualisation technologies like Xen make it possible to run multiple virtual machines concurrently in one physical machine. This allows you to, for example, </p>
<ul>
<li>Set up a team development environment and multiple testing environments in one physical machine, </li>
<li>Set up a 10-machine virtual network to test various network configurations, </li>
<li>Try out various linux distros and Windows in one PC. </li>
</ul>
<p>This is also the core technology that made cloud computing a reality. In fact, Xen is used by service providers like Rackspace to provide virtual machines to their customers.</p>
<p>Xen is not an operating system that lets you put new systems on it &#8211; it is more like a software package in a linux operating system, except that it is so tightly integrated with the core system processes that it becomes part of the operating system (the kernel). </p>
<p>A great way to see Xen in action is by downloading the <a href="http://wiki.xensource.com/xenwiki/LiveCD" target="new">Xen Live CD</a> image, create the CD and boot from it. It shows what a complete Xen system looks like. Note that the Xen Live CD is for demonstration only &#8211; you cannot install a host domain from it.</p>
<p>Another definitive knowledge source for Xen is through its <a href="http://wiki.xensource.com/xenwiki/XenDocs" target="new">User Manual</a>.</p>
<p>We will set up a Xen system with host and guest domains through the following steps:</p>
<ol>
<li>Pre-requisits</li>
<li>Install Debian 5.0 Lenny</li>
<li>Install Xen on Debian 5.0 Lenny to turn it to a Host Domain</li>
<li>Install Debian as a Guest Domain on the Host Domain</li>
</ol>
<p><span style="text-decoration: underline;"><strong>1. Pre-requisits</strong></span></p>
<p>Before you begin, first check if your physical PC has what you need:</p>
<ul>
<li><b>Memory</b> &#8211; As with other applications, the more the better. A 2GB RAM machine was used for the exercise in this article but less should be okay.</li>
<li><b>Hard disk</b> &#8211; Again, the more the better. It depends how many virtual machines you plan to create and what will be run in them. 10GB for each virtual machine will usually be more than enough. As a baseline indicator, the Xen Live CD is able to squeeze one host and one activated guest domain in one CD-ROM.</li>
<li><b>CPU</b> &#8211; Any modern Intel/AMD processor should do. For this exercise, the machine in use has an Intel Pentium 4 3.4 GHz processor.</li>
<li><b>Operating System</b> &#8211; According to the Xen User Manual, any &#8220;working Linux distribution using the GRUB bootloader&#8221; will do. More on this in the next section.</li>
</ul>
<p><span style="text-decoration: underline;"><strong>2. Install Debian 5.0 Lenny</strong></span></p>
<p>First of all, you need a linux operating system in the machine before you can install Xen on it. This OS will automatically become the <i>host domain</i>, also known as <i>domain 0</i> of Xen after Xen is installed, and will be used to control the other virtual machines (<i>guest domains</i>).</p>
<p>Personally, I recommend installing only the Xen host and guest domains in one PC (it is complex enough!), therefore you should wipe the PC clean when you do the installation described in this section.</p>
<p>Installing Debian 5.0 Lenny is simple &#8211; simply download the <a href="http://www.debian.org/CD/http-ftp/#stable" target="new">first CD-ROM image</a>, burn the CD, then boot from it and follow on-screen instructions. Note that there are 31 (!) CD-ROM images in total for Debian 5.0 Lenny, but only the first one is required to create a basic installation as the Xen host domain.</p>
<p>During installation, note that</p>
<ul>
<li><b>Partitioning</b> &#8211; Allocating 10 GB to the primary partition for the host domain will be more than enough. You probably also want to define a few logical partitions in the extended partition, so that Xen guest domains can be installed on them later. If 10 GB seems too much for you, consider at least allocating 4 GB to host domain, as Debian, Xen packages and related tools would have taken 3 GB of space. </li>
<li><b>Select and Install Software</b> &#8211; Select &#8220;Desktop Environment&#8221; and &#8220;Standard System&#8221; only. Your host domain should only do resource allocation and monitoring for your guest domains and should not carry other roles.</li>
</ul>
<p>Perhaps you wonder if the other linux distros will do a better job as a Xen host domain, like I did. Here are some analysis after a few hours of online research,</p>
<ul>
<li><b>Fedora Core</b> &#8211; Fedora Core used to be one of the popular candidates for Xen host domain OS, however it no longer supports Xen (as a host domain) starting from Fedora Core 8.</li>
<li><b>Ubuntu</b> &#8211; Ubuntu is one of the popular candidates for Xen host domain OS. It was almost used in this exercise &#8211; However, installing Ubuntu 9.10 was not successful and that was the end of the quest (the installation CD keeps being read after choosing &#8220;Install Ubuntu&#8221; in menu, and does not proceed).</li>
<li><b>Debian</b> &#8211; Debian is also popular. Plus, it was chosen as the Host Domain OS in the Xen Live CD, which provides a good source of reference for configuration issues.</li>
</ul>
<p><span style="text-decoration: underline;"><strong>3. Install Xen on Debian 5.0 Lenny to turn it to a Host Domain</strong></span></p>
<p>Because of the many Linux distributions and their many verions, combined with the multiple verisions of Xen for them, and also the fact that there are multiple ways to install Xen, online instructions can be very confusing.</p>
<p>According to the Xen User Manual, there are three approaches in installing Xen. </p>
<ol>
<li><b>Installing from Binary Tarball</b> &#8211; Download a tar file and running the install script</li>
<li><b>Installing from RPMs</b> &#8211; Use rpm command to get and install Xen</li>
<li><b>Installing from Source</b> &#8211; Download source codes and build binaries manually</li>
</ol>
<p>For Debian 5.0 Lenny, running the single command below as root user will be able to download and install Xen for you. This is similar to &#8220;Installing from RPMs&#8221; approach, except rpm is mainly used in Fedora Core.</p>
<p><code>apt-get install xen-linux-system-2.6.26-2-xen-686</code></p>
<p>After installation, reboot the computer. The GRUB boot loader should now have three new options, adding to the original two,</p>
<ul>
<li>Xen&#8230;</li>
<li>Debian&#8230; -xen &#8230; </li>
<li>Debian&#8230; -xen &#8230; (single user mode)</li>
<li>Debian&#8230;   </li>
<li>Debian&#8230; (single user mode)</li>
</ul>
<p>Boot with the first option will start up the Xen host domain. After logging in, run the command below as root user</p>
<p><code>xm list</code></p>
<p>It should show that Domain-0 is now running.</p>
<p><span style="text-decoration: underline;"><strong>4. Install Debian as a Guest Domain on the Host Domain</strong></span></p>
<p>Compared to installing host domain, online documentations for installing guest domains can be even more confusing due to the many combinations of host and guest linux distributions.</p>
<p>Fortunately, <i>xen-tools</i> has made the task of getting, deploying and managing Xen guest domains relatively simple. First of all, run the following command as root user to install xen-tools.</p>
<p><code>apt-get install xen-tools</code></p>
<p>Read through <a href="http://www.virtuatopia.com/index.php/Building_a_Xen_Guest_Domain_using_Xen-Tools" target="new">this tutorial from Virtuatopia.com</a> to understand how xen-tools help you create a guest domain. There are also some useful information from the <a href="http://www.xen-tools.org/software/xen-tools/" target="new">Xen Tools official site</a> and <a href="http://www.debian-administration.org/article/A_brief_introduction_to_xen-tools" target="new">another tutorial</a>.</p>
<p>These tutorials mentioned above should have answered most of your questions. Adding my my two-cents from my own experience,</p>
<ul>
<li>If you do not understand the differences between the <i>dir</i> and <i>lvm</i> options, consider reading chapter 6 <i>Storage and File System Management</i> in the <a href="http://tx.downloads.xensource.com/downloads/docs/user/" target="new">Xen User Manual</a>.</li>
<li>The LVM option is great &#8211; and there is a <a href="http://www.debian-administration.org/articles/410" target="new">detail tutorial here</a>.</li>
</li>
</ul>
<p>Assuming you have understood how xen-tools work and made required changes in <i>/etc/xen-tools/xen-tools.cfg</i> to suit your needs, you can run </p>
<p><code>xen-create-image --hostname &lt;hostname of virtual machine&gt; --ip &lt;IP of virtual machine&gt;</code></p>
<p>to create your guest domain. While the command is executing, you can use </p>
<p><code>tail -f /var/log/xen-tools/&lt;hostname of virtual machine&gt;.log</code></p>
<p>to check its progress.</p>
<p>If all went well, you should be able to see the your guest domain created as logical volumes in your specified volume group (or as files if you used that option), and also a Xen domain config file in /etc/xen/ with your virtual machine hostname as the filename. </p>
<p>Before you boot-up your newly created virtual machine, remember to modify the Xen config file, <i>/etc/xen/xend-config.sxp</i> and change &#8220;network-dummy&#8221; to &#8220;network-bridge&#8221; in the network-script option. Otherwise, if your virtual machine has been configured any network information (IP address, gateway, name server etc), you will see this error when booting up the virtual machine:</p>
<p><i>Error: Device 0 (vif) could not be connected. Could not find bridge, and none was specified</i></p>
<p>And remember to run</p>
<p><code>xend restart</code></p>
<p>for the change to take effect.</p>
<p>And finally, if all went well, run this </p>
<p><code>xm create /etc/xen/&lt;hostname of virtual machine&gt;.cfg -c</code></p>
<p>and your virtual machine will start up!</p>
]]></content:encoded>
			<wfw:commentRss>http://allaboutlamp.com/2009/12/how-to-setup-virtual-machines-using-xen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to avoid Time Reset in a Cloud Computing environment such as Xen VPS (Virtual Private Server)</title>
		<link>http://allaboutlamp.com/2009/10/how-to-avoid-time-reset-in-cloud-computing-environment-xen-vps/</link>
		<comments>http://allaboutlamp.com/2009/10/how-to-avoid-time-reset-in-cloud-computing-environment-xen-vps/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 03:34:39 +0000</pubDate>
		<dc:creator>Daniel Lam</dc:creator>
				<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[clock drift]]></category>
		<category><![CDATA[ntpd]]></category>
		<category><![CDATA[ntpdate]]></category>
		<category><![CDATA[time reset]]></category>
		<category><![CDATA[time zone]]></category>
		<category><![CDATA[virtualisation]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://allaboutlamp.com/?p=47</guid>
		<description><![CDATA[Your server is a virtual private server running Fedora (or other linux distro) on a cloud computing service such as RackSpace Cloud Server. For some reason, whenever you change the system time, it gets reset back after a system restart. Why did that happen? Could it be fixed?]]></description>
			<content:encoded><![CDATA[<p><span style="text-decoration: underline;"><strong>Overview</strong></span></p>
<p>Your server is a virtual private server running Fedora (or other linux distro) on a cloud computing service such as RackSpace Cloud Server. For some reason, whenever you change the system time, it gets reset back after a system restart. Why did that happen? Could it be fixed?</p>
<p><span style="text-decoration: underline;"><strong>Context</strong></span></p>
<p>Solution described in this article applies to Fedora Core 11 hosted in a Xen VPS environment. Other Fedora verions or linux distro in other virtualisation environment may have similar setup. Xen configuration is outside the scope of this article.</p>
<p><span style="text-decoration: underline;"><strong>Solution</strong></span></p>
<p>As a virtual server hosted using Xen virtualisation technology, such as those offered by RackSpace Cloud Server offer, system time will get reset by Xen to match the physical machine&#8217;s clock whenever the virtual server is restarted.</p>
<p>This time-reset behaviour can be modified if you can change the Xen configuration. However as a user of the cloud computing service, you most likely do not have such access.</p>
<p>You can however do the following to set your system to the time you want.</p>
<p><strong>1. Change time zone</strong></p>
<p>Changing the time zone of your system will set your system time to the correct time of that time zone, given that your virtualisation provider gives your server a correct <a href="http://en.wikipedia.org/wiki/Coordinated_Universal_Time">UTC time</a>.</p>
<p>To change the time zone in Fedora Core 11,</p>
<ul>
<li>Change the ZONE parameter value in <em>/etc/sysconfig/clock</em> according to your desired time zone, e.g. <em>ZONE=&#8221;Australia/Sydney&#8221;</em>. The list of possible values for ZONE can be found in <em>/usr/share/zoneinfo/</em>. The UTC parameter in <em>/etc/sysconfig/clock</em> can be omitted.</li>
<li>Copy the correct time zone file to <em>/etc/localtime</em>. For example, if you want to set time zone to Sydney in Australia, do <code>cp /usr/share/zoneinfo/Australia/Sydney /etc/localtime</code></li>
</ul>
<p><strong>2. Use a time-synchronising tool</strong></p>
<p>After you have set your system to the correct time zone, the time may still be inaccurate because it simply relies on the time given by the virtualisation provider.</p>
<p>To compensate any inaccuracy from virtualisation provider, use time-synchronising tool like <em>ntpdate</em> to sychronise your server with publicly-available time servers.</p>
<ol>
<li>Install ntpdate if it is not already installed in your system. Run <code>yum install ntpdate</code> to install ntpdate.</li>
<li>Turn on ntpdate service using <code>chkconfig --level 3 ntpdate on</code> so that time will be sync&#8217;d on boot time. Note that your &#8220;level&#8221; may be different, check <em>/etc/inittab</em> to be sure.</li>
<li>Use cron job to run ntpdate hourly or daily to keep an accurate time in the long term.</li>
</ol>
<p>Note that in a virtualisation environment, <em>ntpd</em> will not be able to set the time of guest system properly because of the CPU time-sharing nature of virtualisation technology. Refer to ntp docs for more information: <a href="http://support.ntp.org/bin/view/Support/VMWareNTP">http://support.ntp.org/bin/view/Support/VMWareNTP</a></p>
<p><strong>3. Use date command to change system date and do not restart</strong></p>
<p>If setting your system to match specific time zones accurately still does not fulfill your requirement (e.g. if you want your time to be 15 minutes behind, for testing purpose), you can still change your system time using date command. However keep in mind that this will be reset back to the correct time of your time zone after a restart.</p>
<p><span style="text-decoration: underline;"><strong>Reference</strong></span></p>
<ul>
<li><a href="http://support.ntp.org/bin/view/Support/VMWareNTP">http://support.ntp.org/bin/view/Support/VMWareNTP</a> Network Time Protocol documentation regarding the virtualisation environment.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://allaboutlamp.com/2009/10/how-to-avoid-time-reset-in-cloud-computing-environment-xen-vps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

