Installing Mono 3.x in Ubuntu/Debian

I've recently read that Mono 3.0 has been released with a C# 5 compiler and support for MVC 4 here:

http://www.mono-project.com/Release_Notes_Mono_3.0

and

http://tirania.org/blog/archive/2012/Oct-22.html

For the life of me I cannot work out where to get it from as a package for Linux or even Windows.

This page seems to suggest it's still in Beta:

http://www.go-mono.com/mono-downloads/download.html

I've tried doing a apt-get install mono-complete on Ubuntu 12.10 but it's installed 2.10.8.1.

I've tried installing MonoDevelop 3 on my Windows machine and that's only presented me with MVC 3 projects and appears to be using the .NET framework.

I'm entirely new to Mono and I've Googled everything possible to try and see how this works but am baffled. I'd love to get this working on Linux if possible and try some stuff out.

Can someone shed some light on this or do I need to be looking at building this from source?


Here is the complete guide for installing mono 3.0.1

For Beginners who don't know how to get the new Mono 3.0.1 version on Ubuntu 12.04 (Because i'm a beginner and i've been working on this for 3 days before making it work)

Getting root access to install and configure Mono 3.0.1

sudo -s
***type your root password***

Install vim editor

apt-get install vim

Install apache2

apt-get install apache2

Install tools for compiling mono

apt-get install autoconf automake libtool g++ gettext libglib2.0-dev libpng12-dev libfontconfig1-dev
apt-get install mono-gmcs
apt-get install git

Install apache2-threaded-dev (needed for compiling mod_mono)*

apt-get install apache2-threaded-dev

We will return to apache2 configuration later

Making the structure we need for getting the source code

cd /opt
mkdir mono-3.0

Move into that new folder before getting the source code

cd /opt/mono-3.0

Getting the source code from GitHub

git clone git://github.com/mono/mono.git
git clone git://github.com/mono/xsp.git
git clone git://github.com/mono/libgdiplus.git
git clone git://github.com/mono/mod_mono.git

Compile libgdiplus

cd /opt/mono-3.0/libgdiplus
./autogen.sh --prefix=/usr  (the prefix is very important for Ubuntu 12.04)
make
make install

Compile mono

cd /opt/mono-3.0/mono/
make clean
./autogen.sh --prefix=/usr  (the prefix is very important for Ubuntu 12.04)
make
make install

Compile xsp

cd /opt/mono-3.0/xsp
./autogen.sh --prefix=/usr  (the prefix is very important for Ubuntu 12.04)
make
make install

Compile mod_mono

cd /opt/mono-3.0/mod_mono
./autogen.sh --prefix=/usr  (the prefix is very important for Ubuntu 12.04)
make
make install

After the installation of mod_mono, the file mod_mono.conf *as been added to your apache2 folder(/etc/apache2)*

Configuring apache2

Configure the default site of apache ### (optional*)**

vim /etc/apache2/sites-available/default
Modify the line "DocumentRoot /var/www" by "DocumentRoot /var/www/YourFolder" (YourFolder is the folder where you publishing your website!)

Configure the rights to YourFolder (optional*)**

cd /var/www/YourFolder
sudo chown -R root:www-data .
sudo chmod -R 774 .
sudo usermod -a -G www-data <yourusername>

Adding the mod_mono include in apache2.conf

vim /etc/apache2/apache2.conf
Add "Include /etc/apache2/mod_mono.conf" at the end of the file (without quotes!)

Adding the pointer to ASP .NET 4.0 in mod_mono.conf

vim /etc/apache2/mod_mono.conf
Add "MonoServerPath /usr/bin/mod-mono-server4" (without quotes!) under the "If Modules condition"

Restart the apache2 server /etc/init.d/apache2 restart


Mono 3.x is too bleeding edge for Ubuntu 12.10. Grab preview packages from directhex's PPA this way (this will install 3.2.1):

sudo add-apt-repository ppa:directhex/monoxide

(If you use Ubuntu saucy 13.10, after adding the repository you need to edit the file /etc/apt/sources.list.d/directhex-monoxide-saucy.list and replace the word saucy with raring)

Then, after that:

sudo apt-get update && sudo apt-get dist-upgrade

This will also get you MonoDevelop 4.x if you had monodevelop installed before.

NOTE: directhex is not some random guy that created a PPA, he's part of the Debian/Ubuntu maintainer team of all the Mono and Mono-based packages. So using this is the most official way to upgrade your infrastructure.


And for the debian users out there: mono 3.0.6 and MonoDevelop 4.0.x is already available in debian testing. So what I recommend to get this is:

  1. Install debian testing (currently named debian jessie).
  2. Uninstall mono by doing sudo apt-get purge mono-runtime (after doing this, resist the temptation to do an sudo apt-get autoremove or you will break your system, something which I reported as a bug here).
  3. Modify /etc/apt/sources.list, locate the first line that mentions the main source, and rename the word jessie to sid.
  4. Do sudo apt-get update.
  5. Install monodevelop via sudo apt-get install monodevelop, which will pull mono as a dependency too.
  6. Revert what you did in step 3.
  7. Do step 4 again.

This way you have a more or less modern distro (as opposed to debian stable), plus very very modern mono packages (the bleeding edge versions for Mono are normally pretty stable).

F# users: Mono 3.0.6 has a bug that prevents this language to work in this version, please use Mono 3.2.x instead.