Mono 2.10 Install Script for Ubuntu & Fedora
Update 10/4/2011 – I’m starting to consolidate the major version posts. This script refers to 2.10.1; however, it installs 2.10 latest. Refer to the current 2.10 post for more info.
I just updated the bash install script for Mono 2.10. Thanks to @Marv for the Ubuntu script and heads up that 2.10 was released. This script is mainly intended for use with linux/apache web servers. It will install Mono, GTK, OpenGDI, XSP, and Mod_Mono. For Mono Develop, read through the Building Mono Develop page [mono-project.com], which will require a few additional packages not included in this script.
To install for Ubuntu:
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
To install for Fedora:
yum install wget wget --no-check-certificate https://github.com/nathanb/iws-snippets/raw/master/mono-install-scripts/fedora/install_mono-2.10.sh chmod 755 install_mono-2.10.sh ./install_mono-2.10.sh
Again, if setting up a web server, be sure to set the VirtualHost environment up correctly with PATH & LD_LIBRARY_PATH. (here, IOMAP is optional) See configuring virtual hosts. The following line should be included in your VirtualHost configuration.
MonoSetEnv site_name MONO_IOMAP=all;PATH=/opt/mono-2.10/bin:$PATH;LD_LIBRARY_PATH=/opt/mono-2.10/lib:$LD_LIBRARY_PATH;
Update – March 15, 2011
I’m refactoring some stuff, so bare with me. Today I’m introducing a totally re-written script that will hopefully make it easier to adapt to updates in the future. So far, I’ve treated these bash scripts like I do Windows batch files. But I took some time and tried to learn a little more about writing bash scripts. The new scripts will stop if any errors are encountered. This is good and bad. Good because now you know something went wrong, and the errors are much easier to find. Bad (maybe) because now you know something might not have worked.
Anyway, I hope the changes will help everyone.
I’ve changed all the prefixes to use the major/minor version. So 2.10.1, 2.10.2 etc, will use prefix /opt/mono-2.10. You’ll always have the option to change that if you wish to use a different prefix. There’s a single variable in the beginning of the script that sets the prefix.
Finally, there does seem to be a problem at the end of installing xsp. However, everything seems to go in okay.
Good luck!
UPDATE – March 8, 2011
Mono 2.10.1 was released Feb 25th. I updated the install script for 2.10 to use the Mono 2.10.1 package. (That was the only package updated in this version). I’ve also included an experimental upgrade script for 2.10 to 2.10.1 here. (fedora vs ubuntu use the same script). Download it to the same location of your script for 2.10 and run it. It will uninstall just mono-2.10 and then download, compile, and re-install the new mono-2.10.1.
Enjoy!


Thanks for this!
You bet!
I tired using the ubuntu script in Linux MInt Debian (am desperate to use 2.10) and it seems to have worked for the most part. But when I try to make monodevelop work with it, it wants a prefix. I’m not sure what that is exactly, but I pointed it to my /opt install dircetory, and all of a sudden all the references from an imported Visual Studio solution turned from red to black, apart from one. But the default solution builds and seems to run just right, which is good.
However, Monodevelop still claims to be using mono 2.6.7 and it seems pretty random if 2.10 works at all or not. Also when running 2.10 I all of a sudden do not have the option to right click and add a view. (partial view with a data class is one of the things I was hoping to accomplish with the upgrade)
If you have any idea how I could make this work, or the time to do a Debian testing script, I would be really grateful. I really need this to work and this has not hit the Debian repos yet, couldn’t even find it in experimental.
It should be noted though that when I ran the script I got a lot of warnings, but it built none the less:-)
bw,
Hrafnkell
I got the script to work, but I had to change all the “http” protocols to “ftp” in the Novell URLs.
@Dylan Taylor
That’s interesting. The urls over HTTP work fine for me (I just re-tested them). I’ll keep an eye on it though. Thanks for the heads up. Glad you got it working!
@Hrafnkell
Yeah unfortunately I don’t think Ubuntu maintains packages for Mono. There is a backport that works quite well though. Checkout http://badgerports.org/ They have MonoDevelop 2.4 out there, which seems to recognize multiple mono runtimes on the system.
To be honest, I haven’t seen it for awhile, but I’m pretty sure there’s a Preferences setting where you can enter the mono prefix for 2.10 so MonoDevelop knows about it. (This would allow MD to compile your projects with 2.10). MonoDevelop itself would still run under the platform default which is likely 2.4 or 2.6.7, which is okay.
The prefix for this install is /opt/mono-2.10
Hope that helps a little.
The mod_mono configure/make/install step tries to `cd` to the 2.8 directory instead of the 2.10 directory, but it doesn’t exist.
Also, I updated the script to use mono-2.10.1.tar.bz2 locally and it seems to work fine.
@Michael Greene
That’s odd. You may need to re-download the script. I think that was one of the things I fixed right after initially posting it. The current version shows cd mod_mono-2.10 for both scripts. Let me know if you still see the old one in there. Thanks!
I just used this script as the basis to install mono 2.10 on my Fedora 14 machines and figured I’d give some feedback.
First off, thanks for this! I have not build mono from scratch before, so this was a tremendous help.
1) In your yum dependency install command you have “gettext lib” which you might have meant as “gettext-libs”.
2) For libgdiplus, I also installed libexif-devel, libexif, and libjpeg-devel. I still might have some problems with libungif — we’ll see.
I only installed libgdiplus, mono, and gtk-sharp, but this was enough for me to then install F# by following some steps here: http://chrismarinos.com/f-on-ubuntu-linux-with-mono-and-monodevelop/
Basically:
git clone git://github.com/fsharp/fsharp
cd fsharp
autoreconf
./configure –prefix=/opt/mono
make
su -m
make install
@tbogdala
You rock man! I’ll take a look and fix/add those dependencies you mentioned. I don’t test the fedora script quite as thoroughly as I do the Ubuntu version. I’m glad to see some feedback on it. Thanks!
That’s good info on the f-sharp and installing MonoDevelop. Thanks for sharing.
I’m actually new to Fedora, having worked mostly with Ubuntu and Arch in the recent past, so I may have missed a few things.
Cheers.
Fwiw, I thought I’d share that for Fedora 14 users who are just looking to install mono 2.10
$ su
# mono
(you should get a prompt to install it Y/N)
cheers!
I am new to Linux and just moved from windows. I installed mono 2.10 by running your script .Now I want to uninstall it . I tried removing folders but it seems it spread all over the place. Please help me uninstall it .
Fedora is what I am using.
@axcdss1
If you still have the original source code downloaded by the script (should’ve been in the build folder it created in the same directory as the script), you can go into each directory and do a
make uninstall(as su or root) to uninstall each package. There’s only five so it’s not too bad.If you don’t have the original build folder, then you should be able to just delete the directory
/opt/mono-2.10. All compiled files should have been installed to there and not your default system folders. The script shouldn’t have modified any of your environment settings, but you can double check that your path does not include that directory anymore. Some of the older fedora scripts created a file here: /etc/profile.d/mono-path.sh. You can delete that file if it exists.Good luck
Awesome, been meaning to try a few C# apps I’ve made via mono on ubuntu server–would have never gotten around to it without this!!
@jay
Great! Glad to hear it! You should checkout MoMA too. It does a quick scan of your assemblies and tells you where (if any) problems you might have.
FYI, I’m working on cleaning up these scripts. When I wrote the first one, I didn’t know much about bash scripting. I’ve been researching it over the past few days and I should be able to clean these things up quite a bit. Stay tuned! (You can find my current work in progress scripts in the “experimental” branch on github.com; although they’re not guaranteed to work yet).
Great Work Nathan. Probably you should try coming up with MonoDevelop installation script as well. It will be great help again for your Blog followers.
Cheers !
@axcdss1
Yeah, MonoDevelop is on the list. That’s actually what got me started thinking about cleaning these up. They’re in the experimental branch for ubuntu if you want to peek at them, but they’re still broke at the moment. I’ll update the fedora ones when I iron them out.
Nathan,
Let me add my thanks for this script. I’m about to set up an MVC 3 app and see if I can make it work, now that I have 2.10 on my system.
I have a question about building. If both my development machine and production web server are 64-bit, should I be able to tar up the /opt/mono-2.10 directory and send it up, or will I need to do the whole build script on the server?
@Daniel
Thanks! I want to say yes you can. I haven’t tried it myself, but I’ve often thought about it considering the amount of time it takes to build. By doing that, you will likely save having to install all the development libraries on your server; you can apt-get install just the runtime versions. You can probably go through the dependency list in the script and remove anything that has dev or devel on it.
Let me know if that works!
Thanks – I will.
Hello Nathan,
please, how to install monodevelop 2.5.90 or 2.6. on Ubuntu?
Thanks in forward for advice.
Petr Hejl
@Petr
I’ll look into that. I just saw the beta release when you mentioned it. For the time being, I’ve just tested (only on one machine so far) a new script that will compile/install MonoDevelop 2.4 on ubuntu from scratch. It’s quite the beast, but anyone is welcome to try it out. I’ll post a blog soon describing how it works.
Ubuntu:
install_monodevelop-2.4.2.sh
Fedora:
install_monodevelop-2.4.2.sh
@Nathan
Here you go! I hope it works for ya (and everyone else).
Install MonoDevelop 2.6 Beta & 2.4 on Ubuntu and Fedora
I used your script and I was running into a bug that caused me several days of headache. I finally found that the problem was with the mono installation. Please fix this so that others won’t run into similar problems.
The bug:
LD_LIBRARY_PATH is not updated to include /opt/mono-2.10/lib/ so mono programs somtimes crash in the middle of exeuction when they need to access something in that directory.
Thanks,
Emil
@Emil
The script doesn’t modify the default LD_LIBRARY_PATH on purpose. This is so it doesn’t interfere with anything that’s platform default. You’ll need to setup a script that initializes environment variables (for desktop) or configure your web application to use the updated environment in the virtual host config. The original idea was to be as non-invasive as possible. You can change the prefix yourself if you prefer to install using the default paths (/usr) or you can configure the file /etc/environment system default settings also.
I setup a script to run a custom monodevelop. and you can add these lines to the beginning of it to setup the environment and it should work just fine.
#!/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:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
#Run any app here. In this case, it's monodevelop
monodevelop
Nathan – I just did a zip/scp/unzip on the /opt/mono-2.10 directory up to my server, and it worked like a charm. (Using half a GB of RAM with all the stuff it’s running, but still… LOL) I didn’t even have to get any dependencies. Of course, it’s been up a grand total of about 30 minutes, but the things I’ve tried to do seem to be working.
Thanks again for your helpful script!
@Daniel
Awesome! Nice job. Yeah, I will be doing that for my deployments. Takes forever to build sometimes. Yeah and if you need any new dependencies, you can probably just copy/paste the apt-get install line in the beginning of the install script and do it all in one shot.
Thanks
I’ve an error when compiling xsp
I get this after configure:
Runtime: /opt/mono-2.10/bin/mono
C# 2.0 compiler: no
C# 4.0 compiler: no
And this after make install:
make[2]: [2.0/Mono.WebServer2.dll] Error 1 (ignored)
no -d:NET_2_0 -debug+ -debug:full -nologo -nowarn:618 -unsafe -r:System.Web.dll -r:System.Configuration.dll -r:Mono.Security.dll /target:library /out:2.0/Mono.WebServer2.dll ./ApplicationServer.cs ./BaseApplicationHost.cs ./BaseRequestBroker.cs ./IApplicationHost.cs ./InitialWorkerRequest.cs ./WebSource.cs ./Worker.cs ./LingeringNetworkStream.cs ./MonoWorkerRequest.cs ./HttpErrors.cs ./Paths.cs ./VPathToHost.cs ./WebTrace.cs ./SearchPattern.cs ./ReaderWriterLockSlim.cs ./LockRecursionException.cs ./LockRecursionPolicy.cs ./UnregisterRequestEventArgs.cs ./IRequestBroker.cs ./RequestData.cs ./RequestLineException.cs ./MapPathEventArgs.cs ./MapPathEventHandler.cs ./EndOfRequestHandler.cs ./UnregisterRequestEventHandler.cs ./../Mono.WebServer.XSP/XSPApplicationHost.cs ./../Mono.WebServer.XSP/XSPWorkerRequest.cs ./../Mono.WebServer.XSP/XSPRequestBroker.cs ./../Mono.WebServer.XSP/XSPWebSource.cs ./../Mono.WebServer.XSP/XSPWorker.cs ./../Mono.WebServer.XSP/SslInformation.cs ../../src/Mono.WebServer/AssemblyInfo2.cs
/bin/bash: no: command not found
make[2]: *** [2.0/Mono.WebServer2.dll] Ошибка 127
make[2]: Leaving directory `/home/shift/mono-2.10/build/xsp-2.10/src/Mono.WebServer’
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/shift/mono-2.10/build/xsp-2.10/src’
make: *** [install-recursive] Error 1
I can’t understand why compilers didn’t found
Hi guys I am just new to Mono Development and also new to Linux Environment..
But first of all I would like to say Thank you to Nathan for providing this Linux Script..
Hmmmm.. but it seems there is a syntax error at Line 27
because after running the script I received a message
” install_mono-2.10.sh: 27: Syntax error: “(” unexpected ” but after checking it..
It seems alright.. does anyone also receiving this message?
And I think I fail to install the Mono 2.10..
after running the script and typing “mono -V” it gives 2.6.7 version..
Hi guys.. ignore may problem.. I already got the solution..
I am running the script by using “sh install_mono-2.10.sh” which is wrong..
I thought it is the same with “./install_mono-2.10.sh”
Thanks again..
Great! Glad you got it. Yeah sometimes if the github link breaks, wget will download the HTTP response into a file and cause the script not to work (obviously right)? But yeah the
shthing will break too.Gracias.
@Luis
Denada
@Andrey
Hi Andrey did you solve your problem? I’m having the same problem
Thanks,
-C
@Cristian
Is this what your’e referring to? If you’re seeing this, there are a couple possibilities.
Try the newer script out and see if you have better luck. ubuntu mono install script on github
Here’s a more recent post on using the newer script. Installing Mono 2.10 and MonoDevelop
Hope that helps!
@Nathan
Hi Nathan,
Thank you for you help.
I’m using fedora 14. After running your scripts I get the following messages:
Making install in docs
make[1]: Entering directory `/home/ceibanez/mono-2.10/build/xsp-2.10/docs’
Making install in Mono.WebServer
make[2]: Entering directory `/home/ceibanez/mono-2.10/build/xsp-2.10/docs/Mono.WebServer’
make[3]: Entering directory `/home/ceibanez/mono-2.10/build/xsp-2.10/docs/Mono.WebServer’
make[3]: Nothing to be done for `install-exec-am’.
/bin/sh /home/ceibanez/mono-2.10/build/xsp-2.10/install-sh -d
/usr/bin/install -c -m 644 Mono.WebServer.zip Mono.WebServer.tree Mono.WebServer.source
/usr/bin/install: target `Mono.WebServer.source’ is not a directory
make[3]: *** [install-data-local] Error 1
make[3]: Leaving directory `/home/ceibanez/mono-2.10/build/xsp-2.10/docs/Mono.WebServer’
make[2]: *** [install-am] Error 2
make[2]: Leaving directory `/home/ceibanez/mono-2.10/build/xsp-2.10/docs/Mono.WebServer’
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/ceibanez/mono-2.10/build/xsp-2.10/docs’
make: *** [install-recursive] Error 1
Are those just Documentation? I think I can live without them if that’s the only thing that didn’t install.
when I do “/opt/mono-2.10/bin/mono -V” I get this:
Mono JIT compiler version 2.10.1 (tarball Mon Apr 4 17:36:35 EDT 2011)
Copyright (C) 2002-2011 Novell, Inc and Contributors. http://www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: x86
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: Included Boehm (with typed GC and Parallel Mark)
Hi.
Is this working with ubuntu 11.04?
I cant get the script to work. When I try to run it, after I have downloaded it and chmodded it, it will not run with either sudo ./install_mono-2.10.sh or just ./install_mono-2.10.sh
I get an error saying:./install_mono-2.10.sh: 1: Syntax error: newline unexpected
Hope that you can help me out
After yesterday, this script will install 2.10.2. See the updated post
Hi Nathan. I am VERY new to this mono stuff and am trying to set up mono on ubuntu (i am new to linux as well). The purpose is to be able to run asp.net websites on the linux serv using xsp.I downloaded your script but i have a problem in that i log in to the server with putty but the server does not have an outgoing internet connection (it needs a login etc etc). So the script gets stuck when it tries to ‘wget’ the packages. I have downloaded the packages and sftp’d them to the server. Is there a way to modify the script to use the packages that i put on the machine?
Thanks for your help!
@Saifudin
You’re right to assume the mono packages themselves can be pre-downloaded and placed in the build directory. However, you’re going to have a problem before that, because you’ll need to install all of the extra dependencies required to build Mono. And for that, the script uses apt-get which requires an Internet connection.
If you peek at the script, you’ll see the “apt-get install” line that contains all the packages you need to be able to compile Mono. Somehow you have to get those packages installed before this script will work. If you have that, then create a “build” directory where you placed the install script and move all the pre-downloaded mono tarballs into there.
Since you’re new, you should consider creating a local virtual machine with VirtualBox in Windows, and practice installing and setting up linux from there. If the server you’re referring to is hosted, create a virtual machine that matches its version and practice with that. Virtual Machines are highly disposable and good for practice. VirtualBox even has “save points” where you can try something and roll it back if it doesn’t work. Saves time re-installing linux all the time.
Also to get comfortable with Mono itself, install the Windows version with XSP. It’s great for testing your applications out before going through the trouble of setting up a linux server and all of that.
One final thing. You may consider other distributions for your environment. Fedora 15 is packaged with the latest Mono. OpenSUSE is the defacto standard for Mono and can very easily have the latest Mono installed w/ tools. Also, for Ubuntu, if you were able to gain Internet access and root privileges, you could setup http://badgerports.org for installing mono. They precompile and package it up for you so it installs very cleanly into ubuntu.
Good luck! I hope that helps!
Thanks for your prompt reply! The server is connected to the LAN which has a leg server so the apt-get command installed all the required dependencies already. The part of the script that i need to “bypass” is the wget commands where it tries to download the mono tarballs even though they’re in the same directory as the bash script. What should i do?
Hi again. I managed to install mono 2.10 manually by referring to your script. if i type mono -V it shows up correctly as 2.10.2. The problem i have now is trying to run asp.net websites. i copid my site to /var/www/test but when i try and tun them i get an Http 400 error “The section can’t be defined..” etc. also on the page it shows “Version information: Runtime: Mono 2.4.4; ASP.NET Version: 2.0.50727.1433″. Should this not show Mono 2.10.2 and ASP.NET 4.0? What other configuring do i need to do? (On a side note this seems to be an issue with the Web.config file as simple single .aspx pages load correctly.)
Thanks again.
@Saifudin You’re almost there! Now it sounds like you just need to configure your web server. /var/www/* is the default configuration for apache. Here’s what I would do:
Assuming you run the script and it installed xsp, mod_mono, etc, then you should be able to setup a custom virtual host configuration for you website. I walk through this in a couple blog posts: First & Second). A virtual host is very similar to a “web site” node in IIS or a Virtual Directory w/ its own application pool. In this case, you’re going to configure your virtual host to use your custom Mono install (noted more clearly in the second post I mentioned).
Here’s some info I wrote about using Apache as a reverse proxy. You don’t need to use it for that, but it talks a little bit about using virtual hosts in general. You can separate traffic with host names, ips, ports, etc using this. Understanding that will help you setup your web server. You can also of course go check their docs out.
Hope that helps
Thank you for this!
Hi Nathan,
I’m very impressed with your work! It’s great that guys like you gives the rest of us some help in setting up the difficult stuff. I have a question, though – I have a Ubuntu 11.04 server running 64bit – and my plan is to develop my ASP.NET 4.0 website on a Windows XP running Visual Studio 2010, and publish the website to the Linux. Would this be a problem – i mean, developing on 32bit and publishing to a 64bit environment?
Do you know of any issues, that I should be aware of? I have developped a bit in ASP.NET on Windows-platform, and know my way around Linux, but am fairly new to apache and very new to Mono.
thx again
Lux550Freak
@filip You bet!
@Lux550Freak Thanks very much! That means a lot.
No, you shouldn’t have any problems with the platforms. I build my stuff in visual studio 2010, .net 4 and have no problems deploying to mono. As always, you will have to test it on Mono to make sure all the API calls you’re making are available. (refer to tools like MoMA for quick evaluations of your application). Also keep in mind platform independent practices like case sensitivity and not hard coding file system paths for example. The System.IO.Path utility is invaluable for these things.
Also more specifically to your cpu architecture question. If you want the .net runtime to use the native environment, be sure to compile as “AnyCPU”. You can force it either way, but when you use AnyCPU, it’s my understanding the runtime environment will try to use native first and then fall back to 32bit . It should behave the same in Mono. That will allow you to build an assembly on a 32 bit machine that can still run as 64bit on a 64bit machine.
Naturally though, if you’re platform invoking any unmanaged code, you will have to match the native library runtime. In other words, if your C++ lib is 32bit, you have to force 32bit .net and vice versa for 64bit. This is identical to the behavior in Windows. (Notice SQLite for .NET will behave this way). With this Mono install script you’ll only compile the native version of Mono.
Keep a close eye on .NET 4 projects in Visual Studio 2010. I’ve notice on mine for some reason new projects always default to x86 and the Silverlight subset framework of .NET 4. You have to first change it to full .NET 4 and then switch it to AnyCPU. It could be just my environment though.
Hope that helps! Thanks again!