Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Install mono on centOS 6.x
$ yum install bison gettext glib2 freetype fontconfig libpng libpng-devel libX11 libX11-devel glib2-devel libgdi* libexif glibc-devel urw-fonts java unzip gcc gcc-c++ automake autoconf libtool make bzip2 wget
$ cd /usr/local/src
$ wget http://download.mono-project.com/sources/mono/mono-3.2.8.tar.bz2
$ tar jxf mono-3.2.8.tar.bz2
$ cd mono-3.2.8
$ ./configure --prefix=/opt/mono
$ make && make install
$ export PATH=$PATH:/opt/mono/bin
$ export PKG_CONFIG_PATH=/opt/mono/lib/pkgconfig
$ # make sure to add the previous two lines to your ~/.bash_profile

This worked with mono-3.12.0 on CentOS6. Thank you!

gilaxone commented Apr 9, 2015

Same here, build complete with mono-3.12.1 on CentOS6, thank you very much

It worked with me too. But i dont understand why do we need to install the java,unzip package as you have mentioned as dependency.

tomcatzh commented Jun 5, 2015

It doesn't work on Centos 5.11, report a compile error with -fPIC

Miirek commented Sep 4, 2015

Worked for me with mono mono-4.0.3 @ CentOS release 6.7 (Final)

ok for me on Centos 6.6 and mono : http://download.mono-project.com/sources/mono/

Just get error on yum lib install :
Erreur : Paquet : libgdiplus0-3.12-1.x86_64 (download.mono-project.com_repo_centos_)
Requiert : libpng15.so.15()(64bit)
Erreur : Paquet : libgdiplus0-3.12-1.x86_64 (download.mono-project.com_repo_centos_)
Requiert : libtiff.so.5()(64bit)
Erreur : Paquet : libgdiplus0-3.12-1.x86_64 (download.mono-project.com_repo_centos_)
Requiert : libtiff.so.5(LIBTIFF_4.0)(64bit)
Erreur : Paquet : libgdiplus0-3.12-1.x86_64 (download.mono-project.com_repo_centos_)
Requiert : libpng15.so.15(PNG15_0)(64bit)
Erreur : Paquet : libgdiplus0-3.12-1.x86_64 (download.mono-project.com_repo_centos_)
Requiert : libc.so.6(GLIBC_2.14)(64bit)

Pegazux commented Sep 12, 2015

Worked for me with mono mono-4.0.4 @ CentOS release 6.7 (Final)

Worked with 4.2.1.36 on Centos 6.6 Final (with the obvious script changes for version)

Also, to install XSP I had to:
cd /usr/local/src
wget http://origin-download.mono-project.com/sources/xsp/xsp-3.8.tar.gz
tar zxvf xsp-3.8.tar.gz
cd xsp-3.8

When I ran configure this failed so:
cd /opt/mono/bin
ln -s mcs ./gmcs

Back to the compile:
cd -
./configure --prefix=/opt/mono
make && make install

Then assuming /opt/mono is on you path
xsp4 --port 9000
will start the server.

When I tried to use a test calendar script:

<%@ Page Language="C#" %>
<html>
<head>
   <title>Sample Calendar</title>
</head>
<asp:calendar showtitle="true" runat="server">
</asp:calendar>

I got an error about LIBGDIPLUS not found. I installed this and tried again. Still the same error.
The libgdiplus.so library went into /usr/local/lib which isn't default for ldconfig.

vi /etc/ld.so.conf
add a new line for /usr/local/lib
run 'ldconfig' as root.
Run 'ldconfig -p | grep libgdiplus' to test it find it and stop and start the XSP server again.

All working so far .... Hope this helps someone.

robozeri commented Dec 3, 2015

thanks

Works for Mono 4.2.2 on CentOS 7. Thanks a lot.

kimhs20 commented Feb 16, 2016

Works for Mono 3.12.1 on CentOS 6.3...

kimhs20 commented Feb 16, 2016

Wow! works Mono 4.2.2.30 on CentOS 6.3.. Great

avarabei commented Apr 6, 2016

@kimhs20 which monolite version have you used? I get this error all the time:

*** The compiler 'mcs' doesn't appear to be usable.
*** Trying the 'monolite' directory.
Bootstrap compiler: Mono C# compiler version 4.3.2.0
./../jay/jay: 8 shift/reduce conflicts.
mkdir -p -- ../class/lib/basic/
MCS     [basic] basic.exe
warning CS8001: SDK path could not be resolved
warning CS1685: The predefined type 'System.Security.Permissions.HostProtectionAttribute' is defined multiple times. Using definition from 'mscorlib.dll'
/usr/local/src/mono-4.2.2/mcs/class/lib/monolite/mscorlib.dll (Location of the symbol related to previous warning)
/usr/local/src/mono-4.2.2/mcs/class/lib/monolite/System.dll (Location of the symbol related to previous warning)

Unhandled Exception:
System.InvalidCastException: Arg_InvalidCastException
  at System.Collections.Generic.EnumEqualityComparer'1[T].Equals (T x, T y) <0x41339f80 + 0x00046> in <filename unknown>:0
  at System.Collections.Generic.List'1[T].Contains (System.Collections.Generic.T item) <0x413393f0 + 0x0009f> in <filename unknown>:0
  at Mono.CSharp.TypeDefinition.CheckPairedOperators () <0x41338e40 + 0x0014b> in <filename unknown>:0
  at Mono.CSharp.TypeDefinition.DoDefineMembers () <0x4131cb70 + 0x00c67> in <filename unknown>:0
  at Mono.CSharp.ClassOrStruct.DoDefineMembers () <0x4131c6e0 + 0x0022f> in <filename unknown>:0
  at Mono.CSharp.Class.DoDefineMembers () <0x4131c000 + 0x0068f> in <filename unknown>:0
  at Mono.CSharp.TypeDefinition.Define () <0x4131bad0 + 0x0002c> in <filename unknown>:0
  at Mono.CSharp.TypeContainer.Define () <0x4131b9e0 + 0x0005a> in <filename unknown>:0
  at Mono.CSharp.TypeContainer.Define () <0x4131b9e0 + 0x0005a> in <filename unknown>:0
  at Mono.CSharp.TypeContainer.Define () <0x4131b9e0 + 0x0005a> in <filename unknown>:0
  at Mono.CSharp.ModuleContainer.Define () <0x41304c00 + 0x00027> in <filename unknown>:0
  at Mono.CSharp.Driver.Compile () <0x412496b0 + 0x00634> in <filename unknown>:0
  at Mono.CSharp.Driver.Main (System.String[] args) <0x4121ce00 + 0x00173> in <filename unknown>:0

avarabei commented Apr 7, 2016

just succeed to make mono-4.4.0.40 with monolite 140: http://download.mono-project.com/monolite/monolite-140-latest.tar.gz

it was required to install monolite right after configure ( "./autogen.sh --prefix=/opt/mono" ):

make get-monolite-latest monolite_url=http://download.mono-project.com/monolite/monolite-140-latest.tar.gz

P.S. CentOS 6.7

The installation worked with Mono 4.2.3.4 on RHEL 6. Thank you!
I am a newbie at Linux. I'd like to compile a C# code just to test my Mono installation. If I type, $ cms HelloWorld.cs from a terminal window, I am getting an error message "bash: cms: command not found". How can I start Mono? Please help.

Dear all,
I can finish the install setup in Centos6.6, but I can not run aspx website in apache
https://drive.google.com/file/d/0BxriXuT0xeaFcl9KOGZ2YXROYUk/view?usp=sharing
Or how can we setup mono for aspx file normal running in Centos? Thanks a lot.

schm3tterling commented Feb 13, 2017 edited

I was able to to install mono 4.9 and xsp 4.2. on CentOS release 6.8 (Final) based on your instructions, thanks!

I also got the error I got an error about LIBGDIPLUS not found because for some reason this would not install. I installed it from

http://download.mono-project.com/sources/libgdiplus/

using the commands below and it ran successfully.

cd /usr/local/src
wget http://download.mono-project.com/sources/libgdiplus/libgdiplus-4.2.tar.gz
tar zxvf libgdiplus-4.2.tar.gz
cd libgdiplus-4.2
./configure --prefix=/opt/mono
make && make install

Hope this helps someone else and thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment