42

How do I install the Mono 2.6.7 runtime on CentOS 5.5 using YUM?

I know how to build Mono from the source. However, according to the page Getting Started With Mono Tools it is possible to install the binaries directly. I'd prefer to install the binaries to avoid having to install all the development pre-requisites on a server with little disk space.

Am I supposed to add a new repository description to YUM? I tried doing that, but I must have done it wrong, because "yum list mono-core" still says the old version (1.2.4-2.el5.centos).

And, why are the .rpm's called "mono-addon-" on the release server? It's a bit confusing. It sounds like the .rpm's are an add-on to Mono. I guess they mean they are an "add-on" to the server(?).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
octonion
  • 759
  • 2
  • 8
  • 12
  • They are called add-on because they are installed to a separate prefix than the usual system packages. This way you can install them without conflicting with your system packages. (More of a problem for SLES, which these packages are based on.) – jpobst Aug 18 '10 at 14:32
  • Ah right - is that a standard linuxy convention? – octonion Aug 18 '10 at 21:20

2 Answers2

63

I figured it out.

Create a new repository configuration file

cd /etc/yum.repos.d
vi mono.repo

Add the following lines to the file

[Mono]
name=Mono Stack (RHEL_5)
type=rpm-md
baseurl=http://ftp.novell.com/pub/mono/download-stable/RHEL_5/
gpgcheck=1
gpgkey=http://ftp.novell.com/pub/mono/download-stable/RHEL_5/repodata/repomd.xml.key
enabled=1

Update the YUM cache to be on the safe side

yum clean all

Install the Mono server stack

yum install monotools-addon-server

The installed binaries will end up in "/opt/novell/mono/bin".

You should issue the following command to set up your shell environment so that it finds Mono, mcs and the other Mono tools

source /opt/novell/mono/bin/mono-addon-environment.sh

Verify the version

mono --version

Mono JIT compiler version 2.6.7 (tarball Mon Jul 19 18:28:58 UTC 2010)
Copyright (C) 2002-2010 Novell, Inc and Contributors. www.mono-project.com
        TLS:           __thread
        GC:            Included Boehm (with typed GC and Parallel Mark)
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none

If you want the Mono environment to be permanent you can issue the following command.

cp /opt/novell/mono/bin/mono-addon-environment.sh /etc/profile.d

Happy Mono'ing!!!

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
octonion
  • 759
  • 2
  • 8
  • 12
  • 11
    If yoy get an error "System.IO.FileLoadException: Could not load file or assembly ‘System.IdentityModel, Version=3.0.0.0 …" install WCF: yum install mono-addon-wcf – Santiago Corredoira Dec 11 '10 at 12:11
  • 3
    Great stuff! These steps also make it easy to install Mono on the Amazon Linux AMI on EC2, though you have to precede most commands with 'sudo'. – Dave Van den Eynde Mar 03 '11 at 20:43
  • +1 bloody brilliant, and here was I trying to build this from src :) – Kev Mar 19 '11 at 14:51
  • 1
    @Dave Van den Eynde On Amazon Linux AMI you can type "sudo -i" to get the root shell. – Marek Stój Jan 05 '12 at 19:27
  • Is this still accurate? I tried it again today, but I'm getting an older version from Novell. – Dave Van den Eynde Feb 22 '12 at 22:11
  • The novell repo is turend off. Is there an alternative? – Rodja Jul 10 '12 at 13:58
  • 1
    I was able to get it installed by manually installing this rpm: rpm -Uvh http://origin-download.mono-project.com/download-stable/openSUSE_11.4/i586/mono-core-2.10.6-0.xamarin.i586.rpm – Yablargo Jul 13 '12 at 16:52
  • 1
    This is not working any more. You can compile from sources though. Manual is available at http://www.mono-project.com/Compiling_Mono_From_Tarball . Link to tarballs is there as well. – clorz Apr 23 '13 at 12:04
5

In addition to octonion's post, if, like me, you want to use Apache mod_mono, you need to ensure you install the correct version of mod_mono by running the following, and it will get the right one:

yum install mod_mono-addon

Don't just issue yum install mod_mono. It may install mod_mono 1.2 version from the CentOS extras repository and not what you're actually after.

As a reference, I was getting the following error in /var/log/httpd/error_log when running the incorrect mod_mono version:

Root directory: /
mod_mono and xsp have different versions. Expected '9', got 6 System.InvalidOperationException: mod_mono and xsp have different versions. Expected '9', got 6

It is a silly, but easy mistake to make if you new to this like me.

Community
  • 1
  • 1
Mark
  • 2,454
  • 4
  • 26
  • 29