Upgrading Ubuntu 9.10 Server to Mono 2.6

Thursday, 4 March 2010

Looks like SubSonic really needs Mono 2.6 to work. How do I get this on a Ubuntu 9.10 machine?

Edit: this post is now fairly redundant since a) Ubuntu 10.10 packages Mono 2.6 and b) I now use PetaPoco in preference to SubSonic

In my last post I described how to setup a Ubuntu 9.10/Mono/Apache/ASP.NET development server.

For the project I'm working on, we're trying to use SubSonic for ORM, but we're seeing problems like this:

System.InvalidOperationException: Too much method candidates

Basically it's caused by a bug in the Mono 2.4 runtime and the work around is to upgrade to 2.6. Unfortunately, search as I might, I couldn't find a pre-made package to install this, so had to resort to building from source. Luckily most of the hard work has been done by Patrick McEvoy, but I did encounter a few problems:

  1. In Patrick's list of prerequisite, replace libcairo-dev with libcairo2-dev
  2. On Ubuntu server, you'll also need libxul-dev
  3. And finally, you'll also need Mono 1.0 installed - mono-1.0-devel

So the full set of commands to do all this:

sudo apt-get install build-essential automake libtool gettext mono-devel subversion libpng-dev libtiff-dev libgif-dev libjpeg-dev libexif-dev autoconf automake bison flex libcairo2-dev libpango1.0-dev libxul-dev mono-1.0-devel
wget http://patrick.qmtech.net/downloads/mono_parallel.sh
sudo sh mono_parallel.sh

After a successful build you should be able to run mono-2.6 --version and confirm that it's built and installed correctly.

Next, we need to reconfigure Apache and mod_mono to use the new version of mono. Firstly, create a copy of the file used to launch the mono server:

    cd /usr/bin
    sudo cp mod-mono-server2 mod-mono-server2.6
    sudo vi mod-mono-server2.6

Edit the file to contain:

#/local/local!/bin/sh
export MONO_GAC_PREFIX=/usr
exec /usr/local/bin/mono-2.6 $MONO_OPTIONS "/usr/lib/mono/2.0/mod-mono-server2.exe" "$@"

Next, edit the mod-mono config file to use the new launch script:

   sudo vi /etc/mono-server2/mono-server2-hosts.conf

And add .6 to the end of the MonoServerPath line:

# Default configuration, don't edit it!
<IfModule mod_mono.c="">
    MonoUnixSocket default /tmp/.mod_mono_server2
    MonoServerPath default /usr/bin/mod-mono-server2.6
    AddType application/x-asp-net .aspx .ashx .asmx .ascx .asax .config .ascx
    MonoApplicationsConfigDir default /etc/mono-server2
    MonoPath default /usr/lib/mono/2.0:/usr/lib
</IfModule>
« Setting up a Ubuntu, Apache, MySQL, Mono, ASP.NET, MVC 2 Development Server VBoxHeadlessTray Updated for VirtualBox 3.2 »

Leave a comment

Name (required)
Email (required, not shown, for gravatar)
Website (optional)
Your Message
Leave these blank: