CHAN - Bloat free ASP.Net

Introduction | About | Roadmap | Changelog | Licensing | Reference | Download | Guides: Windows , Linux/Mono , Building

OpenSUSE, Mono + Apache installation guide

Disclaimer: This guide assumes you are working on a clean install of OpenSUSE, and not a production machine. It may be woefully innaccurate, have missing steps or present incorrect information, follow at your own risk. The author accepts no responsibility whatsoever for any damages or losses of any kind caused by following the steps laid out below.

This guide steps through the entire process of setting up Apache and Mono on a clean install of OpenSUSE 11.0, it then goes on to show you how to host the Chan_Demo site but up to that point it holds true for any ASP.Net 2.0 based site. It's aimed somewhat at the linux beginner level so goes into a lot of detail and includes quite a few screenshots too.

The first step is to install OpenSUSE on your target system, and you need to remember your root password, you'll be using it a few times in this guide. Finally, assume "Lizard" means "Start Menu Button"!

Installing Apache and Mono

Configuring Apache and Mono

This requires editing some configuration files, but to make things easier we're going to open a file browser as root, so we can just get on with it. But running Konqueror as root can be a Very Bad Thing, so keep your fingers well away from that delete key!

# optional mod_status, mod_info
Include /etc/apache2/mod_status.conf
Include /etc/apache2/mod_info.conf
# mono
Include /etc/apache2/conf.d/mod_mono.conf

Enable Mono ASP AutoConfiguration

AutoConfiguration makes it easier for ASP.Net applications to be hosted under Mono by not requiring you to configure each subdirectory to act as an Application like you would with IIS. It basically allows it to find the correct web.config and bin directory for your site without being told where to look.

<IfModule !mod_mono.c>
    LoadModule mono_module /usr/lib/apache2/mod_mono.so

    AddType application/x-asp-net .aspx
</IfModule>	
<IfModule !mod_mono.c>
    MonoServerPath "/usr/bin/mod-mono-server2"
    MonoAutoApplication enabled

    LoadModule mono_module /usr/lib/apache2/mod_mono.so

    AddType application/x-asp-net .aspx
</IfModule>	

Start Apache

Apache's web server runs as httpd, but we need to start a service named apache2. This is similar to how IIS runs a web server, an ftp server and a seperate aspnet process.

Restarting Apache

You may need to do this if the Mono AutoConfiguration hasn't kicked in (If you see a "Couldn't find part of class" error on your ASPX page) or you've edited one of the config files again.

Writing a Test ASPX page

We're almost there, what we need to do now is create a very simple test page to show that the Mono ASP engine is running.

<% @ Page
  Language="C#"
%>
<%
  Response.Output.Write( DateTime.Now.ToString() );
%>

Hosting Chan Demo

If you got this far then you could - in theory - host any mono compatible ASP.Net site on your linux box, if you're not interested in Chan because you got here via google then thanks for dropping by, glad i could help! (But you really should check Chan out and throw away that evil MS ASP model...)

The chan_demo site to date is only expecting itself to be hosted as web-root , not under a sub directory, so the CSS and menu links wont work. Chan 0.8.1 already fixes this by having built-in template regions for Site_Root and Http_Root from web.config, but until then you'll need to fix the links yourself.

Making the site visible to (Windows) machines

Hosting a web site is no good unless people can actually see it, you may need to enable some settings to get Windows machines to see it specifically. First a quick test:

Installing and Configuring Samba

Here endeth the Chan, Apache, Mono, Samba and OpenSUSE tutorial, hopefully someone out there will find it useful!