Install ASP.NET 3.5 Environment for Ubuntu Maverick 10.10

If you are just curious, or looking for a way to test or develop .NET web applications under Linux, you should look at the Mono Project. Mono is an open source, cross-platform, implementation of C# and the CLR that is binary compatible with Microsoft.NET based on the ECMA standards for C# and the Common Language Runtime.

Cross platform is definitely one of its best features. Mono runs on Linux, Microsoft Windows, Mac OS X, BSD, and Sun Solaris, Nintendo Wii, Sony PlayStation 3, Apple iPhone. It also runs on x86, x86-64, IA64, PowerPC, SPARC (32), ARM, Alpha, s390, s390x (32 and 64 bits) and more. Developing your application with Mono allows you to run on nearly any computer in existence.

I won’t be able to try all computer in existence, but here is a quick guide to get ASP.NET 3.5 running under apache2 and ubuntu 10.10. In addition I’ll install MonoDevelop IDE, to be able to explore better Mono features : Database, debugger, Unit test, Code completion, GUI … etc.

First we need to install the necessary packages :

$ sudo apt-get install monodevelop mono-devel monodevelop-database mono-debugger mono-xsp2 libapache2-mod-mono mono-apache-server2 apache2

The Apache mod_mono module is enabled after this by default, I just disable this and enable mod_mono_auto instead for Auto Configuration :

$ sudo a2dismod mod_mono
$ sudo a2enmod mod_mono_auto

Finally we’ll have to edit the mod_mono_auto.conf and add default locations :

$ sudo -b gedit /etc/apache2/mods-available/mod_mono_auto.conf

Then add in the end :

MonoPath default "/usr/lib/mono/3.5"
MonoServerPath default /usr/bin/mod-mono-server2
AddMonoApplications default "/:/var/www"

We restart Apache again

$ sudo /etc/init.d/apache2 restart

Now let’s create a simple hello world and give it a try :

$ sudo -b gedit /var/www/index.aspx

And enter the code below, or any other sample

<%@ Page Language="C#" %>
<html>
<head>
<title>Sample Calendar</title>
</head>
<asp:calendar showtitle="true" runat="server">
</asp:calendar>

Then fire your fox at http://localhost/index.aspx and you should see the default calendar, Easy ?

More info and getting started with Mono at : http://mono-project.com/Start