59

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?

knocte
  • 16,941
  • 11
  • 79
  • 125
oasten
  • 864
  • 1
  • 7
  • 10

7 Answers7

107

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

ohvitorino
  • 186
  • 1
  • 15
Dominique Goudreault
  • 1,079
  • 2
  • 6
  • 2
  • 7
    wow, if you spend so much time writing a SO answer to help people install software from sources, I guess you would be much motivated by actually contributing to generate deb/rpm packages ;) the latter scales – knocte Nov 17 '12 at 13:39
  • This is great stuff. I'll come back to this I'm sure but I wanted to get up and running as quickly as possible and the packages on Meebey.net did that. – oasten Nov 17 '12 at 13:40
  • 3
    the Meebey.net repository is only working for those who has Ubuntu 12.04 x64. I had x86 installed, so it wasn't working at all. This guide is for x86. Maybe it work for x64, i don't have time to test it :) – Dominique Goudreault Nov 17 '12 at 15:29
  • I'll give it a go when I've got some free time and report back. – oasten Nov 17 '12 at 16:04
  • Domonique, you didn't understand my point: if meebey's packages don't work for x86, why don't you spend time fixing them so lots of people can use them, instead of spending time explaining people how to build from sources? the latter doesn't scale ;) – knocte Nov 18 '12 at 00:37
  • 6
    Note that on a fresh install, you'll need to install make and libx11 too : `apt-get install make` and `apt-get install libx11-dev` – Drewman Jan 31 '13 at 09:39
  • 3
    You may also wish to install libexif, libjpeg, libgif, libpng, libtiff before building libgdiplus `apt-get install libexif-dev libjpeg-dev libpng-dev libtiff-def` – scotru Mar 18 '13 at 06:49
  • 1
    on a fresh install of 13.04 I also needed to install fontconfig and freetype (libfreetype6-dev, libfontconfig1-dev) before configuration of libgdiplus succeeded. – David V May 01 '13 at 20:25
  • note also on my fresh 13.04 system I had to add -lglib-2.0 and -lX11 to the LIBS var in the test/Makefile before the tests compiled. Yes I know there is a way to do this more generically... – David V May 01 '13 at 21:03
  • I am unable to build libgdiplus on Ubuntu 13.04 x86. It says `/usr/bin/ld: testgdi.o: undefined reference to symbol 'g_print'` – Denis The Menace May 25 '13 at 21:53
  • I think git is packaged in the git-core package on debian and ubuntu. – sp3ctum Aug 13 '13 at 05:42
  • I have come across a useful link in compiling mono from source: http://www.bgsoftfactory.net/run-asp-net-mvc-4-with-mysql-on-linux/ – Gabriel Chung Jan 28 '14 at 11:00
  • 1
    Doesn't work. Anyone ever seen a guide that does? It's been a while since I did this from scratch. – Chazt3n Feb 03 '14 at 23:30
  • I've got this working. However, MySQL not starts up with `$ sudo service mysql.server start Starting MySQL * Couldn't find MySQL server (/usr/bin/mysqld_safe)` – roydukkey Apr 03 '14 at 18:03
  • And cloning vb.net as well: git clone git://github.com/mono/mono-basic.git – Stefan Steiger Apr 17 '14 at 17:02
47

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.

knocte
  • 16,941
  • 11
  • 79
  • 125
  • 1
    I'm going to give this a try in a bit. It does require 64bit Ubuntu though which I hadn't installed. – oasten Nov 17 '12 at 10:56
  • Thanks, this was just what I wanted. Got me going quickly. – oasten Nov 17 '12 at 13:38
  • 1
    looks like this isn't maintained anymore so I don't think it's a valid answer now. looks like it used to work though – Martin Jul 03 '13 at 21:51
  • that's interesting, on a base 13.04 server install mod_mono isn't working and I'm getting lots of errors. I'll have to give it another go. – Martin Jul 06 '13 at 12:12
  • mod_mono is a whole different beast I think, take in account that, for instance, the xsp code comes from a different tarball than mono: http://github.com/mono/xsp – knocte Jul 06 '13 at 12:16
  • anyway if you're installing in a server I recommend you debian, not ubuntu – knocte Jul 06 '13 at 12:17
  • i got this error at the end: generating monodoc search index... grep: /etc/gre.d/*.conf: No such file or directory Unhandled Exception: System.TypeLoadException: Could not load type 'Monodoc.EditMerger' from assembly 'monodoc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756'. [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type 'Monodoc.EditMerger' from assembly 'monodoc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756'. root@server:~# But "mono -V" shows Mono JIT compiler version 3.2.1 – robnardo Feb 23 '14 at 03:25
8

I've got installing mono 3.x from source down to a few steps on Ubuntu Raring:

1: Get the dependencies, all in one hit:

sudo apt-get install build-essential autoconf automake \
bison flex gtk-sharp2-gapi boo gdb valac libfontconfig1-dev \
libcairo2-dev libpango1.0-dev libfreetype6-dev libexif-dev \
libtiff4-dev libgif-dev zlib1g-dev libatk1.0-dev libjpeg8-dev \
libjpeg-turbo8-dev libglib2.0-dev libgtk2.0-dev libglade2-dev \
libart-2.0-dev libgnomevfs2-dev libgnome-desktop-dev \
libgnome2-dev libgnomecanvas2-dev libgnomeui-dev libgnomeprint2.2-dev \
libgnomeprintui2.2-dev libpanel-applet-4-dev \
libnautilus-extension-dev librsvg2-dev libgtkhtml3.14-dev \
libgtksourceview2.0-dev libgtksourceview2.0-dev libvte-dev \
libwnck-dev libnspr4-dev libnss3-dev libwebkit-dev libvala-0.18-dev

2: Create a folder somewhere to hold the source:

sudo mkdir /opt/mono-3

3: Clone into the folder with git

cd /opt/mono-3
sudo git clone git://github.com/mono/mono.git
cd  mono
sudo git checkout mono-3.0.12

4: Build & Install

sudo ./autogen.sh --prefix=/usr/local
sudo make
sudo make install

That's it!

To get the latest changes in System.Drawing.dll and System.Windows.Forms.dll you also need configure, build and install libgdiplus.

 cd libgdiplus
 ./autogen.sh --prefix=/usr/local
 make
 make install
Michał Powaga
  • 22,561
  • 8
  • 51
  • 62
Rolf S
  • 129
  • 2
  • 7
4

apt-get install installs whichever version of Mono your distribution ships with, which seems to be 2.10.8.1. Your distribution may or may not have newer Mono packages, you may have to select some newer update channel in your distribution's package manager. Since you did not mention which Linux distribution (and which version of it) you're using, this is impossible to answer.

apt-get suggests that it's something Debian/Ubuntu-based, but there are many different versions. I'm a Mac person, so I just don't know.

See http://www.mono-project.com/Compiling_Mono for instructions on how to compile from source.

However, this question really belongs on superuser.com, you'll get better answers if you ask it there.

Martin Baulig
  • 3,010
  • 1
  • 17
  • 22
  • I've updated the question to say I'm using Ubuntu 12.10. Is this really a sysadmin sort of question? I'm a developer first and foremost. – oasten Nov 13 '12 at 19:01
  • It seems like they're shipping 2.10.8.1. No idea whether they'll make 3.0 packages anytime soon or not. Distributions may not immediately update because too many dependencies would have to be updated as well. – Martin Baulig Nov 13 '12 at 19:41
  • 3
    Well, compiling Mono from source is not too hard and you can always just build and install your own version independent from what your distro ships with. Then you also don't have to worry about breaking some applications that are using Mono due to missing dependencies. – Martin Baulig Nov 13 '12 at 19:45
  • Okay. Looks like I need to give this a go tomorrow! – oasten Nov 13 '12 at 19:57
3

I didn't find this linked from anywhere, so it's probably unofficial, but you can get the Windows installer for Mono 3.0.10 from here:

http://download.mono-project.com/archive/3.0.10/windows-installer/mono-3.0.10-gtksharp-2.12.11-win32-0.exe

Edit: To ensure that you're downloading the latest version, open http://download.mono-project.com/archive/, and check each of the version subdirectories (starting from the last and moving back) until you find one that contains a "windows-installer" subdirectory.

Douglas
  • 53,759
  • 13
  • 140
  • 188
2

There is now a link to a Windows installer for Mono 3.0.1. Unfortunately it doesn't seem to install on Windows 7 64bit. You may have better luck.

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

Johan
  • 660
  • 1
  • 6
  • 13
0

To complete Dominique Goudreault's great solution concerning " Denis The Menace's question in the comments, "Ubuntu 13.04 x86. It says /usr/bin/ld: testgdi.o: undefined reference to symbol 'g_print'"

Please follow this simple trick which got it done for me.

http://www.sgvulcan.com/libgdiplus-2-10-9-build-fails-on-slacware-current64-2012-06/

I can't reply to the comment as I wished, so I have to put up another answer here, any suggestion for a better practice?

Update: Opps, I didn't notice David V has already pointed out the solution, gave all credit to him, my link says the same thing, but maybe provided a clearer path. :P

TongZZZ
  • 756
  • 2
  • 8
  • 20