<?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>Arricc &#187; Debian</title>
	<atom:link href="http://www.arricc.net/tags/debian/feed" rel="self" type="application/rss+xml" />
	<link>http://www.arricc.net</link>
	<description>50% IT snippets that I couldn&#039;t readily find existing help on. 50% drivel.</description>
	<lastBuildDate>Wed, 02 Mar 2011 23:44:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>User VHosting</title>
		<link>http://www.arricc.net/user-vhosting.php</link>
		<comments>http://www.arricc.net/user-vhosting.php#comments</comments>
		<pubDate>Tue, 29 Aug 2006 23:05:50 +0000</pubDate>
		<dc:creator>Fizzgig</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Wintermute]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.arricc.net/user-vhosting.php</guid>
		<description><![CDATA[So, previously, I detailed how to do web virtual hosting to directories on the file system. This is all well and good, but I want to have users pidgeon holed into their own directories, plus I want users own websites to be stored under their own directories in a similar format to that used in [...]]]></description>
			<content:encoded><![CDATA[<p>So, <a href="/vwebhosting.php">previously</a>, I detailed how to do web virtual hosting to directories on the file system. This is all well and good, but I want to have users pidgeon holed into their own directories, plus I want users own websites to be stored under their own directories in a similar format to that used in the previous article (eg. /home/user/web/example.org/subdomain)</p>
<p>The problem lies with mapping domain names (example.org) onto user accounts (Alice? Bob?). This is where Apache and mod_rewrite come to the rescue again. On Wintermute I&#8217;ve installed Apache 2, but this recipe will work just as well with Apache 1.3.<span id="more-24"></span></p>
<p>First, we create a file with domain names to username mappings:<br />
/etc/apache2/map.hosted<br />
<div class="codeblock"><code>wintermute:/etc/apache2# cat map.hosted<br />xeno-phon.co.uk: jimsin<br />starfallonline.co.uk: stillborn<br />ryanroberts.co.uk: stillborn<br />witchhunter.co.uk: stillborn<br />flushedphoenix.co.uk: flushedphoenix<br />shawree.co.uk: shawree<br />theballswinger.co.uk: the_ball_swinger<br />the-hearse.com: hobgoth<br /></code></div><br />
The pattern is &#8220;website.com: username&#8221; with one per line.<br />
Each of these usernames must also exist in the Xoops database (or as system users), but I&#8217;ll be covering the links to that DB in a later article.</p>
<p>Coming up with that file was the easy bit. The next bit was the major pain in the hole. I searched for aaaages to try and work out how to do this in php ( my php is significantly better than my Perl), but all the examples I could find were written in Perl. So, here are some keywords for search engines: how to write a mod_rewrite map in php not perl. php apache rewritemap.</p>
<p><div class="codeblock"><code>#!/usr/bin/php<br /><span class="synSpecial">&lt;?</span><br /><span class="synComment">//Optional log file.</span><br /><span class="synComment">#$log = fopen (&quot;/tmp/rwlist&quot;,'a');</span><br /><span class="synComment">//Map file</span><br /><span class="synStatement">$</span><span class="synIdentifier">mapIn</span> <span class="synStatement">=</span> <span class="synIdentifier">fopen</span><span class="synSpecial">(</span>&quot;<span class="synConstant">/etc/apache2/map.hosted</span>&quot;, &quot;<span class="synConstant">r</span>&quot;<span class="synSpecial">)</span>;<br /><span class="synComment">//Read in the file.</span><br /><span class="synComment">//NB: This is only done at startup, so if you change the file you have to reload Apache to get the changes recognised.</span><br /><span class="synStatement">while</span> <span class="synSpecial">((</span><span class="synStatement">$</span><span class="synIdentifier">data</span> <span class="synStatement">=</span> <span class="synIdentifier">fgetcsv</span><span class="synSpecial">(</span><span class="synStatement">$</span><span class="synIdentifier">mapIn</span>, <span class="synConstant">1000</span>, &quot;<span class="synConstant">:</span>&quot;<span class="synSpecial">))</span> <span class="synStatement">!==</span> <span class="synConstant">FALSE</span><span class="synSpecial">)</span> <span class="synSpecial">{</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">$</span><span class="synIdentifier">map</span><span class="synSpecial">[</span><span class="synStatement">$</span><span class="synIdentifier">data</span><span class="synSpecial">[</span><span class="synConstant">0</span><span class="synSpecial">]]</span> <span class="synStatement">=</span> <span class="synIdentifier">trim</span><span class="synSpecial">(</span><span class="synStatement">$</span><span class="synIdentifier">data</span><span class="synSpecial">[</span><span class="synConstant">1</span><span class="synSpecial">])</span>;<br /><span class="synSpecial">}</span><br /><span class="synIdentifier">fclose</span><span class="synSpecial">(</span><span class="synStatement">$</span><span class="synIdentifier">mapIn</span><span class="synSpecial">)</span>;<br /><span class="synComment">//Recursive function. Starts with the full domain name and gradually pops off segments until it finds an owner (or not).</span><br /><span class="synComment">//eg. www.sub.example.org - first checks for www.sub.example.org, then sub.example.org, then example.org and finally org.</span><br /><span class="synPreProc">function</span> checkUser<span class="synSpecial">(</span><span class="synStatement">&amp;$</span><span class="synIdentifier">url</span><span class="synSpecial">)</span><br /><span class="synSpecial">{</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span class="synType">global</span> <span class="synStatement">$</span><span class="synIdentifier">map</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">$</span><span class="synIdentifier">uname</span> <span class="synStatement">=</span> <span class="synStatement">$</span><span class="synIdentifier">map</span><span class="synSpecial">[</span><span class="synStatement">$</span><span class="synIdentifier">url</span><span class="synSpecial">[</span>&quot;<span class="synConstant">host</span>&quot;<span class="synSpecial">]]</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">if</span> <span class="synSpecial">(</span><span class="synStatement">$</span><span class="synIdentifier">uname</span> <span class="synStatement">&lt;&gt;</span> &quot;&quot;<span class="synSpecial">)</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span class="synSpecial">{</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">$</span><span class="synIdentifier">url</span><span class="synSpecial">[</span>&quot;<span class="synConstant">hostedUser</span>&quot;<span class="synSpecial">]</span> <span class="synStatement">=</span> <span class="synStatement">$</span><span class="synIdentifier">uname</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span class="synSpecial">}</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">else</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span class="synSpecial">{</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">$</span><span class="synIdentifier">host</span> <span class="synStatement">=</span> <span class="synIdentifier">explode</span><span class="synSpecial">(</span>&quot;<span class="synConstant">.</span>&quot;,<span class="synStatement">$</span><span class="synIdentifier">url</span><span class="synSpecial">[</span>&quot;<span class="synConstant">host</span>&quot;<span class="synSpecial">])</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">$</span><span class="synIdentifier">url</span><span class="synSpecial">[</span>&quot;<span class="synConstant">path</span>&quot;<span class="synSpecial">]</span> <span class="synStatement">=</span> &quot;<span class="synConstant">/</span>&quot;<span class="synStatement">.</span> <span class="synStatement">$</span><span class="synIdentifier">host</span><span class="synSpecial">[</span><span class="synConstant">0</span><span class="synSpecial">]</span> <span class="synStatement">.</span> <span class="synStatement">$</span><span class="synIdentifier">url</span><span class="synSpecial">[</span>&quot;<span class="synConstant">path</span>&quot;<span class="synSpecial">]</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">unset</span><span class="synSpecial">(</span><span class="synStatement">$</span><span class="synIdentifier">host</span><span class="synSpecial">[</span><span class="synConstant">0</span><span class="synSpecial">])</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">$</span><span class="synIdentifier">url</span><span class="synSpecial">[</span>&quot;<span class="synConstant">host</span>&quot;<span class="synSpecial">]</span> <span class="synStatement">=</span> <span class="synIdentifier">implode</span><span class="synSpecial">(</span>&quot;<span class="synConstant">.</span>&quot;,<span class="synStatement">$</span><span class="synIdentifier">host</span><span class="synSpecial">)</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">if</span> <span class="synSpecial">(</span><span class="synStatement">$</span><span class="synIdentifier">url</span><span class="synSpecial">[</span>&quot;<span class="synConstant">host</span>&quot;<span class="synSpecial">]</span> <span class="synStatement">&lt;&gt;</span> &quot;&quot;<span class="synSpecial">)</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; checkUser<span class="synSpecial">(</span><span class="synStatement">$</span><span class="synIdentifier">url</span><span class="synSpecial">)</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span class="synSpecial">}</span><br /><span class="synSpecial">}</span><br /><span class="synStatement">do</span><br /><span class="synSpecial">{</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">$</span><span class="synIdentifier">in</span> <span class="synStatement">=</span> <span class="synIdentifier">trim</span><span class="synSpecial">(</span><span class="synIdentifier">fgets</span><span class="synSpecial">(</span>STDIN,<span class="synConstant">8096</span><span class="synSpecial">))</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">if</span> <span class="synSpecial">(</span><span class="synIdentifier">strlen</span><span class="synSpecial">(</span><span class="synStatement">$</span><span class="synIdentifier">in</span><span class="synSpecial">)</span> <span class="synStatement">&gt;</span><span class="synConstant">0</span><span class="synSpecial">)</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span class="synSpecial">{</span><br /><span class="synComment">//Log request</span><br /><span class="synComment">#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  fputs($log, &quot;$in\n&quot;);</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">unset</span><span class="synSpecial">(</span><span class="synStatement">$</span><span class="synIdentifier">url</span><span class="synSpecial">[</span>&quot;<span class="synConstant">hostedUser</span>&quot;<span class="synSpecial">])</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">if</span> <span class="synSpecial">(</span><span class="synIdentifier">substr</span><span class="synSpecial">(</span><span class="synStatement">$</span><span class="synIdentifier">in</span>,<span class="synConstant">0</span>,<span class="synConstant">1</span><span class="synSpecial">)</span> <span class="synStatement">&lt;&gt;</span> &quot;<span class="synConstant">/</span>&quot;<span class="synSpecial">)</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synSpecial">{</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">$</span><span class="synIdentifier">in</span> <span class="synStatement">=</span> &quot;<span class="synConstant">http://</span><span class="synStatement">$</span><span class="synIdentifier">in</span>&quot;;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">$</span><span class="synIdentifier">url</span> <span class="synStatement">=</span> <span class="synIdentifier">parse_url</span><span class="synSpecial">(</span><span class="synStatement">$</span><span class="synIdentifier">in</span><span class="synSpecial">)</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">$</span><span class="synIdentifier">path</span> <span class="synStatement">=</span> <span class="synStatement">$</span><span class="synIdentifier">url</span><span class="synSpecial">[</span>&quot;<span class="synConstant">path</span>&quot;<span class="synSpecial">]</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">$</span><span class="synIdentifier">url</span><span class="synSpecial">[</span>&quot;<span class="synConstant">path</span>&quot;<span class="synSpecial">]</span> <span class="synStatement">=</span> &quot;&quot;;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; checkUser<span class="synSpecial">(</span><span class="synStatement">$</span><span class="synIdentifier">url</span><span class="synSpecial">)</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synSpecial">}</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synComment">//If we find an owner</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">if</span><span class="synSpecial">(</span><span class="synStatement">isset</span><span class="synSpecial">(</span><span class="synStatement">$</span><span class="synIdentifier">url</span><span class="synSpecial">[</span>&quot;<span class="synConstant">hostedUser</span>&quot;<span class="synSpecial">]))</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synSpecial">{</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synComment">//This bit is slightly legacy before I moved the hosting files about a bit. Kept for posterity mainly.</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">$</span><span class="synIdentifier">out</span> <span class="synStatement">=</span> &quot;<span class="synConstant">/home/</span>&quot; <span class="synStatement">.</span> <span class="synStatement">$</span><span class="synIdentifier">url</span><span class="synSpecial">[</span>&quot;<span class="synConstant">hostedUser</span>&quot;<span class="synSpecial">]</span> <span class="synStatement">.</span>&quot;<span class="synConstant">/web/</span>&quot; <span class="synStatement">.</span> <span class="synStatement">$</span><span class="synIdentifier">url</span><span class="synSpecial">[</span>&quot;<span class="synConstant">hostedUser</span>&quot;<span class="synSpecial">]</span> <span class="synStatement">.</span> &quot;<span class="synConstant">.elizium.net/</span>&quot; <span class="synStatement">.</span> <span class="synStatement">$</span><span class="synIdentifier">url</span><span class="synSpecial">[</span>&quot;<span class="synConstant">host</span>&quot;<span class="synSpecial">]</span> <span class="synStatement">.</span> <span class="synStatement">$</span><span class="synIdentifier">url</span><span class="synSpecial">[</span>&quot;<span class="synConstant">path</span>&quot;<span class="synSpecial">]</span> <span class="synStatement">.</span> <span class="synStatement">$</span><span class="synIdentifier">path</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">if</span> <span class="synSpecial">(</span><span class="synIdentifier">file_exists</span><span class="synSpecial">(</span>&quot;<span class="synConstant">/home/</span>&quot; <span class="synStatement">.</span> <span class="synStatement">$</span><span class="synIdentifier">url</span><span class="synSpecial">[</span>&quot;<span class="synConstant">hostedUser</span>&quot;<span class="synSpecial">]</span> <span class="synStatement">.</span>&quot;<span class="synConstant">/web/</span>&quot; <span class="synStatement">.</span> <span class="synStatement">$</span><span class="synIdentifier">url</span><span class="synSpecial">[</span>&quot;<span class="synConstant">host</span>&quot;<span class="synSpecial">]</span> <span class="synStatement">.</span> <span class="synStatement">$</span><span class="synIdentifier">url</span><span class="synSpecial">[</span>&quot;<span class="synConstant">path</span>&quot;<span class="synSpecial">]</span> <span class="synStatement">.</span> <span class="synStatement">$</span><span class="synIdentifier">path</span><span class="synSpecial">))</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synSpecial">{</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">$</span><span class="synIdentifier">out</span> <span class="synStatement">=</span> &quot;<span class="synConstant">/home/</span>&quot; <span class="synStatement">.</span> <span class="synStatement">$</span><span class="synIdentifier">url</span><span class="synSpecial">[</span>&quot;<span class="synConstant">hostedUser</span>&quot;<span class="synSpecial">]</span> <span class="synStatement">.</span>&quot;<span class="synConstant">/web/</span>&quot; <span class="synStatement">.</span> <span class="synStatement">$</span><span class="synIdentifier">url</span><span class="synSpecial">[</span>&quot;<span class="synConstant">host</span>&quot;<span class="synSpecial">]</span> <span class="synStatement">.</span> <span class="synStatement">$</span><span class="synIdentifier">url</span><span class="synSpecial">[</span>&quot;<span class="synConstant">path</span>&quot;<span class="synSpecial">]</span> <span class="synStatement">.</span> <span class="synStatement">$</span><span class="synIdentifier">path</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synSpecial">}</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synSpecial">}</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synComment">//Otherwise just return this file as 99% chance its some automated script looking for exploitable webapps.</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">else</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synStatement">$</span><span class="synIdentifier">out</span><span class="synStatement">=</span> &quot;<span class="synConstant">/var/www/monkey.txt</span>&quot;;<br /><span class="synComment">//Log resulting path</span><br /><span class="synComment">#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  fputs($log, &quot;$out\n&quot;);</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="synIdentifier">fputs</span><span class="synSpecial">(</span>STDOUT, &quot;<span class="synStatement">$</span><span class="synIdentifier">out</span><span class="synSpecial">\n</span>&quot;<span class="synSpecial">)</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span class="synSpecial">}</span><br /><span class="synComment">//Just keep doing it forever.</span><br /><span class="synSpecial">}</span> <span class="synStatement">while</span> <span class="synSpecial">(</span><span class="synConstant">true</span><span class="synSpecial">)</span>;<br /><span class="synSpecial">?&gt;</span><br /></code></div></p>
<p>The only improvement I may make to that is to get the users home directory info as opposed to assuming its under /home.</p>
<p>Now we just need put that script somewhere, make it executable by the Apache user and tell Apache to use it. Thats done like so:<br />
<div class="codeblock"><code><span class="synIdentifier">RewriteEngine</span> <span class="synConstant">on</span><br /><span class="synComment">#Use this program to do the mappings</span><br /><span class="synIdentifier">RewriteMap</span>&nbsp; &nbsp; &nbsp; hosted&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prg:/etc/apache2/<span class="synConstant">map</span>.hosted.php<br /><span class="synComment">#This is for allowing www.user.elizium.net type urls as they're outwith the scope of the rewrite script as they're easy to map.</span><br /><span class="synComment">#See http://forum.modrewrite.com/viewtopic.php?t=1652&amp;postdays=0&amp;postorder=asc&amp;start=10</span><br /><span class="synIdentifier">RewriteCond</span> %{HTTP_HOST} !^(www\.)?elizium\.net$ [NC]<br /><span class="synIdentifier">RewriteCond</span> %{ENV:REDIRECT_STATUS} ^$<br /><span class="synIdentifier">RewriteCond</span> %{HTTP_HOST} ^([^\.]+\.)?([^.]+)\.elizium\.net$ [NC]<br /><span class="synIdentifier">RewriteRule</span> .*&nbsp; /home/%2/web/%2\.elizium.net%{REQUEST_URI}&nbsp; &nbsp; &nbsp; [QSA,L]<br /><span class="synComment">#Ignore *.elizium.net</span><br /><span class="synIdentifier">RewriteCond</span>&nbsp; &nbsp;  %{HTTP_HOST}&nbsp; &nbsp; !elizium.net$ [NC]<br /><span class="synComment">#Use the full request</span><br /><span class="synIdentifier">RewriteRule</span>&nbsp; &nbsp;  ^(.+)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  %{HTTP_HOST}$1&nbsp; [C]<br /><span class="synComment">#Throw the request through the map program</span><br /><span class="synIdentifier">RewriteRule</span>&nbsp; &nbsp;  ^(.*)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ${hosted:$1}&nbsp; &nbsp; [L,C]<br /></code></div></p>
<p>I hope this is of use to people. Especially those folk looking for a php based rewrite script for Apache. Theres a lot of scope to expand the script. For example, the file data could be retrieved from a database and then stored in something like <a href="http://www.danga.com/memcached/">memcached</a> if you were performing this sort of thing on a larger scale. Much better than having a large webserver config file that means the webserver has to be reloaded for each change.</p>
<p>The only problem I have with this, and I know its not insurmountable, is that the webserver user has to be able to read the files that users are storing. To allow this I&#8217;ve made the www-data user a member of the group all the users are members of. This also means that users can read each others files. So if somebody was to hardcode a password in a php file (for example) then it would be open to being read by any other user.</p>
<p>I also want to mention <a href="http://www.suphp.org">suPHP</a>, it really does merit an article to itself, but as I&#8217;m not intending to cover it in depth (you can read all about it at the website) I&#8217;ll just say that I&#8217;ve enabled it on Wintermute to prevent users being able to do things like kill the web server processes via a php script. To do that, I installed the suphp-common Debian package. The default configs are all you need. For the non-Debian user, they look like this when taken together:<br />
<div class="codeblock"><code><span class="synIdentifier">LoadModule</span> suphp_module /usr/lib/apache2/modules/mod_suphp.so<br /><span class="synStatement">&lt;IfModule</span><span class="synConstant"> mod_suphp.c</span><span class="synStatement">&gt;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; suPHP_Engine <span class="synConstant">on</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span class="synIdentifier">AddHandler</span> x-httpd-php .php .php3 .php4 .phtml<br /><span class="synComment"># # Use a specific php config file (a dir which contains a php.ini file)</span><br />&nbsp; &nbsp; &nbsp; &nbsp; suPHP_ConfigPath /etc/php4/cgi/<br /><span class="synStatement">&lt;/IfModule&gt;</span><br /></code></div></p>
<p>As usual comments on the above are most welcome. Especially quick links about solving my security issue!</p>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="mark@arricc.net" /><input type="hidden" name="return" value="http://www.arricc.net/pp-thanks.php" /><input type="hidden" name="item_name" value="Buy Me a Beer for User VHosting" /><input type="hidden" name="currency_code" value="GBP" /><input type="hidden" name="amount" value="5" /><input type="image" src="http://www.arricc.net/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="" title="" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=mark@arricc.net&amp;currency_code=GBP&amp;amount=5&amp;return=http://www.arricc.net/pp-thanks.php&amp;item_name=Buy+Me+a+Beer+for+User+VHosting" target="paypal">If you find this article useful, buy me a beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.arricc.net/user-vhosting.php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VWebhosting</title>
		<link>http://www.arricc.net/vwebhosting.php</link>
		<comments>http://www.arricc.net/vwebhosting.php#comments</comments>
		<pubDate>Fri, 07 Jul 2006 19:18:04 +0000</pubDate>
		<dc:creator>Fizzgig</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Wist]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.arricc.net/vwebhosting.php</guid>
		<description><![CDATA[So, to reiterate &#8211; the main server (Wist) will hold all my own stuff, then I&#8217;ll be creating a user Virtual Server (Wintermute) on top of that for users to play with and/or break. All the user stuff is backended in a Xoops database using Xoops groups. Wist is installed with Debian Sarge using a [...]]]></description>
			<content:encoded><![CDATA[<p>So, to reiterate &#8211; the main server (Wist) will hold all my own stuff, then I&#8217;ll be creating a user Virtual Server (Wintermute) on top of that for users to play with and/or break. All the user stuff is backended in a <a href="http://www.xoops.org">Xoops</a> database using Xoops groups.</p>
<p>Wist is installed with Debian Sarge using a custom kernel including the vserver patches from Debian. This sort of thing is detailed elsewhere so I won&#8217;t go over it again here.</p>
<p>The core server software (all from the Debian archive) will include: Apache 1.3 with PHP4, Apache-SSL, Bind, MySQL 4.1, Exim4, ClamAV and Dovecot (I&#8217;ll be detailing the email setup seperately)<span id="more-17"></span></p>
<p>The installation of the Bind9 DNS server is very straight forward and only hosts a few domains, most of which are served from either Wist or Wintermute using a handfull of A/CNAME records and wildcard dns.</p>
<p>The Apache-SSL server is only going to host https for www.elizium.net so the only changes from the stock install for that is to install the appropriate certificate. I tend to buy certificates from <a href="https://ssl.ev1servers.net/?SslType=QuickSSL">EV1Servers</a> which I find very affordable.</p>
<p>The magic for this article happens in the config file for Apache 1.3 hosting plain http traffic.<br />
To allow me to easily add arbitrary domains and subdomains without extra config of the DNS server, I&#8217;ve used wildcard DNS. This means that all DNS requests for any subdomain of a domain (eg. www.example.org and sub.example.org) will be directed to the same server unless there is a specific DNS record for that particular subdomain. Clear? Probably not but thats the best I can do just now.</p>
<p>I wanted to be able to create a directory structure which would let me map out the web sites. Lets say I&#8217;ve created a root folder at /var/http and domains under that will be at /var/http/example.org then the subdomains will reside at /var/http/example.org/www /var/http/example.org/sub following me? Good. </p>
<p>On Wist, the first part of the domain name is stripped to become the subdomain. This means that if a request for http://example.org is recieved it will go to /var/http/org/example. I tend to create redirects in each of those folders to www.example.org etc as the vanity www has been overly popular for the last million years.</p>
<p>How did I manage to do this? Using mod_rewrite! Much as I hate regex (well, to be honest, I don&#8217;t use it enough to easily remember its quirks) this is clearly the way forward in this case.</p>
<p>Concentrate, here comes the science bit:<br />
<div class="codeblock"><code><span class="synIdentifier">RewriteEngine</span> <span class="synConstant">on</span><br /><span class="synComment">#Ignore requests for server wide directories</span><br /><span class="synIdentifier">RewriteCond</span>&nbsp; &nbsp;  %{REQUEST_URI}&nbsp; !^/mailman/.*<br /><span class="synIdentifier">RewriteCond</span>&nbsp; &nbsp;  %{REQUEST_URI}&nbsp; !^/pipermail/.*<br /><span class="synIdentifier">RewriteCond</span>&nbsp; &nbsp;  %{REQUEST_URI}&nbsp; !^/cgi-bin/.*<br /><span class="synIdentifier">RewriteCond</span>&nbsp; &nbsp;  %{REQUEST_URI}&nbsp; !^/icons/.*<br /><span class="synComment">#Rewrite the full request to include the host instead of just the path</span><br /><span class="synComment">#eg. /dir/index.html -&gt; www.example.org/dir/index.html</span><br /><span class="synIdentifier">RewriteRule</span>&nbsp; &nbsp;  ^(.+)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  %{HTTP_HOST}$1&nbsp; [C]<br /><span class="synComment">#Rewrite the url to a file in a directory</span><br /><span class="synComment">#www.example.org/dir/index.html -&gt; /var/http/example.org/www/dir/index.html</span><br /><span class="synIdentifier">RewriteRule</span>&nbsp; &nbsp;  ^([^.]+)\.([^/]+)\/(.*)$&nbsp; &nbsp; &nbsp; &nbsp; /var/http/$2/$1/$3 [L]<br /></code></div></p>
<p>Good, eh? I have to add my thanks to the guys in <a href="irc://chat.freenode.net/#regex">#regex</a> when I was struggling to come up with this.</p>
<p>Apache handles all the rest &#8211; default directory indexes and the variety of options itself.</p>
<p>The one last addition to the whole bundle is logging. First I started with this:<br />
<div class="codeblock"><code><span class="synIdentifier">LogFormat</span> <span class="synConstant">&quot;%{Host}i %h %l %u %t \&quot;%r\&quot; %&gt;s %b \&quot;%{Referer}i\&quot; \&quot;%{User-Agent}i\&quot;&quot;</span> vfull<br /><span class="synIdentifier">CustomLog</span> /var/log/apache/access.log vfull<br /></code></div></p>
<p>Which is the same as a standard Apache log file line but with the hostname (eg. www.example.org) as the first field.</p>
<p>Good, but we can do better.<br />
<div class="codeblock"><code><span class="synIdentifier">CustomLog</span> <span class="synConstant">&quot;|/sbin/vlogger -s access.log -u www-data -g www-data&nbsp; -t %Y%m%d-access.log /var/log/apache&quot;</span> vfull<br /></code></div></p>
<p>I&#8217;ve installed the <a href="http://n0rp.chemlab.org/vlogger/">vlogger</a> package. This spits out a directory per hostname with dated YYYY-MM-DD-access.log files and a symlink called access.log to the current days logs. Priceless if you want to do per host webstats withouth pre-precessing a big monolithic log file for specific domains.</p>
<p>Hopefully some folk will find that useful. After I&#8217;ve detailed the webhosting setup on Wintermute &#8211; more regex, some the same, mostly different &#8211; I&#8217;ll tell you how I automatically generate my webstats.</p>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="mark@arricc.net" /><input type="hidden" name="return" value="http://www.arricc.net/pp-thanks.php" /><input type="hidden" name="item_name" value="Buy Me a Beer for VWebhosting" /><input type="hidden" name="currency_code" value="GBP" /><input type="hidden" name="amount" value="5" /><input type="image" src="http://www.arricc.net/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="" title="" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=mark@arricc.net&amp;currency_code=GBP&amp;amount=5&amp;return=http://www.arricc.net/pp-thanks.php&amp;item_name=Buy+Me+a+Beer+for+VWebhosting" target="paypal">If you find this article useful, buy me a beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.arricc.net/vwebhosting.php/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Debian on ancient hardware</title>
		<link>http://www.arricc.net/storm.php</link>
		<comments>http://www.arricc.net/storm.php#comments</comments>
		<pubDate>Mon, 26 Aug 2002 12:07:37 +0000</pubDate>
		<dc:creator>Fizzgig</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[luck]]></category>

		<guid isPermaLink="false">http://wp.arricc.net/debian-on-ancient-hardware.php</guid>
		<description><![CDATA[26th August 2002 So, I&#8217;ve got my hands on a Toshiba T1910CS The specs when I got it were along these lines: 33MHz 486 12MB RAM (4MB onboard, 8MB on an expansion card stolen from a fax machine) 200MB Hard Drive 1.4MB Floppy Drive 3Com EtherLink III 3C589D-TP PCMCIA Card for 10Base-T Windows 95b, taking [...]]]></description>
			<content:encoded><![CDATA[<p>26th August 2002</p>
<p>So, I&#8217;ve got my hands on a Toshiba T1910CS<br />
<br />
The specs when I got it were along these lines:<br />
33MHz 486<br />
12MB RAM (4MB onboard, 8MB on an expansion card stolen from a fax machine)<br />
200MB Hard Drive<br />
1.4MB Floppy Drive<br />
3Com EtherLink III 3C589D-TP PCMCIA Card for 10Base-T </p>
<p>Windows 95b, taking up whole drive.</p>
<p>
(NB: at this point I had Windows drivers for the pcmcia network card, but as the install process requests lots of Files off a Win95 CD, which I don&#8217;t have and if I did, transferring the files by floppy would be ridiculously time consuming&#8230;)</p>
<p>And I&#8217;m going to install Linux on it. More specifically, Debian Woody (which recently became the Stable release).</p>
<p>I know your thinking &#8220;Are you mad???&#8221;<span id="more-14"></span> and your not the first person to think that! But I&#8217;m very determined, and I have Google and my other Debian Box (rogue) on my side!</p>
<p>I&#8217;ve also downloaded the ISO images of the Woody CD distribution, which means for the most part I don&#8217;t need to go hunting on my favourite mirror (http://www.mirror.ac.uk/sites/ftp.debia<wbr>n.org for your reference <img src='http://www.arricc.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  )</p>
<p>For the purposes of this, I&#8217;m using the idepci flavour of the install, which has fewer drivers (no SCSI amongst other things)</p>
<p>
DAY 1 (24/08/2002)<br />
<br />==================<br />
<br />Rang bell &#8211; cat said no thanks he&#8217;d had eaten earlier.</p>
<p>
OK, so standard method of installing Debian is boot the machine with the Rescue Floppy.</p>
<p>I created the boot floppy using dd on rogue, but tools exist in the dostools directory of the Debian distribution (and most Linux distros) that allow you to write disk images to floppy disks.<br />

<pre># dd if=rescue.bin of=/dev/fd0
</pre>
<p>So&#8230; booting the laptop&#8230;<br />
<br />&#8220;Boot Failed&#8221;</p>
<p>Hmm. Something wrong with the floppy? I tried writing a few more rescue floppies, but all had the same results <img src='http://www.arricc.net/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
<p>Using the hackers favourite friend (Google) I discovered that there was probably nothing wrong with the floppies (YAY! I&#8217;ve always had trouble using dd to floppies in the past and therefor initially assumed I was doig something wrong).</p>
<p>The problem is that Debian (and most Linux distros) use syslinux as the bootloader on their bootable floppy disks, and syslinux doesn&#8217;t work on older hardware, at least on the laptop which is pretty old.</p>
<p>Ok, what to do next? Well, in the dostools directory is a program called fips which allows for resizing the partitions of a hard disk.<br />
So, booting the laptop into Windows (*shudder*) I uninstall (read delete) a bunch of stuff from the harddisk to free us some space. Then I run scandisk, then defrag the hard disk to move all the used space to the beginning of the disk, then scandisk again. Given the spec of the laptop, this process takes a remarkably short time, and I&#8217;m left with approx 100MB of free space. </p>
<p>Reboot into DOS mode (fips shouldn&#8217;t be run from a multithreaded OS, eg Windows!)<br />
<br />Run fips. hmm.. ok&#8230; so its going to let me shrink the partition by er&#8230; 4MB!!!<br />
<br />Thinking back, I remember something about reducing the size of a partition below a certain size which would inherantly imply reformatting the partition as FAT12 instead of FAT16. Bah.</p>
<p>OK, where to now?<br />
<br />Well, you can actually start the Linux install process from within Windows! (madness I hear you say, and I&#8217;d tend to agree with you!)<br />
<br />Another program sitting in the dostools directory is LoadLin which boots a linux kernel from DOS/Windows, and in each &#8220;flavour&#8221; (the flavours are the main one, idepci, compact and bf2.4) is an install.bat for the idepci flavour this contains the line:<br />
</p>
<pre>..\dosutils\loadlin linux.bin root=/dev/ram initrd=../images-1.44/idepci/root.bin disksize=1.44 flavor=idepci
</pre>
<p>Ok, so I just need to get those files to the laptop. note that linux.bin is the kernal, and the root.bin file is actually a gzip&#8217;d filesystem which during a normal install is written to a floppy on its own using dd (as above but if=root.bin) and this floppy is not intended to be read as a normal floppy!</p>
<p>Anyway, back on track: I need the following files transferred to the laptop:<br />
loadlin.exe linux.bin root.bin install.bat </p>
<p>(I&#8217;m lazy and decided editing install.bat was easier that tweaking the command line if it failed)</p>
<p>ok, loadlin.exe and linux.bin both fit on the same floppy, so they&#8217;re copied across easily.</p>
<pre>rogue:/var/install/dists/woody/main/disks-i386/current/images-1.44/idepci# ls -lh
total 4.3M
-r--r--r--    1 root     root         1.0k Aug 24 15:14 README.txt
-r--r--r--    1 root     root          263 Aug 24 15:14 TRANS.TBL
-r--r--r--    1 root     root         1.4M Aug 24 15:14 driver-1.bin
-r--r--r--    1 root     root         3.8k Aug 24 15:14 kernel-config
-r--r--r--    1 root     root         1.4M Aug 24 15:14 rescue.bin
-r--r--r--    1 root     root         1.4M Aug 24 15:14 root.bin
</pre>
<p>hmm.. root.bin doesn&#8217;t fit on a floppy.<br />
<br />How to transfer this file across? </p>
<p>I used dd to split the file into two files:<br />
</p>
<pre>dd if=root.bin of=root1.bin count=2000
dd if=root.bin of=root2.bin skip=2000
</pre>
<p>then copied the files across to the laptop on floppy.</p>
<p>Recombining the files under dos uses the copy command as follows:<br />
</p>
<pre>copy /B root1.bin /B +root2.bin /b root.bin
</pre>
<p>the /B specifies binary files.</p>
<p>ok, everything in place</p>
<p>edit install.bat to:</p>
<pre>loadlin linux.bin root=/dev/ram initrd=root.bin disksize=1.44 flavor=idepci
</pre>
<p>
run install.bat and&#8230;. PENGUIN!!!</p>
<p>Everything running ok so far!</p>
<p>I proceed through the install process answering the questions as standard until I come to the question I&#8217;d been dreading&#8230; partitioning the disk. The observant among you will have noticed/remembered that there is no free space on the hard disk&#8230;</p>
<p>At this point, the root filesystem is actually running in memory, the install process isn&#8217;t actually using any part of the harddisk. So, throwing caution to the wind (and not for the first time) I delete the windows partition and create a 160MB linux partition and a 40MB swap partition (partition type 83), write the partition table to disk and continue.</p>
<p>The installer warns about rebooting to ensure the partition table is read correctly, but as you&#8217;ll also remember, there is no way for me to boot the machine into the install&#8230; so having already thrown caution to the wind, I now laugh in the face of danger and ignore it.</p>
<p>Everything setup ok, I configured the pcmcia drivers using the intel driver out of the two suggested, and from the third virtual terminal (Alt+F3) where you have access to a log and the second virtual terminal (Alt+F2) where you have a limited console, I could see that it had loaded the pcmcia module and the appropriate module for my card! Joy!</p>
<p>Configuring networking was a problem. I set about manual config as all my machines have static addresses on my internal network.</p>
<p>For some reason this didn&#8217;t work. I went through the process again and picked the DHCP option. I didn&#8217;t have a DHCP server running, but was amazed when I saw a light appear on my switch as it hadn&#8217;t come on during the manual config.</p>
<p>Switching to the console I issued the command &#8220;ifconfig&#8221; to see that configuration of my network connections. The device showed itself waiting for an address. So, still using ifconfig I did the following:</p>
<pre># ifconfig eth0 192.168.69.50
</pre>
<p>
This automatically worked out the subnet mask of 255.255.255.0</p>
<p>I also at this point set the default route:</p>
<pre># route add default gw 192.168.69.30 eth0
</pre>
<p>
The installer had already setup which dns server to access as part of the manual config process. I&#8217;ve no idea why the rest didn&#8217;t work <img src='http://www.arricc.net/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
<p>As part of the network config, I decided to name the machine storm.arricc.net to keep consistent with the rest of my network (forge, cable, rogue, wolverine, nightcrawler&#8230; get the picture?)</p>
<p>Given that I&#8217;ve got a complete distribution of Woody already on my local network, I decided to install the rest of the system using nfs (I quickly installed the nfs-server package on rogue using &#8220;apt-get install nfs-server&#8221; and set it up to export /var/install to the local network read only)</p>
<p>The installer popped up a message saying it was looking for files named &#8216;dists/woody/main/binary-i386/Release&#8217; or &#8216;basedebs.tar&#8217; under that directory.<br />
As it was taking its time, I switched to the console (Alt+F2) to make sure it was doing stuff. I did this by checking that the used disk space was changing (&#8220;df -h&#8221;) and the memory used was changin (&#8220;free&#8221;).</p>
<p>Suddenly, the installer window appears and asks me to pick a language &#8211; assuming it was in some sort of second stage install I went to pick english. BUT!!! the arrow keys wouldn&#8217;t work! After some playing about trying to do things, I determined that the install window had appeared in terminal 2, but was supposed to be in terminal 1! There was nothing I could do <img src='http://www.arricc.net/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
<p>So, I&#8217;m stuck. I can&#8217;t restart the install as the disk has been repartitioned and I can&#8217;t choose an option on the menu. Bed calls as its now about 2am.</p>
<p>End of Day 1.</p>
<p></p>
<p>DAY2 (25/08/2002)</p>
<p>=================<br />
<br />Rang bell but cat had stolen battery!</p>
<p>Having been woken up by the phone ringin I find myself on the sofa having crashed out watching the Matrix on DVD for inspiration.</p>
<p>So I can&#8217;t install from the rescue floppy, and I can&#8217;t boot the machine into windows anymore. If only I had a Windows/DOS boot disk! If only I ran windows I could create one!</p>
<p>All is not lost however as after a few quick Googles, I find an online source for boot disk images. (http://www.mirrors.org/archived_softwar<wbr>e/www.bootdisk.com/original.htm)</p>
<p>I downloaded the boot95b.exe file and tried to run it under wine (www.wine.com) which I already had installed on rogue. No Joy &#8482;.</p>
<p>Hedging my bets that it was a self extracting zipped exe file I ran &#8220;unzip boot95b.exe&#8221; </p>
<pre>rogue:/tmp# unzip boot95b.exe
Archive:  boot95b.exe
warning [boot95b.exe]:  105508 extra bytes at beginning or within zipfile
  (attempting to process anyway)
file #1:  bad zipfile offset (local header sig):  211016
  (attempting to re-compensate)
  inflating: winb95b.IMA
rogue:/tmp# ls -lh winb95b.IMA
-rw-r--r--    1 root     root         1.4M Nov 18  1999 winb95b.IMA
</pre>
<p>Now, that file looks about the right size&#8230;<br />
# dd if=winb95b.IMA of=/dev/fd0</p>
<p>I successfully booted storm with the floppy which complained about no FAT partition on the hard disk, but otherwise worked. Next thing to do was run fdisk, which royally complained about the hard disk. </p>
<p>I tried again with a Windows 98 boot floppy. This version of fdisk was obviously more up to date and I deleted both non-dos partitions and created a 10MB partition at the start of the drive. Reboot, &#8220;format /S C:&#8221; copy linux.bin, loadlin, root.bin and install.bat to that partition. Still with me? Good.</p>
<p>edit install.bat, run it, go through the install process as before with the only differences I leave the 10MB partition at the start of the drive, create a 40MB linux swap at the end of the diskspace and use the rest of the space for one big Linux partition.</p>
<p>Then I reboot. Its at this point I discover that the v. basic system on C: won&#8217;t run under toshiba! ok, boot with my Win98 floppy and run install.bat again. go through all the install questions, perform the jiggery pokery with the network and am at the where do I want to get the rest of the install files from? http/ftp/nfs or a few other options.</p>
<p>I try the nfs route again. </p>
<p>After it scans for that file, I leave it on that console and don&#8217;t flip to any of the other.<br />
<br />As expected, a short while later, I&#8217;m presented with a menu asking me to pick a language. This time I can! </p>
<p>Ok, so its actually back at the start of the install questionaire <img src='http://www.arricc.net/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /><br />
<br />I run through all these questions, and try installing the base system from a few different sources.</p>
<p>Eventually, I go looking through my install set at the Release file (see above) but I wouldn&#8217;t know whats wrong with it if there was anything! However, I discover that there is a conspicuous absence of a basedebs.tar file&#8230; But, of course, this is a CD distribution, for installing from CD, so it probably wouldn&#8217;t be included&#8230; I find a link to a basedebs.tar file on the Debian website which I download, throw at /var/install/basedebs.tar on rogue and told storm to use nfs again.</p>
<p>Yay! It found the basedebs.tar file and started extracing and installing from it!</p>
<p>While it was chugging away, one of my friends came round, we sat about yapping and drinking tea for a few hours, went to the video shop, got out Men In Black, watched Men In Black with two breaks to make popcorn, disassembled my bed and reassembled it facing across my bedroom to give me more space) then sat about chatting some more. And went looking at online goth clothing shops. It was about here that the extract finished. Then it booted the system and went through the initial config of the base packages</p>
<p>Did I want to run tasksel to pick some bundles of software? Yes. But I didn&#8217;t pick anything as the bundles all seemed a bit big&#8230;<br />
<br />Did I want to run dselect? Yes.</p>
<p>It then spent a long time bringing this up. My friend had gone home and I was considering moving to my (newly repositioned) bed to finish the config and watch TV as it was about 10:30pm.</p>
<p>It was at this point I discovered that the battery life on storm (for a full charge) is approx 5 seconds.</p>
<p>Oh well. Set it up on my bed. Booted. tasksel? No. dselect? No.</p>
<p>It then gave a list of over 70 packages which were going to be installed, did I want to continue? As most of the packages appeared erroneous for my purposes I said NO! Once that was over, and I had a login prompt, the first thing I did was </p>
<p># apt-get install ssh<br />
<br />This installed an configured ssh (after approx 1ns of thought I decided not to run the ssh server!) and took approx 40minutes to extract and install the files once it had downloaded them.</p>
<p>ssh is the main reason I wanted to get the laptop running as it will enable me to use my significantly more powerful machines in my data center (read: dining room) as I don&#8217;t allow unsecure telnet connections to them.</p>
<p>After sitting chatting from bed for a while, I decided to install gpm (apt-get install gpm) which took approx. 10 minutes. I configured it setting the type exps2 with no repeater.</p>
<p>End of Day2 .</p>
<p>
Day 3 (26/08/2002)<br />
<br />==================<br />
<br />Cat rang bell, I ate food.</p>
<p>Well, I&#8217;ve been typing this up most of the morning while its still reasonably fresh in my head.</p>
<p>Where do I go from here with storm?<br />
<br />Well, having been inspired by the picture at http://twinbee.com/cyberpvnk/linux.html</p>
<p>I&#8217;ll be having a bash at installing X on it.</p>
<p>I&#8217;m also going to compile a custom kernal for the machine to reduce on some memory overhead that probably exists so trying to get it running as trim as possible.</p>
<p>To speed up installing packages, I&#8217;m considering taking a tar of the whole system, transferring it to rogue and running it in a chroot&#8217;d jail using user mode linux, then just copying diff&#8217;d files back across to storm. But thats for another day.</p>
<p>Its lunchtime <img src='http://www.arricc.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Appendix<br />
<br />========</p>
<p>The Woody CD images were downloaded from ftp://ftp.ticklers.org/debian-cd/ and the contents copied to my /var/install directory on rogue:<br />

<pre>mkdir foo
mount -o loop debian-30r0-i386-binary-1.iso foo
cp -R foo/* /var/install
umount foo
mount the next ISO...

rogue:/var/install/dists/woody/main/disks-i386/current/idepci# ls
README.txt  drivers.tgz  kernel-config  tftpboot.img
TRANS.TBL   install.bat  linux.bin

rogue:/var/install/dists/woody/main/disks-i386/current/images-1.44/idepci# ls
README.txt  TRANS.TBL  driver-1.bin  kernel-config  rescue.bin  root.bin

rogue:/var/install/dists/woody/main/disks-i386/current/dosutils# ls
TRANS.TBL  loadlin.exe  rawrite2.exe  rawrite2.txt  setlang.bat
</pre>
<p></p>
<p class="buymebeer"><form action="https://www.paypal.com/cgi-bin/webscr" target="paypal" method="post"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="mark@arricc.net" /><input type="hidden" name="return" value="http://www.arricc.net/pp-thanks.php" /><input type="hidden" name="item_name" value="Buy Me a Beer for Debian on ancient hardware" /><input type="hidden" name="currency_code" value="GBP" /><input type="hidden" name="amount" value="5" /><input type="image" src="http://www.arricc.net/wp-content/plugins/buy-me-beer/icon_beer.gif" align="left" alt="" title="" hspace="3" /></form><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&amp;business=mark@arricc.net&amp;currency_code=GBP&amp;amount=5&amp;return=http://www.arricc.net/pp-thanks.php&amp;item_name=Buy+Me+a+Beer+for+Debian+on+ancient+hardware" target="paypal">If you find this article useful, buy me a beer!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.arricc.net/storm.php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

