Install Mono 2.10.8 from Source on Ubuntu with a Bash Script
NOTE: Badgerports.org is now current w/ 2.10.5. This bash script is more useful when installing parallel Mono, when a new version is released and not yet published on badgerports, or if you simply want to compile it yourself from source. I highly recommend trying Badgerports first.
I just updated the 2.10 script to use the latest 2.10.8 Mono install.
Install
mkdir mono-2.10 cd mono-2.10 wget --no-check-certificate https://github.com/nathanb/iws-snippets/raw/master/mono-install-scripts/ubuntu/install_mono-2.10.sh chmod 755 install_mono-2.10.sh ./install_mono-2.10.sh
Enjoy!


Hi,
thank you for this install script. Mono is now running correctly.
But please let me ask you a question. Is it possible to run more ASP.NET MVC projects with one public IP and no domain? Let say I have public IP 123.123.123.123 and one project would be accessable at 123.123.123.123/projectone and the second at 123.123.123.123/projectsecond.
Is it possible? If so, what should I do to make it running?
Thank you very much.
I ran the scripts on my kubuntu 11.04, but mono -V still reports that it is at version 2.6.7… how can I fix this?
Update: I figured out it installed correctly, but I need to type /opt/mono-2.10/bin/mono rather than just mono… is there a way to fix this? If not I can live with it as is
@Iceman That’s a good question. I think it’s more related to how Apache (if that’s your server) handles setting up virtual hosts / aliases. I personally use one IP for testing with many domains. Using virtual hosts by name, I can separate traffic into multiple Asp.NET runtimes (MVC applications) easily.
Checkout the ServerPath directive. (here’s an old example in 1.3 at the bottom) where they setup matching virtual hosts, but a server path would route traffic for a sub-directory in the quest and pass it to another virtual host.
@Domos123
That’s normal. My script doesn’t install to the default system path (so it doesn’t break any existing platform packaged apps).
Part of the Parallel Mono Environments suggestion is to setup an environment per app to use this. Here’s an example for a terminal session:
#!/bin/bash
MONO_PREFIX=/opt/mono-2.10
GNOME_PREFIX=/usr
export DYLD_LIBRARY_FALLBACK_PATH=/lib:
export LD_LIBRARY_PATH=/lib:/opt/mono-2.10/lib:
export C_INCLUDE_PATH=/include:/include
export ACLOCAL_PATH=/share/aclocal
export PKG_CONFIG_PATH=/lib/pkgconfig:/lib/pkgconfig
export PATH=/bin:/opt/mono-2.10/bin:$PATH
Also, you can see more in another post I did on setting up MVC3. It describes how to configure your virtual host to use this custom environment to run this version of Mono.
Using /opt/Mono-vvv allows you to run many versions of mono at the same time. That way when new versions come out, you can install them safely without breaking existing application dependencies. I’m installing to prefix /mono-2.10; but you could install to 2.10.4 if you wanted to be a little safer. This will also be non-intrusive to your platform-packaged version of mono so packaged dependencies don’t break.
Hope that helps!
@Domos123
I left a few things out. To use that bash script in a terminal, first save the script above to a file, “mono-env.sh” for example. Then in a terminal enter:
source mono-env.sh
This will load up the env for you. You can also rope that script into other scripts. The monoDevelop script I pushed out awhile back does this for the launcher so MonoDevelop can use this environment even when it’s not the platform-default.
If you want platform default; try out Fedora 15+
I hear that Ubuntu 11.10 will be packaged with 2.10.2, which will be a nice bump from 2.6.7.
@Nathan
Thanks for answer. I solved it by buying one domain. It’s not expensive, so it’s ok
But I have another question. I want to have always the newest version of Mono. But now, I have 2.10.3. Can I use the updated script to update Mono to version 2.10.4?
@Iceman
Nice, Glad you got it working! I sometimes setup test subdomains for sites too just to separate traffic.
Yeah, the upgrade script should work now the same between .2 to .3 and .3 to .4. The only changed packages are mono and gtk-sharp. This script should do it. Although, my disclaimer is that it appears the old gtk doesn’t remove, so try removing that by hand first. Download/run this script from the same location you ran the last one (so it can auto remove the old mono package). (worked on my machine).
Just in case… If it fails, just blast /opt/mono-2.10 and re-install using the full install script.
HI!
thanks for your script!
just one question: I cannot make monodevelop start using the version of mono installed with this script.
I’ve created the mono-env.sh script, but… where (and how) I should call it from monodevelop.sh?
@Nathan
The script didn’t work for update .3 to .4. This is the error message:
./upgrade_mono-2.10.2-2.10.4.sh: line 38: cd: /opt/mono-2.10/build/mono-2.10.2: No such file or directory
There’s no “mono-2.10.2″ directory, just “mono-2.10.3″. But I’ve deleted the “mono-2.10″ directory, run full install script and it’s working great with Mono 2.10.4.
Thanks
@Iceman That works!
@dg1974 The sample monodevelop.sh script I provided should have setup your environment already. One of my suggestions (if you want to build your projects from an interactive terminal), is to setup an environment script like that and then use
source yourscript.shto load it up.If you run the monodevelop.sh script, does it not work?
@Nathan
sorry, but where can i find the sample monodevelop script?
if i run the mono-env.sh i can run mono.exe correctly (version 2.10.4).
but if from that terminal I run monodevelop I receive a bunch of error (about missing mozilla references and so on).
so I think to edit the monodevelo.sh to use that mono-env.sh correctly but I don’t know how.
Here’s mine. Did you get any build errors for 2.10.4? Are you running Gnome3? (If so, I don’t think this MonoDevelop install works for Gnome 3 yet).
#!/bin/bash
MONO_PREFIX=/opt/mono-2.10
GNOME_PREFIX=/usr
UBUNTU_MENUPROXY=
export DYLD_LIBRARY_FALLBACK_PATH=/lib:
export LD_LIBRARY_PATH=/lib:/opt/mono-2.10/lib:
export C_INCLUDE_PATH=/include:/include
export ACLOCAL_PATH=/share/aclocal
export PKG_CONFIG_PATH=/lib/pkgconfig:/lib/pkgconfig
export PATH=/bin:/opt/mono-2.10/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
monodevelop
I get this error if I run the script posted before:
WARNING: Cannot find Mozilla directory containing libgtkembedmoz.so. Some Addins may not be able to function. Please set MOZILLA_FIVE_HOME to your Mozilla directory.
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly ‘Mono.Addins, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756′ or one of its dependencies.
File name: ‘Mono.Addins, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756′
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly ‘Mono.Addins, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756′ or one of its dependencies.
File name: ‘Mono.Addins, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756′
Missing method get_IsInitialized in assembly /usr/lib/monodevelop/bin/MonoDevelop.exe, type Mono.Addins.AddinManager
Monodevelop started from the menu works correctly (with default mono 2.6.7) and I can build and run mono app with 2.10.4 (installed with your script).
I’m using Ubuntu 11.04.
@dg1974 I recall this being a pain point for Ubuntu Natty. The mozilla dependency was upgraded in Natty and Addins (I believe) referenced the older version.
Nonetheless, try downloading source for Mono.Addins and compiling it. If you’re using the 2.10.4 script, I don’t think it’s included with that. It should be in the MonoDevelop script though, but I haven’t updated it in awhile so it may be lagging behind a version or two.
(while writing this, I realize 2.10.5 has been released; doh!). I’ll work on the next version and post it soon. I’ll also look at updating the MonoDevelop scripts for ubuntu and see how well it fares w/ the latest packages on Natty.
Nathan, what is the latest runtime version of Mono?
I mean the value in –runtime=v…
Thanks
P.
Hi @Petr,
It’s currently 2.10.5. You can always see the current here on their download page
Thanks for the install scripts! I’ve had much trouble installing MonoDevelop in the past. I’ve updated the script to install from 2.6.0.1 sources as opposed to 2.6 beta 1. Not sure whether can inline a diff properly in comments, but will try:
*** install_monodevelop-2.5.90.sh 2011-09-19 06:39:14.412491214 -0700
— install_monodevelop-2.6.0.1.sh 2011-09-19 06:55:34.252491254 -0700
***************
*** 28,36 ****
“mono-debugger-2.10″
“mono-tools-2.10″
“gnome-sharp-2.24.1″
! “monodevelop-2.5.90″
! “monodevelop-debugger-gdb-2.5.90″
! “monodevelop-database-2.5.90″
“gluezilla-2.6″
)
— 28,36 —-
“mono-debugger-2.10″
“mono-tools-2.10″
“gnome-sharp-2.24.1″
! “monodevelop-2.6.0.1″
! “monodevelop-debugger-gdb-2.6.0.1″
! “monodevelop-database-2.6.0.1″
“gluezilla-2.6″
)
***************
*** 38,46 ****
“http://ftp.novell.com/pub/mono/sources/mono-debugger/mono-debugger-2.10.tar.bz2″
“http://ftp.novell.com/pub/mono/sources/mono-tools/mono-tools-2.10.tar.bz2″
“http://ftp.novell.com/pub/mono/sources/gnome-sharp2/gnome-sharp-2.24.1.tar.bz2″
! “http://ftp.novell.com/pub/mono/sources/monodevelop/monodevelop-2.5.90.tar.bz2″
! “http://ftp.novell.com/pub/mono/sources/monodevelop-debugger-gdb/monodevelop-debugger-gdb-2.5.90.tar.bz2″
! “http://ftp.novell.com/pub/mono/sources/monodevelop-database/monodevelop-database-2.5.90.tar.bz2″
“http://ftp.novell.com/pub/mono/sources/gluezilla/gluezilla-2.6.tar.bz2″
)
— 38,46 —-
“http://ftp.novell.com/pub/mono/sources/mono-debugger/mono-debugger-2.10.tar.bz2″
“http://ftp.novell.com/pub/mono/sources/mono-tools/mono-tools-2.10.tar.bz2″
“http://ftp.novell.com/pub/mono/sources/gnome-sharp2/gnome-sharp-2.24.1.tar.bz2″
! “http://download.mono-project.com/sources/monodevelop/monodevelop-2.6.0.1.tar.bz2″
! “http://download.mono-project.com/sources/monodevelop-debugger-gdb/monodevelop-debugger-gdb-2.6.0.1.tar.bz2″
! “http://download.mono-project.com/sources/monodevelop-database/monodevelop-database-2.6.0.1.tar.bz2″
“http://ftp.novell.com/pub/mono/sources/gluezilla/gluezilla-2.6.tar.bz2″
)
@Jonathan Shore
Thanks man! You guys rock! Someone else also just posted a pull request on github recently with these updates. Go take a look at the new scripts and let me know what you think. I merged them in but haven’t tested them myself yet. Go take a look!
The best way to contribute is to fork my repository in github, make your changes and submit a pull request. You get your name attached to the code, and we all benefit from the updates more frequently. Everyone wins!
Hi Nathan,
do you have heard from somebody using mono (2.10.x) on a RHEL 6.x installation?
(do you think this may be possible using your “adapted” installation scripts?)
Thanks Jon Duri
@Jon
Anything is possible. I would fire up a virtual with VirtualBox or whatever VM you like and try it. Use the Fedora version from GitHub (which is updated, but I haven’t posted here about it).
Most-likely if you have any problems, it’ll be related to the dependencies. So if anything is too old for the system, you may be able to download those dependencies and install them manually too. If you get it working, post back here and let me know. I’m curious.
Hi Nathan,
the script executed perfectly on a rhel 6.x os. We shall check function in the next days.
thanks and regards Jon Duri
Gracias por este gran manual, me sirvió de mucho!
@ Domos123, mira para crear un enlace simbólico tienes que usar el comando LN, yo te lo dejo aqui y tu lo editas si has cambiado los parámetros:
ln -s -f /opt/mono-2.10/bin/mono /usr/bin/mono
Esto hará que cuando escribas ‘mono’ en la consola te funcione, para mirar si todo esta bien despues de ejecutar el comando escribe; mono -V, y te irá, gracias.
Gracias @Jordi Hoock Castro, eres bienvenido!
The install instructions worked fine on ubuntu natty (11.04) up to the last command. On entering this, several 404 errors were generated and mono was not updated (checked using mono -V ). If any more information is required to resolve this then please let me know. The errors produced were as follows.
W: Failed to fetch http://ppa.launchpad.net/aleseftimie/ppa/ubuntu/dists/natty/main/source/Sources 404 Not Found
W: Failed to fetch http://ppa.launchpad.net/aleseftimie/ppa/ubuntu/dists/natty/main/binary-i386/Packages 404 Not Found
W: Failed to fetch http://ppa.launchpad.net/team-xbmc/ppa/ubuntu/dists/natty/main/source/Sources 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
Hi @Chris
The install probably did go through, but you have to configure your runtime environment to use them. These scripts use the recommendation for parallel Mono environments so it doesn’t affect your platform packaged versions. Peek at this comment
I’m not familiar with those PPA’s and they’re not a part of my install script. Could they be a part of another installation? XBMC? The 404′s are likely caused by something else.
Just wonderfull.
First try, all running perfectly.
Thx a lot. You save me lots of time.
@zoomi You bet! Glad it worked!
So that you know, your mono script runs correctly in ubuntu 11.10, but your monodevelop script involves installing the xulrunner-1.9.2-dev package, which isn’t yet available in 11.10. Reference: https://launchpad.net/ubuntu/oneiric/+source/xulrunner-1.9.2/
@John
Apologies. I haven’t actually updated the MonoDevelop script for quite awhile. (beta 2 or 3 I believe). I had to hard wire the xul-runner for pre 11.04 ubuntu to work. I will definitely update it at some point.
@Nathan
No need to apologize. Just wanted to let you know. You can either hard wire your script for 11.04 like you suggest… or just wait for 11.10′s package, although I don’t know how long it might be until it’s available.
Should you update the script to use the 11.04 repo, I would download it today and use it. =)
Hello,
How do you ‘uninstall’ the changes made by the script ?
TIA, Oscar
Hi @Oscar,
Sorry for the delay on this. This script will do a few things. First: delete /opt/mono-2.10 (default prefix), which is where all the mono files will be installed to. Second, you can “reverse” the apt-get install by doing: “apt-get remove
“. (That’s kind of a guess, but if you’re starting with a fresh machine and you’re wanting to roll back all the dependency installed added by the script). You may have to follow that up with “apt-get autoremove” to clean up.
That should be it. I think the major piece is the mono install itself which is super easy to clean up since the script prefixes that to a custom directory.
Hope that helps!