Mono 2.8 Install Script for Ubuntu & Fedora

I updated both my scripts for Ubuntu and Fedora to download and install the latest 2.8 Mono release.  I’ve also been playing with GTK lately (specifically Pixbufs) and so this script now includes the install for GTK-Sharp. Anyway, you can find the updated scripts on my GitHub snippets project.  Both Fedora and Ubuntu install scripts should succesfully install mod_mono, Xsp, mono core, GTK, and GDIplus at a minimum.

If you have problems running your apps that use the gdi-plus, it could be resolved with a refresh of the DllMap.  Enter "sudo ldconfig"  and then try to re-run your app. Checkout for more details.

2/20/2011 Update

Mono 2.10 has been released. I added a new install script here. 

1/27/2011 update

Mono 2.8.2 was released awhile back, which included some security fixes and enhancements. I have since posted an updated script along another blog post related to it here. 

10/26/2010 update

The script now installs to /opt/mono-2.8 instead of /usr/local in favor of the parallel mono environment suggestion. You may need to add /opt/mono-2.8/bin to your system PATH.

For Ubuntu, this is located in /etc/environment; insert /opt/mono-2.8/bin to the beginning of the path. Keep in mind, this will change the global PATH, so if your'e using a workstation, this may affect other applications that depend on Mono. Consider changing your profile PATH. (See comments for more details). 

For RH/Fedora, I updated the install script to also create an environment script at: /etc/profile.d to include this mono install to your system path.

Disclaimer: You should only try this script if your'e familiar with the process of compiling packages manually. I'm trying to make it work for MonoDevelop and other files, but it may not work with them in its current state.

Feel free to fork and make changes of your own to the script from GitHub. I'll gladly welcome pull requests containing improvements.








After download:

chmod 755


If you have previously installed Mono from source, you may want to uninstall it before deleting its source. Run sudo make uninstall from each component directory you previously installed.


Just for kicks, here is a snapshot of the full Ubuntu script (Fedora is nearly identical with corresponding  yum package names).



export PATH=/opt/mono-2.8/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 libpango1.0-dev libatk1.0-dev libgtk2.0-dev libtiff4-dev libgif-dev libglade2-dev

mkdir -p $BUILDDIR

echo "downloading mono packages"



bunzip2 -df xsp-2.8.tar.bz2
tar -xvf xsp-2.8.tar

bunzip2 -df mod_mono-2.8.tar.bz2
tar -xvf mod_mono-2.8.tar

bunzip2 -df mono-2.8.tar.bz2
tar -xvf mono-2.8.tar

bunzip2 -df libgdiplus-2.8.tar.bz2
tar -xvf libgdiplus-2.8.tar

bunzip2 -df gtk-sharp-2.12.10.tar.bz2
tar -xvf gtk-sharp-2.12.10.tar

echo "building and installing mono packages"

cd libgdiplus-2.8
./configure --prefix=/opt/mono-2.8
sudo make install

cd mono-2.8
./configure --prefix=/opt/mono-2.8
sudo make install

cd gtk-sharp-2.12.10
./configure --prefix=/opt/mono-2.8
sudo make install

cd xsp-2.8
./configure --prefix=/opt/mono-2.8
sudo make install

cd mod_mono-2.8
./configure --prefix=/opt/mono-2.8
sudo make install

echo "done"


62 thoughts on “Mono 2.8 Install Script for Ubuntu & Fedora

  1. Forcing a compiled Mono as default version on a dedicated web server is OK, but personally I don’t like the idea of changing which Mono is used by default in a GNU/Linux workstation that may already have applications relying on Mono, like Ubuntu (F-Spot, Banshee, Tomboy).

    In the case of a GNU/Linux workstation used for developing ASP.NET applications in Monodevelop and setup with parallel mono environments, here is what I would recommend: create a script to launch Monodevelop, and change the environment variables in that script rather than globally in /etc/environment.

    First create a “launch_monodevelop” shell script in your ~/bin folder with the following content (I’m assuming your distribution automatically puts ~/bin in the path):

    export PATH=”/opt/mono-2.8/bin:$PATH”
    export MONO_GAC_PREFIX=”/opt/mono-2.8/:/usr”
    export XDG_DATA_DIRS=”/opt/mono-2.8/share:$XDG_DATA_DIRS”
    export LD_LIBRARY_PATH=”/opt/mono-2.8/lib:/usr/local/lib:/usr/lib”

    Then change the Monodevelop entry in the applications menu to point to “launch_monodevelop” rather than “monodevelop”. In GNOME, that can be done with “alacarte” (the GNOME Menu Editor), and in KDE, with “kmenuedit”. Both menu editors will create a local copy of the menu entry in ~/.local/share/applications that supercedes the global menu entry.

    The script above will set environment variables only for the Monodevelop instance, and other applications will use the standard Mono from the distribution. I confirm that the right mono server (the one in /opt/mono-2.8) is started by Monodevelop in debugging mode.

    Note that setting the LD_LIBRARY_PATH variable is necessary, else Monodevelop will not see some components like those for GNOME platform development and report an error. (It can be ignored because that component is not required to develop ASP.NET applications, but I don’t know what other parts Monodevelop would not see, so better safe than sorry.) Setting it globally in /etc/environment or even locally in ~/.profile does not work anyway, LD_LIBRARY_PATH does not get set. It’s meant for debugging a new library or using a nonstandard library, it’s not supposed to be permanent. See:

  2. @Mike
    Black magic… I recently moved from fedora 13 to a shiny 14 and found that switching libgdiplus might be tricky. As for now, I cannot make it work. Steps I described previosly have no power anymore as running ldconfig magicaly restores links to an old libgdiplus lib..

    Has anyone encountered such behaviour? I need help!! :)

  3. @SylvainC
    Thanks! You’re right. My primary intention for this was meant for standalone web servers, and it’s probably not a good idea to set the global path on a workstation. This has been a learning experience for me as well. I definitely welcome ideas for improving this install. You rock!

  4. @Mike
    It worked on Fedora 14 (new install from Live CD). When it was done, I rebooted for the environment update and all worked. Are all the binaries showing up in /opt/mono-2.8.1/bin?

  5. The parallel mono environment hasn’t crashed my system yet, which is great :)
    However when i try adding this new mono environ in monodevelop (Edit > Preferences > .Net Runtimes > Add) and I navigate to the path “/opt/mono-2.8/bin” it says “Mono runtime not found Please provide a valid directory prefix where mono is installed (for example, /usr)”… :(

  6. @Faizan

    Yeah, you know I had that same problem the other day. Try installing mono-tools from source. Then edit your MonoDevelop Preferences and see if it lets you add /opt/mono-2.8 to your runtimes.

    bunzip2 -df mono-tools-2.8.tar.bz2
    tar -xvf mono-tools-2.8.tar

    cd mono-tools-2.8
    ./configure --prefix=/opt/mono-2.8
    make install

  7. @Nathan
    Sorry for not answering so long. Anyway, I think that my fc14 installation is broken in a way. It was made from one of the first ISO’s and after clean install I found many problems with things that simply worked like a charm on fc13. So this is what I think is somehow connected with my ldconfig problems.. and yes, I did use 2.8.1 script which on fc13(that time it was 2.8) worked smoothly. Currently, I’m trying to make a procedure for building quick linux+mono+apache solution either on paper (and if it works maybe) or thrue scripting.

  8. hey man,
    Btw, why do u think distros like Fedora and Ubuntu neglect mono so much?
    yeah, they have it packaged, but it’s 2.6 for fuck sake !!, why do they hate mono like that, 2.8 was released long time ago, and it brings a lot of new stuff (like each release, mono team is really working hard) yet it will take them 10-20 years to fucking package it !
    I think mono is a GREAT way to develop cross-platform apps for linux/windows/mac,
    I have used it and it was simply amazing.

  9. @XV22

    I hear ya! I noticed they marked 2.6.7 as the LTS release for Mono, since seems to have been adopted across the board in packages. 2.6.7 works with MVC1, but like you said, there’s a ton of coolness in 2.8+ that would be nice to see packaged with the distros. I’m using MVC2 regularly with 2.8. I’m curious what the next few releases of both distros have in store.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>