published on: mingster

Mono no longer packages for Red Hat distribution but still provide sources. Here we will grab the source code, and install manually on a Cent OS 5.2 box.

First off, make sure you have all the development tools installed:

Pre-Software requirement

yum groupinstall "Development Tools"
yum install httpd build-essential gcc bzip bison pkgconfig glib-devel \
glib2-devel httpd-devel libpng-devel libX11-devel freetype fontconfig \
pango-devel ruby ruby-rdoc gtkhtml38-devel wget

At this time, Mono 2.0.1 is the latest. You can always check for new build at http://ftp.novell.com/pub/mono/sources-stable/

Getting all the needed Mono software

cd /root
wget http://ftp.novell.com/pub/mono/sources/mono/mono-2.0.1.tar.bz2
wget http://ftp.novell.com/pub/mono/sources/xsp/xsp-2.0.tar.bz2
wget http://ftp.novell.com/pub/mono/sources/mod_mono/mod_mono-2.0.tar.bz2
wget http://ftp.novell.com/pub/mono/sources/libgdiplus/libgdiplus-2.0.tar.bz2

Unlike many other tutorials, we will install using "Java" style - the version # is included:

mkdir /opt/mono-2.0.1

Let's make a desult symlink:,

ln -s /opt/mono-2.0.1 /opt/mono

This is needed when building xsp:

export PKG_CONFIG_PATH=/usr/lib/pkgconfig/:/opt/mono/lib/pkgconfig/:/usr/lib/
Set path (even we don't actually have it yet)

export PATH=/opt/mono/bin:$PATH

Now we are ready to compile:

tar jvfx mono-2.0.1.tar.bz2

cd mono-2.0.1
./configure --prefix=/opt/mono-2.0.1
make; make install

tar jvfx xsp-2.0.tar.bz2
cd ~/xsp-2.0
./configure --prefix=/opt/mono
make; make install</p>

tar jvfx mod_mono-2.0.tar.bz2</code>
cd ~/mod_mono-2.0
./configure --prefix=/opt/mono --with-mono-prefix=/opt/mono --with-apr-config=/usr/lib/httpd/modules
make; make install

tar jvfx libgdiplus-2.0.tar.bz2
cd ~/libgdiplus-2.0
./configure
make; make install

You should now have mod_mono.so in /usr/lib/httpd/modules. Also you should have mod_server in /opt/mono/bin.
You directories should look like those:

Directory contents are as follows:

ls /opt/mono/bin/

al                    mono-api-info
al2 mono-api-info2
asp-state monodis
asp-state2 mono-find-provides
caspol mono-find-requires
cert2spc monograph
certmgr monolinker
chktrust monop
cilc monop2
dbsessmgr mono-service
dbsessmgr2 mono-service2
disco mono-shlib-cop
dtd2rng mono-test-install
dtd2xsd mono-xmltool
fastcgi-mono-server mozroots
fastcgi-mono-server2 nunit-console
gacutil nunit-console2
genxs pedump
gmcs permview
httpcfg prj2make
ilasm resgen
ilasm2 resgen2
installvst secutil
jay setreg
macpack sgen
makecert signcode
mbas smcs
mconfig sn
mcs soapsuds
mjs sqlsharp
mkbundle wsdl
mkbundle2 wsdl2
mod-mono-server xbuild
mod-mono-server2 xsd
mono xsp
mono-api-diff xsp2

ls /opt/mono/lib/

libgdiplus.a             libmono-profiler-aot.so.0
libgdiplus.la libmono-profiler-aot.so.0.0.0
libgdiplus.so libmono-profiler-cov.a
libgdiplus.so.0 libmono-profiler-cov.la
libgdiplus.so.0.0.0 libmono-profiler-cov.so
libikvm-native.a libmono-profiler-cov.so.0
libikvm-native.la libmono-profiler-cov.so.0.0.0
libikvm-native.so libmono.so
libmono.a libmono.so.0
libmono.la libmono.so.0.0.0
libMonoPosixHelper.a libMonoSupportW.a
libMonoPosixHelper.la libMonoSupportW.la
libMonoPosixHelper.so libMonoSupportW.so
libmono-profiler-aot.a mono
libmono-profiler-aot.la pkgconfig
libmono-profiler-aot.so xsp

ls /usr/lib/httpd/modules/

libphp5.so              mod_file_cache.so
mod_actions.so mod_filter.so
mod_alias.so mod_headers.so
mod_asis.so mod_ident.so
mod_auth_basic.so mod_imagemap.so
mod_auth_digest.so mod_include.so
mod_authn_alias.so mod_info.so
mod_authn_anon.so mod_ldap.so
mod_authn_dbd.so mod_log_config.so
mod_authn_dbm.so mod_log_forensic.so
mod_authn_default.so mod_logio.so
mod_authn_file.so mod_mem_cache.so
mod_authnz_ldap.so mod_mime_magic.so
mod_authz_dbm.so mod_mime.so
mod_authz_default.so mod_mono.so
mod_authz_groupfile.so mod_mono.so.0.0.0
mod_authz_host.so mod_negotiation.so
mod_authz_owner.so mod_proxy_ajp.so
mod_authz_user.so mod_proxy_balancer.so
mod_autoindex.so mod_proxy_connect.so
mod_cache.so mod_proxy_ftp.so
mod_cern_meta.so mod_proxy_http.so
mod_cgid.so mod_proxy.so
mod_cgi.so mod_rewrite.so
mod_dav_fs.so mod_setenvif.so
mod_dav.so mod_speling.so
mod_dbd.so mod_status.so
mod_deflate.so mod_suexec.so
mod_dir.so mod_unique_id.so
mod_disk_cache.so mod_userdir.so
mod_dumpio.so mod_usertrack.so
mod_env.so mod_version.so
mod_expires.so mod_vhost_alias.so
mod_ext_filter.so

And the mod_mono config file should be like this:

ls /etc/httpd/conf/mod_mono.conf
vi
/etc/httpd/conf/mod_mono.conf


LoadModule mono_module /usr/lib/httpd/modules/mod_mono.so
AddType application/x-asp-net .aspx
AddType application/x-asp-net .asmx
AddType application/x-asp-net .ashx
AddType application/x-asp-net .asax
AddType application/x-asp-net .ascx
AddType application/x-asp-net .soap
AddType application/x-asp-net .rem
AddType application/x-asp-net .axd
AddType application/x-asp-net .cs
AddType application/x-asp-net .config
AddType application/x-asp-net .Config
AddType application/x-asp-net .dll
DirectoryIndex index.aspx
DirectoryIndex Default.aspx
DirectoryIndex default.aspx

Let's move it to CentOS style:

mv /etc/httpd/conf/mod_mono.conf /etc/httpd/conf.d/mod_mono.conf

Restart web server

service httpd restart

Make a simple test file named default.aspx:

If you see that message at http://localhost/default.aspx, congrad, there you have it!