Install Mono and Monodevelop on CentOS 5.x/6.x

hawx picture hawx · Jun 3, 2013 · Viewed 29.4k times · Source

I am trying to install Mono and Monodevelop on a CentOS 5.9 environment.

I have tried the following instructions, with no luck.

http://fealves78.blogspot.co.uk/2012/08/install-mono-and-monodevelop-on-centos.html

Can anyone suggest an alternative to the the above link.

Answer

Justin picture Justin · Jun 11, 2013

On these systems, I typically install Mono from source. It is a bit more work but you do not have to rely on dated or broken packages that may or may not be maintained. Also, it makes it easy to upgrade to the latest versions of Mono.

The instructions below were tested on CentOS 6.4.

Head over to /usr/src as root

su
cd /usr/src

Ensure GCC and friends are installed (to build the Mono source code)

yum install gcc gcc-c++ libtool bison autoconf automake

Grab and unpack the Mono source code

wget http://download.mono-project.com/sources/mono/mono-3.0.7.tar.bz2
tar -xvjf mono-3.0.7.tar.bz2

Build and install Mono

cd mono-3.0.7
./configure --prefix=/usr
make && make install

Verify that you have a working Mono installation with mono --version and mcs --version

Build the GDI+ compatibility layer (required for System.Drawing)

yum install glib2-devel libX11-devel pixman-devel fontconfig-devel freetype-devel libexif-devel libjpeg-devel libtiff-devel libpng-devel giflib-devel

cd /usr/src
wget http://download.mono-project.com/sources/libgdiplus/libgdiplus-2.10.9.tar.bz2
tar -xvjf libgdiplus-2.10.9.tar.bz2
cd libgdiplus-2.10.9
./configure --prefix=/usr
make && make install

That is it for Mono but building MonoDevelop is another story...

Build Gtk-Sharp

yum install gtk2-devel libglade2-devel

cd /usr/src
wget http://download.mono-project.com/sources/gtk-sharp212/gtk-sharp-2.12.8.tar.bz2
tar -xvjf gtk-sharp-2.12.8.tar.bz2
cd gtk-sharp-2.12.8
./configure --prefix=/usr
make && make install

Unfortunately, I do not think there is a proper source tarball of gnome-sharp that is new enough for what we need. So, we will get it from the Git repository.

yum install pango-devel atk-devel libgnome-devel libgnomecanvas-devel libgnomeui-devel git svn libtool

cd /usr/src
git clone git://github.com/mono/gnome-sharp
cd gnome-sharp
./bootstrap-2.24 --prefix=/usr
make && make install

Same for Mono Addins...

cd /usr/src
git clone git://github.com/mono/mono-addins
cd mono-addins
./autogen.sh --prefix=/usr
make && make install

Finally, we can build MonoDevelop itself.

cd /usr/src
wget http://download.mono-project.com/sources/monodevelop/monodevelop-3.1.1.tar.bz2
tar -xvjf monodevelop-3.1.1.tar.bz2
cd monodevelop-3.1.1
PKG_CONFIG_PATH=/usr/lib/pkgconfig
export PKG_CONFIG_PATH
./configure --prefix=/usr --select
make && make install

You should now see MonoDevelop in the Programming menu under Applications!

Now that we are doing all this fun Git stuff, it is easy enough to upgrade to the latest (pre-release) version of Mono any time we want...

First time checking out of Git:

cd /usr/src
git clone git://github.com/mono/mono
cd mono
./autogen.sh --prefix=/usr
make && make install

To just upgrade to the latest version (after the first time building from Git)

cd /usr/src/mono
git pull
./autogen.sh --prefix=/usr
make && make install

If you do not want the bleeding edge, you can use Git to check-out more stable branches of Mono instead. I will leave that as an exercise for Wikipedia.