<?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>felixdv blog &#187; Linux</title>
	<atom:link href="http://blog.felixdv.com/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.felixdv.com</link>
	<description></description>
	<lastBuildDate>Tue, 05 Apr 2011 12:18:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Easy subdomains with mod_rewrite</title>
		<link>http://blog.felixdv.com/2010/06/16/easy-subdomains-with-mod_rewrite/</link>
		<comments>http://blog.felixdv.com/2010/06/16/easy-subdomains-with-mod_rewrite/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 16:18:36 +0000</pubDate>
		<dc:creator>felixdv</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[url rewriting]]></category>
		<category><![CDATA[vhost]]></category>

		<guid isPermaLink="false">http://blog.felixdv.com/?p=190</guid>
		<description><![CDATA[Because I like to play with a lot of projects and code, I create subdomains for felixdv.com almost every day. Instead of going through the hassle of creating a CNAME or A record for every subdomain, creating an Apache vhost file and enabling it and creating the necessary directory structure, I figured there&#8217;s an easier [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.felixdv.com/wp-content/uploads/2010/06/rewrite-150x127.png" alt="" title="mod rewrite" width="150" height="127" class="alignright size-thumbnail wp-image-197" />Because I like to play with a lot of projects and code, I create subdomains for felixdv.com almost every day. Instead of going through the hassle of creating a CNAME or A record for every subdomain, creating an Apache vhost file and enabling it and creating the necessary directory structure, I figured there&#8217;s an easier way to do so.</p>
<p>First thing to do is to create an *.example.com wildcard record for your domain. This way, you don&#8217;t need to create a DNS record every time you need a new subdomain. When this is done, check for the record for example using <code>dig</code>, and you should see something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ dig <span style="color: #000000; font-weight: bold;">*</span>.example.com
<span style="color: #666666; font-style: italic;"># .. skipping some output</span>
<span style="color: #000000; font-weight: bold;">;;</span> ANSWER SECTION:
<span style="color: #000000; font-weight: bold;">*</span>.example.com.          <span style="color: #000000;">3600</span>    IN      A       192.0.32.10</pre></div></div>

<p>Once that&#8217;s done and it&#8217;s pointing to your server, we need to create an <a href="http://apache.org">Apache</a> vhost which handles the requests with <a href="http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html">mod_rewrite</a>, which is a rules-based url rewriting module for apache, and can easily handle different subdomains and actions based on the subdomain.</p>
<p>We&#8217;re assuming you&#8217;re replacing the domain name, IP address and paths with your own, and you have a directory structure like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>example.com<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>example.com<span style="color: #000000; font-weight: bold;">/</span>subdomains<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>example.com<span style="color: #000000; font-weight: bold;">/</span>subdomains<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>example.com<span style="color: #000000; font-weight: bold;">/</span>subdomains<span style="color: #000000; font-weight: bold;">/&lt;</span>any subdomain<span style="color: #000000; font-weight: bold;">&gt;/</span></pre></div></div>

<p>Apache vhost (stripped version):</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">&lt;<span style="color: #000000; font-weight:bold;">VirtualHost</span> 192.0.32.10:<span style="color: #ff0000;">80</span>&gt;
        <span style="color: #00007f;">ServerName</span> <span style="color: #00007f;">example</span>.com
        <span style="color: #00007f;">ServerAlias</span> *.<span style="color: #00007f;">example</span>.com
        <span style="color: #00007f;">DocumentRoot</span> <span style="color: #7f007f;">&quot;/var/www/example.com&quot;</span>
&nbsp;
        <span style="color: #00007f;">RewriteEngine</span> <span style="color: #0000ff;">on</span>
        <span style="color: #adadad; font-style: italic;"># Rewrite everything for example.com to the</span>
        <span style="color: #adadad; font-style: italic;"># subdomains/www/ subdirectory</span>
        <span style="color: #00007f;">RewriteCond</span> %{HTTP_HOST} ^example\.com
        <span style="color: #00007f;">RewriteRule</span> ^(.*) /subdomains/www/$<span style="color: #ff0000;">1</span> [L]
&nbsp;
        <span style="color: #adadad; font-style: italic;"># Rewrite all other example.com subdomains</span>
        <span style="color: #adadad; font-style: italic;"># to their own directory</span>
        <span style="color: #00007f;">RewriteCond</span> %{HTTP_HOST} ^([^\.]+)\.<span style="color: #00007f;">example</span>\.com
        <span style="color: #00007f;">RewriteCond</span> /var/www/<span style="color: #00007f;">example</span>.com/subdomains/%1 -d
        <span style="color: #00007f;">RewriteRule</span> ^(.*) /subdomains/%1/$<span style="color: #ff0000;">1</span> [L]
&lt;/<span style="color: #000000; font-weight:bold;">VirtualHost</span>&gt;</pre></div></div>

<p>This way, you can just create a directory like <code>/var/www/example.com/subdomains/blog/</code> to make <a href="http://blog.example.com">http://blog.example.com</a> work. Easy like that!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.felixdv.com/2010/06/16/easy-subdomains-with-mod_rewrite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fosdem 2008</title>
		<link>http://blog.felixdv.com/2008/02/10/fosdem-2008/</link>
		<comments>http://blog.felixdv.com/2008/02/10/fosdem-2008/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 22:45:24 +0000</pubDate>
		<dc:creator>felixdv</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[oss]]></category>

		<guid isPermaLink="false">http://weblog.devliegher.be/2008/02/10/fosdem-2008/</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.fosdem.org"><img src="http://www.fosdem.org/promo/going-to" alt="I'm going to FOSDEM, the Free and Open Source Software Developers' European Meeting" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.felixdv.com/2008/02/10/fosdem-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iTunes music sharing in Linux with Banshee and DAAP</title>
		<link>http://blog.felixdv.com/2008/01/26/itunes-music-sharing-in-linux-with-banshee-and-daap/</link>
		<comments>http://blog.felixdv.com/2008/01/26/itunes-music-sharing-in-linux-with-banshee-and-daap/#comments</comments>
		<pubDate>Sat, 26 Jan 2008 21:09:01 +0000</pubDate>
		<dc:creator>felixdv</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://weblog.devliegher.be/2008/01/26/itunes-music-sharing-in-linux-with-banshee-and-daap/</guid>
		<description><![CDATA[This one is actually much simpler than I&#8217;ve anticipated. It&#8217;s what needs to be done if you are on Linux and want to share your music with the &#8216;Bonjour&#8217; protocol from Apple, to make your music appear on another computer in iTunes as shared music. You don&#8217;t need the iTunes application for sharing, a music [...]]]></description>
			<content:encoded><![CDATA[<p align="left">This one is actually much simpler than I&#8217;ve anticipated. It&#8217;s what needs to be done if you are on Linux and want to share your music with the <a href="http://en.wikipedia.org/wiki/Bonjour_(software)" title="Bonjour" target="_blank">&#8216;Bonjour&#8217;</a> protocol from Apple, to make your music appear on another computer in iTunes as shared music. You don&#8217;t need the iTunes application for sharing, a music player / manager supporting the <a href="http://en.wikipedia.org/wiki/Digital_Audio_Access_Protocol" title="DAAP" target="_blank">DAAP</a> protocol will do just fine. In this example, I use the <a href="http://banshee-project.org/Main_Page" title="Banshee" target="_blank">Banshee</a> music player for gnome under Ubuntu 7.10.</p>
<p> It basically comes down to this line:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># apt-get install banshee banshee-daap</span></pre></div></div>

<p>Then, go to the Edit -&gt; Plugins menu item, set the &#8216;Music Sharing&#8217; plugin active and have a look at the settings of the plugin to see how it can be configured (Not much to it, though).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.felixdv.com/2008/01/26/itunes-music-sharing-in-linux-with-banshee-and-daap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>About attaching and detaching Xen domU mounts</title>
		<link>http://blog.felixdv.com/2008/01/03/about-attaching-and-detaching-xen-domu-mounts/</link>
		<comments>http://blog.felixdv.com/2008/01/03/about-attaching-and-detaching-xen-domu-mounts/#comments</comments>
		<pubDate>Wed, 02 Jan 2008 23:19:46 +0000</pubDate>
		<dc:creator>felixdv</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://weblog.devliegher.be/2008/01/03/about-attaching-and-detaching-xen-domu-mounts/</guid>
		<description><![CDATA[If you ever need to replace a mount of a Xen domU guest without rebooting the server, you can&#8217;t just remount it and be done. In my case, I needed to increase the size of the swap file a certain DomU was using. Independent from mounting or unmounting a partition inside the DomU, Xen saves [...]]]></description>
			<content:encoded><![CDATA[<p> If you ever need to replace a mount of a Xen domU guest without rebooting the server, you can&#8217;t just remount it and be done. In my case, I needed to increase the size of the swap file a certain DomU was using.</p>
<p>Independent from mounting or unmounting a partition inside the DomU, Xen saves its virtual device information inside a logical structure in an information storage called the XenStore. So to change partition information without rebooting the image, you need to inform Xen that you&#8217;ll be changing things, and want to detach the virtual device (in our case, a swap file) from the DomU. This is the way:</p>
<p>In the domU that needs to be changed, turn off the swap space:<br />
<code># swapoff /dev/sda2</code></p>
<p>Then, in Dom0, list the domains for an overview:<br />
<code>xen1:~# xm list<br />
Name                                      ID Mem(MiB) VCPUs State   Time(s)<br />
myVM                                    17     2000     1 -b---- 134487.4</code></p>
<p>List the virtual block devices that are coupled to the specified domain:<br />
<code>xen1:~# xm block-list 17<br />
Vdev  BE handle state evt-ch ring-ref BE-path<br />
2049    0    0     4      6      8     /local/domain/0/backend/vbd/17/2049<br />
2050    0    0     4      7      9     /local/domain/0/backend/vbd/17/2050</code></p>
<p>Read what vdev is coupled to what device name inside the domU:<br />
<code>xen1:~# xenstore-read /local/domain/0/backend/vbd/17/2050/dev<br />
sda2</code></p>
<p>Detach the swap partition:<br />
<code>xen1:~# xm block-detach 17 2050</code></p>
<p>Create the new swap space (to create a 1G swap file):<br />
<code>xen1:~# dd if=/dev/zero of=/xen/swap/myVM.swap bs=1024k count=100</code></p>
<p>Attach the new swap partition back to the domain:<br />
<code>xen1:~# xm block-attach 17 file:/xen/swap/myVM.swap sda2 w</code></p>
<p>Then, with this in place, go back to the domU console, create the swap filesystem and activate it:<br />
<code># mkswap /dev/sda2<br />
# swapon /dev/sda2</code></p>
<p>That&#8217;s about it for updating a mount point inside the DomU. This can be done for every block device that a Xen DomU may use, as long as it isn&#8217;t system-critical, such as the root filesystem).</p>
<p>This procedure also makes use of some lesser known commands such as <em>xm block-attach</em>, <em>xm block-detach</em> and <em>xenstore-read</em>.<br />
Although there isn&#8217;t much documentation about these commands, they are worth checking out in case you would need them.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.felixdv.com/2008/01/03/about-attaching-and-detaching-xen-domu-mounts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

