I’ve finally put together a bash script to automatically download, compile and install Mono on Ubuntu. At the time of writing, it installs Mono Should this be outdated by the time you read this, you can simply modify the install script to download the latest files.

A word of warning: This script will remove any previous installations of Mono done via apt-get or Synaptic. This means that existing Mono applications may cease to function or be removed entirely. I would suggest only running this on Ubuntu Server, where visual apps aren’t an issue.

First, make sure you’re running with root privileges:

$ sudo bash

Then let’s download the script from my blog:

$ wget http://blog.ruski.co.za/files/install-mono.sh

Before we can execute the script, we need to give the file execute permissions:

$ chmod 700 install-mono.sh

Now we can execute the script:

$ ./install-mono.sh

The script will now go off and do all the bits that it needs to install Mono. This may take a good couple of minutes.

For those who’re interested, the contents of the script is below:

#!/bin/bash apt-get remove mono-common apt-get update apt-get install build-essential pkg-config libglib2.0-dev bison libcairo2-dev libungif4-dev libjpeg62-dev libtiff4-dev gettext apache2-threaded-dev
mkdir /src mkdir /src/monoscript cd /src/monoscript
wget http://ftp.novell.com/pub/mono/sources/libgdiplus/libgdiplus-2.4.2.tar.bz2 wget http://ftp.novell.com/pub/mono/sources/mono/mono- wget http://ftp.novell.com/pub/mono/sources/xsp/xsp-2.4.2.tar.bz2 wget http://ftp.novell.com/pub/mono/sources/mod_mono/mod_mono-2.4.2.tar.bz2
tar -xvf libgdiplus-2.4.2.tar.bz2 tar -xvf mono- tar -xvf xsp-2.4.2.tar.bz2 tar -xvf mod_mono-2.4.2.tar.bz2
# compile libgdipluss cd libgdiplus-2.4.2 ./configure --prefix=/usr/local; make; make install sh -c "echo /usr/local/lib >> /etc/ld.so.conf" /sbin/ldconfig
# compile mono cd ../mono- ./configure --prefix=/usr/local; make; make install
# compile xsp cd ../xsp-2.4.2 ./configure --prefix=/usr/local; make; make install
# compile mod_mono cd ../mod_mono-2.4.2 ./configure --prefix=/usr/local; make; make install

You will still need to configure apache2, so use the rest of the instructions on this page: Install Mono 2.4 on Ubuntu

If you have any issues with the script, let me know in the comments.


Comments are closed

I am a software developer / architect currently interested in combining .NET technologies with open-source operating systems. 

I am a member of the open-source BlogEngine.NET development team and focus mainly on ensuring Mono compatibility for the project.



At StayUnlimited Cape Town accommodation we help you choose from and book guest houses, self catering apartments, bed & breakfasts, luxury villas and hotel accommodation.