This is assuming that you have already installed a previous version of MONO on CentOS x64.

There are a few differences compared to the previous version and that is why I chose to uninstall first.

 

First uninstall the older versions of the apps :

  • libgdiplus
  • mono
  • xsp
  • mod_mono

If you built from source, go to the directories where you obviously kept the installation files and go through the folders... if not: you're on your own!

cd /opt/libgdiplus-2.4;
make uninstall;
cd ../mono-2.4;
make uninstall;
cd ../xsp-2.4;
make uninstall;
cd ../mod_mono-2.4;
make uninstall;
cd ..

Fetch the newest files

wget http://ftp.novell.com/pub/mono/sources/libgdiplus/libgdiplus-2.4.2.tar.bz2;
wget http://ftp.novell.com/pub/mono/sources/mono/mono-2.4.2.3.tar.bz2;
wget http://ftp.novell.com/pub/mono/sources/xsp/xsp-2.4.2.tar.bz2;
wget http://ftp.novell.com/pub/mono/sources/mod_mono/mod_mono-2.4.2.tar.bz2;

Unzip them with their version numbers

tar -jxvf libgdiplus-2.4.2.tar.bz2;
tar -jxvf mono-2.4.2.3.tar.bz2;
tar -jxvf xsp-2.4.2.tar.bz2;
tar -jxvf mod_mono-2.4.2.tar.bz2;

Install libgdiplus

cd libgdiplus-2.4.2;
./configure --prefix=/usr/local;
make; make install;

Install mono - this takes a while

cd ../mono-2.4.2.3;
./configure --prefix=/usr/local;
make; make install;

Add to /etc/profile

nano /etc/profile

if [ "$PKG_CONFIG_PATH" = "" ]; then
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
else
PKG_CONFIG_PATH=
/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
fi

if [ "$MANPATH" = "" ]; then
MANPATH="
/usr/local/share/man"
else
MANPATH="
/usr/local/share/man:$MANPATH"
fi

PATH=
/usr/local/bin:/usr/local/share:$PATH

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC PKG_CONFIG_PATH MANPATH

Ensure path is available

nano ~/.bashrc


PATH=/usr/local/bin:$PATH
LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

Commit the changes

bash

Check the MONO version you have just installed

mono -V

This will prevent compiler errors

export PKG_CONFIG_PATH=/usr/lib/pkgconfig

Install XSP

cd ../xsp-2.4/;
./configure --prefix=/usr/local;
make; make install

Install Mod_Mono

cd /src/mod_mono-2.4/;
./configure --prefix=/usr/local --with-apxs=/usr/sbin/apxs
make; make install

Configure apache

there are a few files that need to be utilized here to ensure that PLESK does not overwrite anything:

nano /etc/httpd/conf/mod_mono.conf

Ensure the correct path for a 64 bit arch as it will render an error :

Cannot load /usr/lib/httpd/modules/mod_mono.so into server: /usr/lib/httpd/modules/mod_mono.so: wrong ELF class: ELFCLASS32

# mod_mono.conf
<IfModule !mod_mono.c>
    LoadModule mono_module/usr/lib64/httpd/modules/mod_mono.so
</IfModule>

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 .vb
AddType application/x-asp-net .master
AddType application/x-asp-net .sitemap
AddType application/x-asp-net .resources
AddType application/x-asp-net .skin
AddType application/x-asp-net .browser
AddType application/x-asp-net .webinfo
AddType application/x-asp-net .resx
AddType application/x-asp-net .licx
AddType application/x-asp-net .csproj
AddType application/x-asp-net .vbproj
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

For each domain or subdomain that will be using mono

nano /var/www/vhosts/<domain>/conf/vhost.conf

ServerAlias www.blog.<domain>.com

Include /etc/httpd/conf/mod_mono.conf
    ServerName blog.<domain>.com
    ServerAdmin webmaster@<domain>.com
    DocumentRoot /var/www/vhosts/<domain>.com/subdomains/blog/httpdocs
    DirectoryIndex index.html default.aspx
    MonoDocumentRootDir "/var/www/vhosts/<domain>.com/subdomains/blog/httpdocs"
#the text "blogsite" needs to be unique for each domain or subdomain
    MonoServerPath blogsite "/usr/local/bin/mod-mono-server2"
    MonoApplications blogsite "/:/var/www/vhosts/<domain>.com/subdomains/blog/httpdocs"

    <Directory /var/www/vhosts/<domain>.com/subdomains/blog/httpdocs>
        MonoSetServerAlias blogsite
        SetHandler mono
        AddHandler mod_mono .aspx .ascx .asax .ashx .config .cs .asmx
    </Directory>