<?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>Andrew Vayanis &#187; Linux</title>
	<atom:link href="http://www.vayanis.com/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vayanis.com</link>
	<description>... a little piece of my mind.</description>
	<lastBuildDate>Wed, 02 Feb 2011 05:05:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Setting up LAML (Linux, Apache, MySQL, Lua) with MAMP</title>
		<link>http://www.vayanis.com/2010/02/04/setting-up-laml-linux-apache-mysql-lua-with-mamp/</link>
		<comments>http://www.vayanis.com/2010/02/04/setting-up-laml-linux-apache-mysql-lua-with-mamp/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 05:00:04 +0000</pubDate>
		<dc:creator>Andrew Vayanis</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Guides]]></category>
		<category><![CDATA[Lua]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[LAML]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MAMP]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.vayanis.com/?p=48</guid>
		<description><![CDATA[As a weekend project I decided to set up a LAML, (Linux, Apache, MySQL, Lua) stack on my computer. I never worked with Lua before, but I figured it wouldn&#8217;t be too hard to get it working with my MAMP setup. Getting started, I spent some time reading any articles I could find on the [...]]]></description>
			<content:encoded><![CDATA[<p>As a weekend project I decided to set up a LAML, (Linux, Apache, MySQL, Lua) stack on my computer.  I never worked with Lua before, but I figured it wouldn&#8217;t be too hard to get it working with my MAMP setup.  Getting started, I spent some time reading any articles I could find on the web that talked about setting up or using using Lua for web development.  I quickly ran into the <a href="http://www.keplerproject.org/">Kepler Project</a> which as their website points out:</p>
<blockquote><p>
is an open source platform that brings the power of Lua to web development
</p></blockquote>
<p>While this was my goal, I wanted to start from scratch since I haven&#8217;t had any experience with the language and didn&#8217;t want to learn it on a specific platform just yet.  So, I went on to figure out how to install and configure Lua with MAMP.  To accomplish this yourself, you will need: Xcode, MAMP, Lua, LuaRocks, MAMP source, and mod_fcgid.<br />
<span id="more-48"></span></p>
<h3>Step 1: Install Xcode</h3>
<p>This one is pretty straight forward.  You can easily install Xcode if you have an OS X install DVD.  Otherwise you can download it from the <a href="http://developer.apple.com/technology/xcode.html">Apple Developer Center</a>.</p>
<h3>Step 2: Install Lua</h3>
<p>Installing Lua is also straight forward.  Download the source from <a href="http://www.lua.org/ftp/">Lua&#8217;s FTP site</a>.  I chose the current version (5.1.4).  After extracting the source run the following commands:<br />
<code><br />
cd /path/to/source/<br />
make macosx<br />
sudo make install<br />
</code><br />
This should install the Lua interpreter into your /usr/local/bin/</p>
<h3>Step 3: Install LuaRocks</h3>
<p>To install LuaRocks, you first need to download the <a href="http://luarocks.org/releases/">source</a>.  The current release is 2.0.1.  After downloading the source run the following commands:<br />
<code><br />
cd /path/to/source/<br />
make<br />
sudo make install<br />
</code><br />
This should install luarocks in /usr/local/bin/ .  You can test your installation with:<br />
<code>luarocks help</code><br />
You should be presented with a list of commands to use luarocks.</p>
<h3>Step 4: Install Lua MySQL support</h3>
<p>This part is a little tricky as you need to make sure you have the source for your MAMP installation.  You can download the <a href="http://sourceforge.net/projects/mamp/files/mamp/1.8.2/MAMP_components_1.8.2.dmg.zip/download">MAMP source</a> from the <a href="http://www.mamp.info/en/index.html">MAMP website</a>.  Running the .dmg should extract the source.  After extracting the source run the following:<br />
<code><br />
mkdir /Applications/MAMP/Library/Include/<br />
mv /path/to/extracted/mamp/source/ /Applications/MAMP/Library/Include/<br />
</code><br />
Once you have moved your source over, extract the MySQL package then run the following commands:<br />
<code><br />
cd /Applications/MAMP/Library/include/mysql-5.1.37/<br />
./configure<br />
make<br />
</code><br />
Once you have finished building MySQL, you will want to move the mysqlclient into the current MySQL location:<br />
<code><br />
cp /Applications/MAMP/Library/include/mysql-5.1.37/libmysql/.libs/*.dylib /Applications/MAMP/Library/lib/mysql/<br />
</code><br />
You will now be able to install the luasql-mysql package from luarocks with the following command:<br />
<code><br />
sudo luarocks install luasql-mysql 2.2.0-1 MYSQL_INCDIR=/Applications/MAMP/Library/include/mysql-5.1.37/include MYSQL_LIBDIR=/Applications/MAMP/Library/lib/mysql<br />
</code></p>
<h3>Step 5: Install Lua fcgid wrapper</h3>
<p>This is an easy one:<br />
<code><br />
luarocks install lua wsapi-fcgi 1.1<br />
</code></p>
<h3>Step 6: Install Apache mod_fcgid</h3>
<p>This part was a bit tricky for me since I don&#8217;t have much experience compiling Apache modules.  First, you will need to extract the httpd source, for me this was httpd-2.0.63.tar.gz.  Next, you will want to build Apache into a separate directory.  Use the following to build Apache:<br />
<code><br />
./configure --prefix=/path/to/target/Apache<br />
make<br />
make install<br />
</code><br />
While running the make command, you may get the following error:</p>
<p><code><br />
sendrecv.c:965:2: error: #error APR has detected sendfile on your system, but nobody has written a<br />
sendrecv.c:966:2: error: #error version of it for APR yet. To get past this, either write apr_sendfile<br />
sendrecv.c:967:2: error: #error or change APR_HAS_SENDFILE in apr.h to 0.<br />
</code></p>
<p>Fixing this is simple, all you need to do is edit /Applications/MAMP/Library/include/httpd-2.0.63/srclib/apr/include/apr.h and make the following modifications:<br />
<code><br />
-#define APR_HAS_SENDFILE  1<br />
+#define APR_HAS_SENDFILE  0<br />
</code></p>
<p>I know its taken quite some time now, but you are almost done!  All that&#8217;s left is to build mod_fcgid and configure Apache.  To build mod_fcgid run the following commands:<br />
<code><br />
APXS=/path/to/target/Apache/bin/apxs ./configure.apxs<br />
make<br />
make install<br />
cp /path/to/target/Apache/modules/mod_fcgid.so /Applications/MAMP/Library/modules<br />
</code></p>
<h3>Step 7: Configure Apache for mod_fcgid and Lua</h3>
<p>Now that you have everything built and in place, you just need to configure Apache and then you will be ready to start building Lua web apps!</p>
<p>Open /Applications/MAMP/conf/apache2/httpd.conf with your favorite text editor and add the following to the load modules section:<br />
<code><br />
LoadModule fcgid_module modules/mod_fcgid.so<br />
</code><br />
While you are at it, you can comment out the following lines if you like (I am not sure if it is possonlble to run mod_cgid with mod_fcgid, so I just took them out).<br />
<code><br />
#LoadModule cgi_module modules/mod_cgi.so<br />
#LoadModule cgid_module modules/mod_cgid.so<br />
</code><br />
Next, find the IfModule mod_fcgid directive, and add the following under it:<br />
<code><br />
<ifModule mod_fcgid.c><br />
	AddHandler fcgid-script .lua<br />
	FcgidWrapper /Users/avayanis/.luarocks/bin/wsapi.fcgi .lua<br />
	Options +ExecCGI<br />
</ifModule><br />
</code><br />
Finally, restart Apache through the MAMP application and test it out!  Here is a sample lua script to test out your Lua environment:</p>

<div class="wp_syntax"><div class="code"><pre class="lua" style="font-family:monospace;">module<span style="color: #66cc66;">&#40;</span>..., package.seeall<span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #b1b100;">function</span> run<span style="color: #66cc66;">&#40;</span>wsapi_env<span style="color: #66cc66;">&#41;</span>
    <span style="color: #b1b100;">local</span> headers <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;Content-type&quot;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">&quot;text/html&quot;</span> <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #b1b100;">local</span> <span style="color: #b1b100;">function</span> hello_text<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #b1b100;">coroutine.yield</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Hello World!&quot;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #b1b100;">end</span>
    <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">200</span>, headers, <span style="color: #b1b100;">coroutine.wrap</span><span style="color: #66cc66;">&#40;</span>hello_text<span style="color: #66cc66;">&#41;</span>
<span style="color: #b1b100;">end</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.vayanis.com/2010/02/04/setting-up-laml-linux-apache-mysql-lua-with-mamp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu/Linux &#8211; moving on up</title>
		<link>http://www.vayanis.com/2007/05/16/ubuntulinux-moving-on-up/</link>
		<comments>http://www.vayanis.com/2007/05/16/ubuntulinux-moving-on-up/#comments</comments>
		<pubDate>Thu, 17 May 2007 03:44:37 +0000</pubDate>
		<dc:creator>Andrew Vayanis</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.vayanis.com/2007/05/16/ubuntulinux-moving-on-up/</guid>
		<description><![CDATA[About two months ago, I decided it was time to revisit Linux in general after sitting down and reading through some of the new features offered by XGL with Compiz or Beryl. I installed Ubuntu 6.10 on a spare laptop late in march upgrading to 7.04 shortly after that, and I have been using it [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ubuntu.com" title="Ubuntu"><img src="http://173.255.225.117/wp-content/uploads/2007/05/ubuntulogo.png" title="Ubuntu" alt="Ubuntu" align="left" /></a>About two months ago, I decided it was time to revisit Linux in general after sitting down and reading through some of the new features offered by XGL with <a href="http://en.wikipedia.org/wiki/Compiz" title="Compiz">Compiz</a> or <a href="http://en.wikipedia.org/wiki/Beryl_%28window_manager%29" title="Beryl">Beryl</a>. I installed <a href="http://www.ubuntu.com" title="Ubuntu">Ubuntu</a> 6.10 on a spare laptop late in march upgrading to 7.04 shortly after that, and I have been using it as one of my primary workstations since. In case some of you may not know, I recently found out myself, the decimal number following the <a href="http://www.ubuntu.com" title="Ubuntu">Ubuntu</a> version, denotes the month it was released: 7.04 refers to version 7 released in April. Linux has definitely come a long way since I last used it in 2004, at least in terms of being a feasible desktop operating system for the masses.<br />
<span id="more-10"></span></p>
<h3>A little personal history</h3>
<p>I am a fairly new Mac convert; I made my switch about a year and a half ago after being exposed to OS X at work. I have always been a *nix fan, but I think my decision to switch was largely influenced by the clean and elegant User Interface offered by OS X combined with the power of having a console at my disposal. Up until recently, the Linux User Interface has been behind the curve, and is my main reason for staying away. Sure, you could install different window managers and use different themes, but I found that for the most part they were all a bit quirky. Maybe I didnâ€™t install them right or take the time to really figure them out. That in itself is a another problem of Linux and why it has not hit the mainstream yet: the command line better be your friend if you want to take full advantage of the system.</p>
<h3><a href="http://www.ubuntu.com" title="Ubuntu">Ubuntu</a> 7.04 &#8211; First glance</h3>
<p>This new release of <a href="http://www.ubuntu.com" title="Ubuntu">Ubuntu</a> seems to take Linux one step closer to being in the mainstream and I have faith that it will soon be there. Installing <a href="http://www.ubuntu.com" title="Ubuntu">Ubuntu</a> was a cinch as usual, but setting it up was even easier. Before this, my previous experience with <a href="http://www.ubuntu.com" title="Ubuntu">Ubuntu</a> 5.04 was somewhat painstaking, especially when trying to set up my wireless card. Of course it wasnâ€™t impossible and it took some reading and time to get the job done, but I have worked with computers for many years now. I hardly doubt nor do I expect the average use to be able to do this. Heck, most of the documentation and tutorials are online, so the process assumes you have a second machine available to figure things out.</p>
<h3>XGL and <a href="http://en.wikipedia.org/wiki/Beryl_%28window_manager%29" title="Beryl">Beryl</a></h3>
<p>Other than the easier setup, I am amazed with what XGL and <a href="http://en.wikipedia.org/wiki/Beryl_%28window_manager%29" title="Beryl">Beryl</a> have to offer as a window manager. It really makes Linux, for me at least, a much more enjoyable experience. I have always been a fan of tweaking the environment I work in because heck, if I am going to stare at a computer all day, I might as well enjoy what I look at. <a href="http://en.wikipedia.org/wiki/Beryl_%28window_manager%29" title="Beryl">Beryl</a> certainly does that for me, and although some of it may be purely eye candy such as the rotating cube, I still enjoy it. So for now, Linux, namely <a href="http://www.ubuntu.com" title="Ubuntu">Ubuntu</a>, feels almost complete to me. The next thing I hope to see are more polished applications as there are for the Mac.</p>
<h3>Still Lacking</h3>
<p>As a PHP Developer, Scream, and PHPedit just donâ€™t cut it, so I resort to Zend Studio which is a complete IDE rather than being a powerful text editor as my previous examples, and while I prefer the IDE, it would be nice to have a selection to choose from. This is only one example of Linux and what I feel is its lack of good user applications, but there are more. To clarify, I mean to say that Linux needs to focus more on the general user rather than on the computer savvy. I believe, the next few iterations of <a href="http://www.ubuntu.com" title="Ubuntu">Ubuntu</a> will fix this; I understand fully well that <a href="http://www.ubuntu.com" title="Ubuntu">Ubuntu</a> is only one distribution of Linux, but I believe that it is the furthest along to providing the ease of use consumers need. Hopefully, Linux application developers will pick up on to the needs of consumers and provide the necessary experience to make Linux a real desktop competitor.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vayanis.com/2007/05/16/ubuntulinux-moving-on-up/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

