Installing Mono Trunk or 2.6.4 Tag with Subversion Source on Ubuntu 10.04 Lucid

Updated June 23, 2010!

Lately, I’ve been really digging the new Ubuntu 10.04 on my desktop and web server. So I’ve been meaning to get a post out here describing how I got Mono trunk installed since it comes packaged with 2.4.4.  After much testing, I finally have finished getting a script to work with a fresh, vanilla install.

I stumbled on this blog post by Boris Schieman where he wrote a bash script to compile and install the Mono trunk.  I made a few tweaks to it for a vanilla linux install for the tagged 2.6.4 release and setup another one for updating a mono trunk build using the daily tarballs. I’ve successfully tested both versions on Ubuntu 10.04 Lucid. I’m just a casual linux/mono user, so use this at your own risk.

Steps to Install

Starting with a fresh install of Ubuntu 10.04 Server, these steps can be run from the console or via SSH. Lately, I’ve been testing the trunk script more thoroughly than the tagged version, but they both should work.  As always, checkout http://www.mono-project.com to get more detailed information about the different versions available and this install process. For the tagged 2.6.4 install, I chose to use the packaged mono to support compiling this one; so when it’s done, you’ll end up with two versions of mono installed. The packaged version is 2.4.4 located at: /usr/bin  and this compiled version will be located at /usr/local/bin and should be the default after it’s installed. These steps are basically the same for both versions. Just switch out the url for the script if you want to install the 2.6.4 tag.

Step by Step

  1. Create a new directory in your home directory called mono.
    mkdir mono
    cd mono
  2. Copy the script to this folder and make it executable
    wget http://www.integratedwebsystems.com/resources/p796/installmono-trunk.sh
    chmod 744 installmono-trunk.sh
  3. Execute it. (without sudo; you will be prompted occasionally for your sudo password during install phases)
    ./installmono-trunk.sh
  4. Check the install – sometimes the trunk doesn’t always compile fully or install correctly.  Check your /usr/local/bin folder to see what was installed.  You can also run mono –V to see the current runtime version, which should be the date of the tarball 20100618, etc.  (equivalent of 2.7 trunk) 
    ls /usr/local/bin
  5. Setup ModMono by moving the config file and enabling it for apache
    sudo mv /etc/apache2/modmono.conf /etc/apache2/mods-available 
    sudo ln -s /etc/apache2/mods-available/modmono.conf /etc/apache2/mods-enabled/mono.conf 
  6. Check your apache site configurations to ensure they’re using the correct path to mod-mono-server2 located at /usr/local/bin. I use the mod_mono configuration tool and then change the path it generates. Restart Apache when you’re done.
    sudo service apache2 restart

 

List of /usr/local/bin after install

 

Download Scripts

Install Mono SVN Tag 2.6.4

Install Mono Trunk (updated 2/26/2010)

Update Mono Install (updated 2/26/2010)

 

Install Script for Trunk

#!/bin/bash

TOPDIR=$(pwd)
BUILDDIR=$TOPDIR/build
DLDDIR=$TOPDIR/downloads

export PATH=/usr/local/bin:$PATH

echo "updating existing system"
sudo apt-get update
sudo apt-get upgrade -y

echo "installing prerequisites"
sudo apt-get install -y build-essential libc6-dev g++ gcc libglib2.0-dev pkg-config subversion apache2 apache2-threaded-dev bison gettext autoconf automake libtool

mkdir -p $BUILDDIR

echo
echo "downloading mono packages"
echo

cd $BUILDDIR

svn co svn://anonsvn.mono-project.com/source/trunk/xsp
svn co svn://anonsvn.mono-project.com/source/trunk/mod_mono

wget http://mono.ximian.com/daily/mono-latest.tar.bz2
wget http://mono.ximian.com/daily/monocharge-latest.tar.gz

cd $BUILDDIR
bunzip2 -df mono-latest.tar.bz2
tar -xvf mono-latest.tar
tar -xzvf monocharge-latest.tar.gz

echo
echo "building and installing mono packages"
echo
cd $BUILDDIR
cd mono-*
./configure --prefix=/usr/local --with-glib=system make
sudo make install

cd $BUILDDIR
cd monocharge*
sudo env prefix=/usr/local ./recharge.sh

cd $BUILDDIR
cd xsp
./autogen.sh --prefix=/usr/local make
sudo make install

cd $BUILDDIR
cd mod_mono
./autogen.sh --prefix=/usr/local make
sudo make install
cd $BUILDDIR

echo
echo "done"

Good luck!

comments powered by Disqus