<?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>Rob Searles &#187; Linux</title>
	<atom:link href="http://www.robsearles.com/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.robsearles.com</link>
	<description>Musing on the business of and development for "The Web"</description>
	<lastBuildDate>Mon, 31 May 2010 15:44:09 +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>Awesome WM &amp; NM Applet: Secret Service Operation Failed</title>
		<link>http://www.robsearles.com/2010/05/15/awesome-wm-nm-applet-secret-service-operation-failed/</link>
		<comments>http://www.robsearles.com/2010/05/15/awesome-wm-nm-applet-secret-service-operation-failed/#comments</comments>
		<pubDate>Sat, 15 May 2010 11:38:23 +0000</pubDate>
		<dc:creator>Rob Searles</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.robsearles.com/?p=316</guid>
		<description><![CDATA[I am running Awesome window manager on Lucid Lynx and am using the Network Manager applet to manage my wireless connection. There is a strange error that manes that the wireless can never remember my key.
When I initiate the nm_applet from a terminal it displays the following error:

** Message: secret service operation failed: The name org.freedesktop.secrets was [...]]]></description>
			<content:encoded><![CDATA[<p>I am running <a href="http://awesome.naquadah.org/">Awesome window manager</a> on <a href="https://wiki.ubuntu.com/LucidLynx">Lucid Lynx</a> and am using the <a href="http://projects.gnome.org/NetworkManager/">Network Manager applet</a> to manage my wireless connection. There is a strange error that manes that the wireless can never remember my key.</p>
<p>When I initiate the nm_applet from a terminal it displays the following error:</p>

<div class="wp_syntax"><div class="code"><pre class="text text" style="font-family:monospace;">** Message: secret service operation failed: The name org.freedesktop.secrets was not provided by any .service files</pre></div></div>

<p>After some searching around on the internets I found a <a href="https://bugzilla.redhat.com/show_bug.cgi?id=572137#c1">hack that seems to fix the problem</a>.</p>
<p>What you have to do is edit the  <strong>/usr/share/dbus-1/services/org.gnome.keyring.service</strong> file, comment out where it says <strong>Name=org.gnome.keyring<br />
</strong>and add the line<br />
<strong>Name=org.freedesktop.secrets</strong></p>
<p>For example, my <strong>/usr/share/dbus-1/services/org.gnome.keyring.service</strong> file looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>D-BUS Service<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #666666; font-style: italic;">#Name=org.gnome.keyring</span>
<span style="color: #007800;">Name</span>=org.freedesktop.secrets
<span style="color: #007800;">Exec</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gnome-keyring-daemon <span style="color: #660033;">--start</span> <span style="color: #660033;">--foreground</span> --<span style="color: #007800;">components</span>=secrets</pre></div></div>

<p>Save this, then you&#8217;re done.</p>
<img src="http://www.robsearles.com/?ak_action=api_record_view&id=316&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.robsearles.com/2010/05/15/awesome-wm-nm-applet-secret-service-operation-failed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Perfect Desktop Day 1 &#8211; The Base System</title>
		<link>http://www.robsearles.com/2010/03/18/my-perfect-desktop-day-1-the-base-system/</link>
		<comments>http://www.robsearles.com/2010/03/18/my-perfect-desktop-day-1-the-base-system/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 15:23:14 +0000</pubDate>
		<dc:creator>Rob Searles</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.robsearles.com/?p=292</guid>
		<description><![CDATA[Today I installed the base system on my perfect desktop.]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-296" title="Arch Linux logo" src="http://www.robsearles.com/wp-content/uploads/2010/03/arch-linux-logo1.png" alt="arch-linux-logo" width="200" height="168" />So today is the day I start building <a href="http://www.robsearles.com/2010/03/16/my-perfect-desktop-day-0/">my perfect system</a>. Before getting going,  I had a good think about <a href="http://distrowatch.com/">which distro</a> to use for the base install. I&#8217;ve been using <a href="http://www.ubuntu.com/">Ubuntu</a> for about 2 years now and love the ease of package management with <a href="http://ubuntuforums.org/showthread.php?t=447386">apt and aptitude</a>. I had a bit of a <a href="http://www.robsearles.com/2010/03/17/installing-php5-3-on-ubuntu-karmic/">play around with Ubuntu Karmic yesterday</a> and I must say it looks fantastic, and with Lucid Lynx only a <a href="https://wiki.ubuntu.com/LucidReleaseSchedule">few weeks away</a> it might come as a bit of a surprise to discover that my choice is a distro I&#8217;ve never used before: <a href="http://www.archlinux.org">Arch</a>.</p>
<p><strong>Why Arch?</strong></p>
<p>There are three main reasons I&#8217;ve picked Arch over Ubuntu, or even <a href="http://www.debian.org/">Debian</a>.</p>
<ol>
<li>I really like the idea of Arch&#8217;s rolling release system. My laptop is currently running Jaunty and in order to get the latest packages I would have to upgrade to Karmic. With Arch this is less of an issue.</li>
<li>As mentioned in my initial post, the base system should be small, quick and light. With Arch you can pick and choose exactly what you want at installation time, keeping it bloat free.</li>
<li>Finally, Arch will be something new to play with!</li>
</ol>
<p>After <a href="http://www.archlinux.org/download/">downloading</a> and burning a Net Install ISO I followed the excellent <a href="http://wiki.archlinux.org/index.php/Official_Arch_Linux_Install_Guide">installation guide in the Arch Wiki</a>.</p>
<p>Installation was relatively painless, the only two slight issues being:</p>
<p>I chose Auto prepare for partitioning, but I didn&#8217;t really know what filesystem to choose. Eventually I opted for Ext4, with so far, no ill effects.</p>
<p>During Boot Device Selection, again I wasn&#8217;t really sure what to do, but after some Googling I <a href="http://news.softpedia.com/news/How-to-Install-Arch-Linux-59239.shtml">found this page</a>, whose advice I followed, but just pressing enter.</p>
<p>I restarted and was greeted with a shell prompt. I quickly pinged Google and my network was still up and running through the ethernet on DHCP.</p>
<p>The next step up a non-root user and X. Again, the Arch <a href="http://wiki.archlinux.org/index.php/Beginners'_Guide">documentation</a> is excellent.</p>
<p>Setting up X was relatively simple. I originally decided to not opt for hotplugging, which was a mistake because I only have a USB keyboard and mouse, neither of which I could use in X<em> (muppet of the day award goes to me)</em>. After turning off the machine and setting up hotplugging, all was fine!</p>
<p>I have been using the <a href="http://awesome.naquadah.org/">Awesome window manager</a> for about a month now. Awesome is a tiling window manager which is heavily geared towards being keyboard friendly, and as it&#8217;s name suggests, it is pretty awesome.</p>
<p>Unlike Jaunty, installing the latest stable version of Awesome was a breeze, I simply ran:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># pacman -S awesome</span></pre></div></div>

<p>and edited my ~/.xinitrc file adding:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">exec</span> awesome</pre></div></div>

<p>at the bottom. When I started X again, Awesome was there without any problem.</p>
<p>Sound was equally as simple to install, which was a nice surprise.</p>
<p>So my base system is now setup, with my window manager of choice in place and sound ready and waiting for my music collection. And all this running under 100MB of RAM!</p>
<p>After my first foray into the world of Arch I&#8217;m pretty impressed. <a href="http://wiki.archlinux.org/index.php/Pacman">Pacman</a> is very straight forward to use, after a bit of tweaking here and there it has just worked.</p>
<p>Next time, file management tools.</p>
<img src="http://www.robsearles.com/?ak_action=api_record_view&id=292&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.robsearles.com/2010/03/18/my-perfect-desktop-day-1-the-base-system/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Installing PHP5.3 on Ubuntu Karmic</title>
		<link>http://www.robsearles.com/2010/03/17/installing-php5-3-on-ubuntu-karmic/</link>
		<comments>http://www.robsearles.com/2010/03/17/installing-php5-3-on-ubuntu-karmic/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 23:02:53 +0000</pubDate>
		<dc:creator>Rob Searles</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.robsearles.com/?p=275</guid>
		<description><![CDATA[Following my previous post about installing PHP5.3 on Jaunty, I have had a few requests about installing it on Karmic. I&#8217;ve never used Karmic before so I thought it would be a fun excuse to have a poke about whilst also keeping my blog (sort of) up-to-date.
After freshly installing Karmic (the desktop version looks very [...]]]></description>
			<content:encoded><![CDATA[<p>Following my <a href="http://www.robsearles.com/2009/10/04/installing-php53-on-ubuntu-jaunty">previous post about installing PHP5.3 on Jaunty</a>, I have had a few requests about installing it on Karmic. I&#8217;ve never used Karmic before so I thought it would be a fun excuse to have a poke about whilst also keeping my blog (sort of) up-to-date.</p>
<p>After freshly installing Karmic (the desktop version looks very nice btw) on a new <a href="http://virtualbox.org/">VirtualBox</a> image and then updating with the latest, er, updates I was ready to begin.</p>
<p>The entire installation procedure is very simple, once all dependencies are met.</p>
<p>Firstly you must edit your sources list to include the <a href="http://www.dotdeb.org/">DotDeb package repository</a> and the old Jaunty security packages to meet dependencies.</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apt<span style="color: #000000; font-weight: bold;">/</span>sources.list</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># php5.3</span>
deb http:<span style="color: #000000; font-weight: bold;">//</span>php53.dotdeb.org stable all
deb-src http:<span style="color: #000000; font-weight: bold;">//</span>php53.dotdeb.org stable all
deb http:<span style="color: #000000; font-weight: bold;">//</span>security.ubuntu.com<span style="color: #000000; font-weight: bold;">/</span>ubuntu jaunty-security main</pre></div></div>

<p>Now update and upgrade Ubuntu</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> update
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> upgrade</pre></div></div>

<p>You may find that you get the following warning:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">WARNING: The following packages cannot be authenticated<span style="color: #000000; font-weight: bold;">!</span>
libevent-<span style="color: #000000;">1.4</span>-<span style="color: #000000;">2</span>
Install these packages without verification <span style="color: #7a0874; font-weight: bold;">&#91;</span>y<span style="color: #000000; font-weight: bold;">/</span>N<span style="color: #7a0874; font-weight: bold;">&#93;</span>?</pre></div></div>

<p>I just answered Y and continued as normal</p>
<p>Once successfully upgraded then you can install Apache, MySQL and PHP as normal, feel free to cater the installation line to your tastes.</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libicu38 apache2 apache2-mpm-prefork mysql-client-<span style="color: #000000;">5.1</span> mysql-server-<span style="color: #000000;">5.1</span> php5 php5-cli php5-mysql libapache2-mod-php5</pre></div></div>

<p>You will get a warning about untrusted packages being installed but this simply means that the PHP5.3 stuff is not signed, so I typed in “yes” and carried on.</p>
<p>Robmorin <a href="http://www.robsearles.com/2009/10/04/installing-php53-on-ubuntu-jaunty/?dsq=40007017#comment-39744535">commented in my Jaunty post</a> that he had issues when installing PHP MCrypt. The answer can be found within the <a href="http://www.dotdeb.org/2009/07/03/php-5-3-0-final-preview-packages-available-for-debian-lenny/#comment-1077">DotDeb comments </a></p>
<p>After you have installed everything you need to, test it out, either command line:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">$ php <span style="color: #660033;">-v</span>
PHP 5.3.2-0.dotdeb.1 with Suhosin-Patch <span style="color: #7a0874; font-weight: bold;">&#40;</span>cli<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>built: Mar  <span style="color: #000000;">9</span> <span style="color: #000000;">2010</span> <span style="color: #000000;">10</span>:<span style="color: #000000;">14</span>:<span style="color: #000000;">53</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Copyright <span style="color: #7a0874; font-weight: bold;">&#40;</span>c<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">1997</span>-<span style="color: #000000;">2009</span> The PHP Group
Zend Engine v2.3.0, Copyright <span style="color: #7a0874; font-weight: bold;">&#40;</span>c<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">1998</span>-<span style="color: #000000;">2010</span> Zend Technologies with Suhosin v0.9.29, Copyright <span style="color: #7a0874; font-weight: bold;">&#40;</span>c<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">2007</span>, by SektionEins GmbH</pre></div></div>

<p>Or by using phpinfo() page within your Apache installation:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">nano</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>info.php</pre></div></div>

<p>&lt;?PHP<br />
phpinfo();<br />
?&gt;</p>
<p>then fire up http://localhost/info.php and at the top of the page you should see something along the lines of<br />
<strong>PHP Version 5.3.2-0.dotdeb.1</strong></p>
<p>Note: if your browser asks if you want to download info.php, simply restart Apache and try again:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 restart</pre></div></div>

<p>All done. Not quite as simple as on Jaunty, but still better than compiling the source!</p>
<p>Post Script: Before starting this post, I did a quick search looking for tutorials to see if the work had already been done, but couldn&#8217;t find anything on installing PHP5.3 on Karmic. As there wasn&#8217;t anything I decided to continue with my tutorial and I ended up struggling for an hour or so with the dependency issues. Typically, after I had figured it out for myself, whilst searching for another dependency issue I found <a href="http://blog.jmoz.co.uk/post/435401471/install-php-5-3-on-ubuntu-karmic-koala-from-dotdeb">this post on the JMOZ blog about installing PH5.3 on Karmic Koala</a>.  No idea why it&#8217;s not in Google, but either way, damn, I could have saved myself an hour or so!</p>
<img src="http://www.robsearles.com/?ak_action=api_record_view&id=275&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.robsearles.com/2010/03/17/installing-php5-3-on-ubuntu-karmic/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>My Perfect Desktop &#8211; Day 0</title>
		<link>http://www.robsearles.com/2010/03/16/my-perfect-desktop-day-0/</link>
		<comments>http://www.robsearles.com/2010/03/16/my-perfect-desktop-day-0/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 11:21:34 +0000</pubDate>
		<dc:creator>Rob Searles</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.robsearles.com/?p=270</guid>
		<description><![CDATA[Join me as I build my perfect desktop, ideal for a Linux based web developer.]]></description>
			<content:encoded><![CDATA[<p>Today is an exciting day. I have in my possession a brand new custom built computer to use exclusively at the office. I currently use the laptop for both home and office work, but since the laptop is getting a bit old and computer components are so cheap these days I decided to build a work station just for me to use at the office. The best thing is that as it is custom built I can put whatever I damn well want on it – no pre-installed Windows or anything else. I can make it absolutely perfect for me.</p>
<p>I&#8217;ll be documenting here in my blog exactly the steps needed to take it from a <a href="http://en.wikipedia.org/wiki/Tabula_rasa">tabula rasa</a> to my perfect desktop system.  Apart from the system being obviously Linux based, there will be a number of things to consider before I get started. If I want it to be perfect, I need to think about what it is that I really need and want from a work only system. So, after a brainstorm this is the breakdown of what I require:</p>
<ol>
<li>
<h4>Keyboard Friendly</h4>
<p>I am becoming less interested in using the mouse. This is for a number of reasons, firstly it is quicker to keep your hands on the keyboard rather than always having to find the mouse and point and click. Secondly, using the mouse greatly exacerbates <a href="http://www.ccohs.ca/oshanswers/ergonomics/office/mouse/mouse_problems.html">RSI and all that jazz</a>. As such a system designed for maximum keyboard usage is important.</li>
<li>
<h4>Great Web Development Tools</h4>
<p>As a web developer this is a no brainer. I need to be able to have the tools for developing websites, testing (at code, server and client level) deployment and client side version control.</li>
<li>
<h4>Base system should be small, quick and light</h4>
<p>Due to point 2, I can see the need for being able to have virtualised instances of Windows running, each running a different version of IE. As such, the base system should be as small, quick and light as possible so it doesn&#8217;t get bogged down when I have one (or more) windows running for testing purposes.</li>
<li>
<h4>Communications</h4>
<p>I have to be able to email, chat, and talk with people via my computer</li>
<li>
<h4>Music and sound</h4>
<p>I need to listen to music at work!</li>
<li>
<h4>Must get on with others</h4>
<p>Some strange people out there still use propriety software. My system needs to be able to read Word and Powerpoint and all that stuff.</li>
<li>
<h4>Not be rude</h4>
<p>This is a strange request, but over the weekend I had a friend staying who is an IT administrator for a large international company. He had to do some work on their Windows based infrastructure, so he powered up Vista on my laptop (which I never use*) to log into their systems via the Remote Desktop. Half way through he had to make a couple of calls. When he came back Vista had rebooted and he had lost everything. We narrowed it down to the fact that Vista had updates, installed them and rebooted without even asking for permission. IMO, that is really fucking rude.</li>
<li>
<h4>Stable</h4>
<p>Last, but by no means least, the system has to be solid. I can&#8217;t have it crashing on me every hour.</li>
</ol>
<p>And that is pretty much it. Follow me over the next week or so whilst I sort out my ideal perfect work station.</p>
<p><em>* I just had to make that point</em></p>
<h4>Building My Perfect Desktop</h4>
<ul>
<li><a href="http://www.robsearles.com/2010/03/18/my-perfect-desktop-day-1-the-base-system/">Day 1 &#8211; The Base System</a><strong><br />
</strong></li>
</ul>
<img src="http://www.robsearles.com/?ak_action=api_record_view&id=270&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.robsearles.com/2010/03/16/my-perfect-desktop-day-0/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Converting from Mac to Unix line endings</title>
		<link>http://www.robsearles.com/2010/03/10/converting-from-mac-to-unix-line-endings/</link>
		<comments>http://www.robsearles.com/2010/03/10/converting-from-mac-to-unix-line-endings/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 11:12:18 +0000</pubDate>
		<dc:creator>Rob Searles</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Emacs]]></category>

		<guid isPermaLink="false">http://www.robsearles.com/?p=263</guid>
		<description><![CDATA[This is more a post for me than anyone else, but I thought I&#8217;d share anyway.
In our team we have a mixture of Linux and Mac users, and we are constantly editing the same files. One of the most irritating things is when a file is saved with Mac line endings instead of Unix line [...]]]></description>
			<content:encoded><![CDATA[<p>This is more a post for me than anyone else, but I thought I&#8217;d share anyway.</p>
<p>In our team we have a mixture of Linux and Mac users, and we are constantly editing the same files. One of the most irritating things is when a file is saved with Mac line endings instead of Unix line endings (displaying as <strong>^M</strong> in <a href="http://www.robsearles.com/2009/10/25/a-week-with-emacs-one-week-later/">Emacs</a>). This happens very rarely, but on the occasion it does I can quickly convert back using the following commands on my Linux box:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\r</span>'</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span> <span style="color: #000000; font-weight: bold;">&lt;</span> file-in-question.txt <span style="color: #000000; font-weight: bold;">&gt;</span> tmp.file
$ <span style="color: #c20cb9; font-weight: bold;">mv</span> tmp.file file-in-question.txt</pre></div></div>

<p>Works perfectly</p>
<p>If you want to find more about the tr (Translate) program, <a href="http://linux.die.net/man/1/tr">visit the man page</a>.</p>
<img src="http://www.robsearles.com/?ak_action=api_record_view&id=263&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.robsearles.com/2010/03/10/converting-from-mac-to-unix-line-endings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting a Windows Refund</title>
		<link>http://www.robsearles.com/2009/10/18/getting-a-windows-refund/</link>
		<comments>http://www.robsearles.com/2009/10/18/getting-a-windows-refund/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 10:29:30 +0000</pubDate>
		<dc:creator>Rob Searles</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Opinion]]></category>

		<guid isPermaLink="false">http://www.robsearles.com/?p=184</guid>
		<description><![CDATA[If you don't want Windows, but can't buy a laptop without it pre-installed then claim a refund.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just read quite an interesting article on the <a href="http://www.linuxmint.com/blog/?p=1073" target="_blank">Linux Mint blog</a> courtesy of <a href="http://www.linuxtoday.com/infrastructure/2009101700335OSMSLL" target="_blank">Linux Today</a>. It describes how Clem, a Linux Mint user, managed to get a refund on Windows that was pre-installed on a Dell laptop they purchased, and then donated the money to Linux Mint!</p>
<p>One of the comments tries to argue that Clem shouldn&#8217;t have been entitled to a refund as they knew what they were buying. I don&#8217;t hold with this argument as last time I tried to purchase any laptop that wasn&#8217;t a netbook I found it <strong>impossible</strong> to buy one without Windows pre-installed &#8211; and to make it worse they were pretty much all <a href="http://digital-lifestyles.info/2007/11/22/vista-is-rubbish-comic-video/" target="_blank">Vista</a>!</p>
<p>With people like Clem engaging in this kind of action, and with Ubuntu trying to make <a href="http://www.nytimes.com/2009/01/11/technology/11iht-ubuntu.1.19248024.html" target="_blank">Linux more accessible</a> to the average user, hopefully one day I&#8217;ll be able to purchase a laptop and have a choice of what I put on it.</p>
<img src="http://www.robsearles.com/?ak_action=api_record_view&id=184&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.robsearles.com/2009/10/18/getting-a-windows-refund/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VMWare Server: Connecting to Guest via SSH</title>
		<link>http://www.robsearles.com/2009/10/10/vmware-server-connecting-to-guest-via-ssh/</link>
		<comments>http://www.robsearles.com/2009/10/10/vmware-server-connecting-to-guest-via-ssh/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 22:03:56 +0000</pubDate>
		<dc:creator>Rob Searles</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.robsearles.com/?p=177</guid>
		<description><![CDATA[I have recently been playing around with an old laptop and it&#8217;s give me the taste for delving deeper into the world of Linux. For this I normally use VirtualBox, but a friend of mine (who is an avid Mac fan) was recently raving about VMWare&#8217;s Fusion. I decided to see if they had anything [...]]]></description>
			<content:encoded><![CDATA[<p>I have recently been <a href="http://www.robsearles.com/2009/10/04/installing-php53-on-ubuntu-jaunty/" target="_blank">playing around with an old laptop</a> and it&#8217;s give me the taste for delving deeper into the world of Linux. For this I normally use <a href="http://www.virtualbox.org/" target="_blank">VirtualBox</a>, but a friend of mine (who is an avid Mac fan) was recently raving about <a href="http://www.vmware.com/products/fusion/" target="_blank">VMWare&#8217;s Fusion</a>. I decided to see if they had anything similar for linux and give it a whirl. I toddled along to the <a href="http://www.vmware.com/" target="_blank">VMWare site</a>, couldn&#8217;t find anything, so Googled VMWare Server and went <a href="http://www.vmware.com/products/server/" target="_blank">straight to the relevant page</a>!</p>
<p>I downloaded, installed and connected to the VMWare Server admin via Firefox. All well and good. So now I wanted to actually use it. I decided to test it out using <a href="http://www.debian.org/" target="_blank">Debian</a> as the Guest. I chose Debian simply because I know it, and I know it has a <a href="http://www.debian.org/CD/netinst/#netinst-stable" target="_blank">net install</a>, meaning I could test out a minimum system.</p>
<p>I downloaded the ISO, and then set about creating my new Debian Guest. First problem, I couldn&#8217;t find the Debian ISO! After reading the docs (which always takes second place to proding and poking around) it turns out that you need to add a Data Store, using the Commands menu on the right hand side of the VMWare admin home.</p>
<p>Once I had sorted this out I then created the new Guest specifying NAT networking, attached the Debian ISO and started it up.I selected NAT networking because Host Only will not let me get access to the outside world from the guest &#8211; obviously a pain as I was using the Debian net install &#8211; and I have always found Bridge Networking to be as flaky as a delicious if not slightly dry Cadbury&#8217;s chocolate bar.</p>
<p>Hmm, VMWare is clearly very different to VirtualBox because it didnt open a window where I could see the new guest booting up. How do I communicate with the guest. Again, after some poking I found a tab for the <strong>Console</strong>, which at first asked me to install a Firefox plugin, but once that was installed I could see the Guest.</p>
<p>I then installed Debian and restarted the Guest server.</p>
<p>Once rebooting I then tried to install OpenSSH. Slight problem, I couldn&#8217;t get an outside line! I couldn&#8217;t even ping Google. Hmm. After some searching I found out that the problem was <a href="http://communities.vmware.com/thread/62624" target="_blank">DHCP was not starting up</a>. I ran the command (as root)</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">$ dhclient eth0</pre></div></div>

<p>This allowed me to connect to the outside world, and to ensure it would always start up I followed the commands from <a href="http://www.debianhelp.org/node/2650" target="_blank">this post within Debian Help</a>:</p>
<blockquote><p>Add the line</p>

<div class="wp_syntax"><div class="code"><pre class="text text" style="font-family:monospace;">auto eth0</pre></div></div>

<p>to /etc/network/interfaces</p></blockquote>
<p>After this I managed to successfully install Open SSH server, by running the following command as root:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> openssh-server</pre></div></div>

<p>So now it was already to I tried to connect via SSH from my Host Ubuntu system to my Guest Debian system. But how? Again, after some searching I found out that you <a href="http://www.linuxforums.org/forum/servers/112384-how-connect-mail-server-running-guest-os-vmware-2.html" target="_blank">had to forward some ports</a>. On the host, edit /etc/vmware/vmnet8/nat/nat.conf. Uncomment the line under the SSH section that says:</p>

<div class="wp_syntax"><div class="code"><pre class="text text" style="font-family:monospace;"># 8889 = 172.16.81.128:22</pre></div></div>

<p>the restart the VMWare networking services:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>vmware<span style="color: #000000; font-weight: bold;">/</span>net-services.sh restart</pre></div></div>

<p>You can see from the nat.conf file that you can also forward other ports such as Web and FTP</p>
<p>Finally, you can now connect to your Guest from your Host with the command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-p</span> <span style="color: #000000;">8889</span> root<span style="color: #000000; font-weight: bold;">@</span>localhost</pre></div></div>

<p>It took some effort, but I can now successfully connect to any number of Guests from my Host.</p>
<img src="http://www.robsearles.com/?ak_action=api_record_view&id=177&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.robsearles.com/2009/10/10/vmware-server-connecting-to-guest-via-ssh/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Simple tools produce powerful results</title>
		<link>http://www.robsearles.com/2009/09/14/simple-tools-produce-powerful-results/</link>
		<comments>http://www.robsearles.com/2009/09/14/simple-tools-produce-powerful-results/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 21:07:05 +0000</pubDate>
		<dc:creator>Rob Searles</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.robsearles.com/?p=169</guid>
		<description><![CDATA[
Sometimes I really love the Linux world. Sometimes it all fits so neatly together and lets you just get stuff done. Sure it might take a bit of digging around, but when it all comes together it really is beautiful!
I&#8217;m waxing lyrical today because I have just managed to fit all the pieces together for [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-170" title="Tools" src="http://www.robsearles.com/wp-content/uploads/2009/09/tools.png" alt="Tools" width="300" height="300" /></p>
<p>Sometimes I really love the Linux world. Sometimes it all fits so neatly together and lets you just get stuff done. Sure it might take a bit of digging around, but when it all comes together it really is beautiful!</p>
<p>I&#8217;m waxing lyrical today because I have just managed to fit all the pieces together for a certain aspect of a large project we&#8217;re working here at <a href="http://www.ibrow.com" target="_blank">ibrow towers</a>. This particular problem was a three parter:</p>
<ol>
<li>Users can FTP into a server into their own directory.</li>
<li>These users should be created automatically (i.e. sign up on site, get details, ftp) and have the same login credentials as the rest of the site</li>
<li>Uploads to the FTP server should be monitored and each file processed</li>
</ol>
<p>To solve this three part problem, I utilised the following:</p>
<ul>
<li>VSFTPD FTP Server using MySQL as the credentials database</li>
<li>incron as the directory monitoring</li>
<li>bash as the glue</li>
</ul>
<p><span id="more-169"></span></p>
<p>My server is running Debian, and I found the on <a href="http://www.howtoforge.com/vsftpd_mysql_debian_etch" target="_blank">Falko Timme tutorial for VSFTPD and MySQL at How To Forge</a> incredibly easy to follow and it worked pretty much &#8220;out of the box&#8221;. It did take a bit of tweaking, but I was able to use my existing data structure to be used for the FTP login credentials.</p>
<p>The next task was directory monitoring. After some searching around I found <a href="http://incron.aiken.cz/" target="_blank">incron</a>. On a Debian system installation was a breeze:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> incron</pre></div></div>

<p>Now, for my VSFTP user I had to create an incrontab. First I had to add the user into the incron.conf file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>incron.allow</pre></div></div>

<p>This was blank, so I just added the line:</p>

<div class="wp_syntax"><div class="code"><pre class="text text" style="font-family:monospace;">vsftpd</pre></div></div>

<p>No to test this was working I created a small bash script that esentially appends to a text file. I created this in /home/vsftpd/bin/incron.sh</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">!/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">bash</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;start: $1 || $2&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>vsftpd<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>log.txt</pre></div></div>

<p>The $1 and $2 variable are to store command line arguments which I&#8217;ll pass via the incrontab. Make this executable and quickly test this is working:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">chmod</span> 0755 <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>vsftpd<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>incron.sh
$ <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>vsftpd<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>incron.sh <span style="color: #7a0874; font-weight: bold;">test</span> hello
$ <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>vsftpd<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>log.txt
start: <span style="color: #7a0874; font-weight: bold;">test</span> || hello</pre></div></div>

<p>The test script is all working so now we need to call it whenever a file is uploaded. You need to edit the incrontab passing it the directory to monitor, which actions to look out for and then what script to call, passing any arguments.</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">$ incrontab <span style="color: #660033;">-e</span></pre></div></div>

<p>You&#8217;ll be taken to an editor where you should enter something like:</p>

<div class="wp_syntax"><div class="code"><pre class="text text" style="font-family:monospace;">/home/vsftpd/cam1/ IN_CLOSE_WRITE /home/vsftpd/bin/incron.sh 123 $@$#</pre></div></div>

<p>The IN_CLOSE_WRITE basically means, &#8220;once finished uploading&#8221;. &#8220;123&#8243; is the user id, as I didn&#8217;t want the directory name to reflect the user id. Finally the $@$# is translated into the full path of the directory (as typed by you, so keep an eye on trailing slashes) and the file name that was caught by the incron, e.g: /home/vsftpd/cam1/my-file.txt</p>
<p>Now simply test this by FTPing and uploading something to the user&#8217;s directory. It&#8217;s always fun to do:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>vsftpd<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>log.txt</pre></div></div>

<p>to watch the log being updated in real time. Now that&#8217;s working you can change the incron.sh script to do anything you want!</p>
<p>The final thing to do is to automate the creation of the users&#8217; FTP directories. When adding the directories we also want to ensure that they are correctly monitored. To solve this I wrote a small bash script that is saved on the FTP server, /home/vsftpd/bin/add-user.sh:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># user id = $1</span>
<span style="color: #666666; font-style: italic;"># user directory = $2</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Create the directory</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>vsftpd<span style="color: #000000; font-weight: bold;">/</span>$<span style="color: #000000;">2</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Add monitoring</span>
incrontab <span style="color: #660033;">-l</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>$1.in
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;/home/vsftpd/$2/ IN_CLOSE_WRITE /home/vsftpd/bin/incron.sh $1 <span style="color: #000099; font-weight: bold;">\$</span>@<span style="color: #000099; font-weight: bold;">\$</span>#&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>$1.in
incrontab <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>$1.in
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>$1.in</pre></div></div>

<p>The important part of this is that we keep monitoring intact. And this is one of the reasons why I love Linux so much. By using incrontab -l to send the output to a tmp file, then echoing the new incrontab line to append that tmp file, then finally calling incrontab again, this time passing the tmp file we have just added a new directory to monitor, whilst keeping all the existing ones! Simple, elegant and it just works. One thing to not here is to make sure you escape the $@ and $# variables in the echo.</p>
<p>Make this executable:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">chmod</span> 0755 <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>vsftpd<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>add-user.sh</pre></div></div>

<p>Test this on the server:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>vsftpd<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>add-user.sh <span style="color: #000000;">456</span> testdir</pre></div></div>

<p>and you should see that the testdir has been created and monitored, associating with the user id 456. This script should be invoked during the user creation phase in your web app.</p>
<p>That&#8217;s it!</p>
<p>Through using bash, VSFTPD with MySQL credentials and the incrontab program I can now automatically create a new user, keeping it linked in with my website database, create the user&#8217;s FTP directory and monitor it for any uploads.</p>
<p>Using some faily simple tools together (here ftp, bash and incron) you can create some very powerful solutions.</p>
<img src="http://www.robsearles.com/?ak_action=api_record_view&id=169&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.robsearles.com/2009/09/14/simple-tools-produce-powerful-results/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu Jaunty command line email: Sup, OfflineIMAP and MSMTP</title>
		<link>http://www.robsearles.com/2009/08/30/ubuntu-jaunty-command-line-email-sup-offlineimap-and-msmtp/</link>
		<comments>http://www.robsearles.com/2009/08/30/ubuntu-jaunty-command-line-email-sup-offlineimap-and-msmtp/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 13:50:03 +0000</pubDate>
		<dc:creator>Rob Searles</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[sup]]></category>

		<guid isPermaLink="false">http://www.robsearles.com/?p=166</guid>
		<description><![CDATA[Recently I&#8217;ve been getting increasingly frustrated with both Thunderbird. Don&#8217;t get me wrong, it is an excellent email solution, but lately I&#8217;ve been finding that it is slowing down due to the amount of emails I have. I do have a webmail package attached to it, which I use of Thunderbird has slowed to a [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve been getting increasingly frustrated with both Thunderbird. Don&#8217;t get me wrong, it is an excellent email solution, but lately I&#8217;ve been finding that it is slowing down due to the amount of emails I have. I do have a webmail package attached to it, which I use of Thunderbird has slowed to a grinding halt, but sometimes, and as hard as this may be to believe, I&#8217;m not connected to the internets!</p>
<p>Also, using Thunderbird is just not geeky enough.</p>
<p>So I was looking for something better, something quicker that allowed me to download emails, but keep in sync my IMAP. And don&#8217;t forget, something truly dweeby. For me, this meant the command line. I find the more I use Linux the more I am drifting towards the command line as a way of getting things done.</p>
<p>After a bit of searching around, I found a <a href="http://sup.rubyforge.org/" target="_blank">Rails package called Sup</a>. This looked like the ideal solution from my point of view. The authors seemed to be coming from the same head space I am regarding email, so I thought I&#8217;d give it a try.</p>
<p>After several hours hacking about, I now have it fully working, and even sending email, and I&#8217;ll outline the steps I took to get it up and running. I&#8217;m running Xubuntu Jaunty, but hopefully this will apply to most Ubuntu and Debian versions.</p>
<p><span id="more-166"></span></p>
<p><strong>Command line email: Sup installation<br />
</strong></p>
<p>Obviously, the first thing to do is to install Sup itself. For this I followed the instructions on the <a href="http://sup.rubyforge.org/wiki/wiki.pl?Debian/Ubuntu_Hints" target="_blank">Sup WIKI for Debian/Ubuntu</a>. I had absolutely no problems with these instructions, but for the sake of ease on your behalf, I&#8217;ll outline them below:</p>
<p>Firstly, you&#8217;ll need to install Ruby and the Build Essentials</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> ruby-full build-essential</pre></div></div>

<p>Next, you&#8217;ll have to install Ruby Gems. You can find and download the latest Gems version from<br />
<a href="http://rubyforge.org/frs/?group_id=126">http://rubyforge.org/frs/?group_id=126</a>. At the time of writing, it is 1.3.5</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>rubyforge.org<span style="color: #000000; font-weight: bold;">/</span>frs<span style="color: #000000; font-weight: bold;">/</span>download.php<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">60718</span><span style="color: #000000; font-weight: bold;">/</span>rubygems-1.3.5.tgz
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-zxvf</span> rubygems-1.3.5.tgz
<span style="color: #7a0874; font-weight: bold;">cd</span> rubygems-1.3.5<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> ruby setup.rb
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gem1.8 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gem
<span style="color: #c20cb9; font-weight: bold;">sudo</span> gem update <span style="color: #660033;">--system</span></pre></div></div>

<p><em>Note: for me, &#8220;sudo gem update &#8211;system&#8221; didn&#8217;t update anything</em></p>
<p>Now we have Ruby and Ruby Gems installed, we can install Sup</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libncurses5-dev
<span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> sup</pre></div></div>

<p>For me, there were no problems with the install. If you are having problems, you might want to check out the <a href="http://sup.rubyforge.org/wiki/wiki.pl?HomePage" target="_blank">Sup Wiki</a>.<br />
If correctly installed, you can now run Sup</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">sup</pre></div></div>

<p>When you first run Sup, your are greeted by a blank screen, not very exciting, but you can have a play as lined out in the <a href="http://sup.rubyforge.org/NewUserGuide.txt" target="_blank">New Users Guide</a>.</p>
<p><strong>Downloading Email: OfflineIMAP<br />
</strong></p>
<p>Whilst is is all very well having a blank screen, at some point you might just want to actually use it to connect to your email. My main email is an IMAP account on my own server. Sup lets you connect directly to the IMAP server, however, Sup admits it is &#8220;very slow due mostly to Ruby&#8217;s IMAP library&#8221; and instead recommends using something like <a href="http://software.complete.org/software/projects/show/offlineimap" target="_blank">OfflineIMAP</a> to mirror your IMAP server. Well, that&#8217;s what I decided to do.</p>
<p>Installing OfflineIMAP couldn&#8217;t be simpler on Ubuntu:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> offlineimap</pre></div></div>

<p>You will need to create a configuration file in your home directory. The name of the file should be <strong>.offlineimaprc</strong> an example of which is below</p>

<div class="wp_syntax"><div class="code"><pre class="text text" style="font-family:monospace;">[general]
accounts = robsearles
&nbsp;
[Account robsearles]
localrepository = Local
remoterepository = Remote
&nbsp;
[Repository Local]
type = Maildir
localfolders = ~/Mail/robsearles
&nbsp;
[Repository Remote]
type = IMAP
remotehost = mail.ibrow.com
remoteuser = username
remotepass = password</pre></div></div>

<p>This is relatively self explanatory, but you can get more info at the <a href="http://software.complete.org/static/offlineimap/doc//manual.html" target="_blank">OfflineIMAP Wiki.</a> The three key things to note here are firstly in [Repository Local] the type is &#8220;Maildir&#8221; we will need this later when telling Sup the mailbox format type. Next the location of localfolders will be needed by Sup to find these emails. Finally, under [Repository Remote] we have included a remotepass. This is so we can run OfflineIMAP as a non-interactive cron job.</p>
<p>You will need to create your local mail directory. The directory I have specified is purely arbitory and you can specify what you want.</p>
<p>Now, test your configuration file by running</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">offlineimap</pre></div></div>

<p>You should hopefully see a load of stuff happening, and the OfflineIMAP closing. Huzzah! It works. If not, you may have to have a play around with your config file some more.</p>
<p>Now you have it working, set up a cron job to automatically sync email. My crontab looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text text" style="font-family:monospace;">*/5 * * * * offlineimap</pre></div></div>

<p>This basically sets OfflineIMAP to run every 5 minutes</p>
<p><strong>Viewing Email: Sup configuration</strong></p>
<p>Sup has a really easy to follow interactive configuration system. Simply run</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">sup-config</pre></div></div>

<p>and follow the prompts, when it asks you for sources, you will want to specify &#8220;1. Add a new source&#8221;. Now, this is where those first two key values in the OfflineIMAP configuration are needed. Remember, we specified OfflineIMAP to use Maildir format, so when asked by sup-config what source you require, you must select &#8220;2. maildir directory&#8221;. The you must enter the full path as specified in the location of localfolders in the OfflineIMAP config. You can make your own minds up about the following config options.</p>
<p>That&#8217;s pretty much it. You will want to sync your mailbox now, and once done so run sup again. This time you <strong>should</strong> see all your emails. If now, again, look at your config options and the <a href="http://sup.rubyforge.org/wiki/wiki.pl" target="_blank">wiki</a>.</p>
<p><strong>Sending Email: MSMTP</strong></p>
<p>Reading emails is great, but one day you may want to actually send one yourself. When I tried to do this I was greeted with an error &#8211; I didn&#8217;t have sendmail. After some browsing around, it was clear that the easiest way to send email was via the MSMTP package.</p>
<p>Again, installation is effortless on Ubuntu:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> msmtp</pre></div></div>

<p>Configuration was slightly more tricky and I had to play around a lot before it worked as expected.</p>
<p>My SMTP server is a normal hosted package running Exim, but this doesn&#8217;t really matter. The key was that I have to authenticate myself to send. First, create a config file in your home directory <strong>.msmtprc</strong> and fill in your configuration details. Mine are as below, but</p>

<div class="wp_syntax"><div class="code"><pre class="text text" style="font-family:monospace;">#Set default values for all following accounts.
defaults
logfile ~/Mail/.msmtp.log
&nbsp;
# My SMTP
account foobar
host mail.bar.co.uk
from foo@bar.co.uk
auth on
tls on
user foo
password raboof
&nbsp;
# Set a default account
account default : foobar</pre></div></div>

<p>I don&#8217;t know if the &#8220;tls on&#8221; option is needed for my particular config, but it seems to work, so who am I to complain?!</p>
<p>When testing your config, a good plan is to run MSMTP in the same way as Sup is expecting to. My test command was:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">msmtp  --<span style="color: #007800;">account</span>=foobar <span style="color: #660033;">-t</span> <span style="color: #000000; font-weight: bold;">&amp;</span>lt; test.mail</pre></div></div>

<p>The contents of test.mail were very simple:</p>

<div class="wp_syntax"><div class="code"><pre class="text text" style="font-family:monospace;">To: test@bar.co.uk
From: foo@bar.co.uk
Subject: Test from command line
&nbsp;
Hello, this is a test</pre></div></div>

<p>I had to play around a lot with the config before it worked for me, but I found the above the quickest way to test it without having to enter your email again and again.</p>
<p>Once all working, you need to edit the Sup config file to use MSMTP. The config file can be located at ~/.sup/config.yaml and in your :accounts: section edit the :sendmail: line to read</p>

<div class="wp_syntax"><div class="code"><pre class="text text" style="font-family:monospace;">:sendmail: msmtp --account=foobar -t</pre></div></div>

<p>Now, test sending an email from Sup and hopefully it&#8217;ll work! Again, if not requires lots of playing about and testing different combinations, but if you can send from the command line, you should be able to send from Sup.</p>
<p>And that&#8217;s it!</p>
<p>Phew, it was a long effort, but hopefully well worth it. Please let me know if it was!</p>
<p><strong>More Sup posts</strong></p>
<ul>
<li><a href="http://www.robsearles.com/2009/09/28/sup-mail-client-is-saving-my-life/">Sup is saving my life!</a></li>
<li><a href="http://www.robsearles.com/2010/05/26/sup-crash-index-locked-then-terminates-easy-fix/">Fixing  a Sup Crash</a></li>
</ul>
<img src="http://www.robsearles.com/?ak_action=api_record_view&id=166&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.robsearles.com/2009/08/30/ubuntu-jaunty-command-line-email-sup-offlineimap-and-msmtp/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Setting up XDebug for PHP in Ubuntu Intrepid Ibex</title>
		<link>http://www.robsearles.com/2009/01/13/setting-up-xdebug-for-php-in-ubuntu-intrepid-ibex/</link>
		<comments>http://www.robsearles.com/2009/01/13/setting-up-xdebug-for-php-in-ubuntu-intrepid-ibex/#comments</comments>
		<pubDate>Tue, 13 Jan 2009 16:17:04 +0000</pubDate>
		<dc:creator>Rob Searles</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.robsearles.co.uk/?p=59</guid>
		<description><![CDATA[I love Ubuntu and today reminded me exactly why. It&#8217;s just so easy to do stuff in it!
I run a LAMP development server off my laptop, and today some of the PHP I was writing was throwing up some errors. Unfortunately I hadn&#8217;t installed XDebug which makes life so much easier when debugging PHP.
Oh no, [...]]]></description>
			<content:encoded><![CDATA[<p>I love Ubuntu and today reminded me exactly why. It&#8217;s just so easy to do stuff in it!</p>
<p>I run a LAMP development server off my laptop, and today some of the PHP I was writing was throwing up some errors. Unfortunately I hadn&#8217;t installed XDebug which makes life so much easier when debugging PHP.</p>
<p>Oh no, I though. I&#8217;ll have to download it, install it, update the PHP.ini file. Argh.</p>
<p>But wait&#8230;no! I have Ubuntu, all it took was 2 easy steps:</p>
<p><strong>Step 1, install Xdebug</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> php5-xdebug</pre></div></div>

<p><strong>Step 2, restart Apache</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 restart</pre></div></div>

<p>Done! Easy peasy.</p>
<p>Thanks Ubuntu <img src='http://www.robsearles.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img src="http://www.robsearles.com/?ak_action=api_record_view&id=59&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.robsearles.com/2009/01/13/setting-up-xdebug-for-php-in-ubuntu-intrepid-ibex/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
